51 lines
1.1 KiB
C
51 lines
1.1 KiB
C
|
#ifndef SUSTAINPEDALKEYBOARD_H
|
||
|
#define SUSTAINPEDALKEYBOARD_H
|
||
|
|
||
|
#include "libusbwrapper.h"
|
||
|
|
||
|
class UsbHidKeyEvent {
|
||
|
public:
|
||
|
UsbHidKeyEvent();
|
||
|
|
||
|
bool left_control;
|
||
|
bool left_shift;
|
||
|
bool left_alt;
|
||
|
bool left_super;
|
||
|
bool right_control;
|
||
|
bool right_shift;
|
||
|
bool right_alt;
|
||
|
bool right_super;
|
||
|
|
||
|
uint8_t keycodes[3];
|
||
|
|
||
|
uint32_t to_eeprom_word();
|
||
|
void from_eeprom_data(uint8_t data[4]);
|
||
|
};
|
||
|
|
||
|
class SustainPedalKeyboard : public UsbDevice
|
||
|
{
|
||
|
public:
|
||
|
SustainPedalKeyboard(libusb_device *device);
|
||
|
SustainPedalKeyboard(const UsbDevice &device);
|
||
|
~SustainPedalKeyboard();
|
||
|
|
||
|
int get_control_timeout();
|
||
|
void set_control_timeout(int timeout);
|
||
|
|
||
|
int set_led(uint8_t led, bool state);
|
||
|
void set_active_indicator(bool state);
|
||
|
|
||
|
int program_keyboard_keycode(uint8_t pedal_idx, UsbHidKeyEvent &key);
|
||
|
|
||
|
int read_keyboard_config(UsbHidKeyEvent *pedal1, UsbHidKeyEvent *pedal2);
|
||
|
|
||
|
private:
|
||
|
int write_eeprom(uint16_t offset_addr, unsigned char *data, uint16_t len);
|
||
|
int read_eeprom(uint16_t offset_addr, unsigned char *data, uint16_t len);
|
||
|
|
||
|
int m_control_timeout;
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif // SUSTAINPEDALKEYBOARD_H
|