|
|
|
|
|
|
|
|
// Device drivers may inherit from this base class, if they wish to receive |
|
|
// Device drivers may inherit from this base class, if they wish to receive |
|
|
// HID input data fully decoded by the USBHIDParser driver |
|
|
// HID input data fully decoded by the USBHIDParser driver |
|
|
class USBHIDInput { |
|
|
class USBHIDInput { |
|
|
|
|
|
public: |
|
|
|
|
|
operator bool() { return (mydevice != nullptr); } |
|
|
|
|
|
uint16_t idVendor() { return (mydevice != nullptr) ? mydevice->idVendor : 0; } |
|
|
|
|
|
uint16_t idProduct() { return (mydevice != nullptr) ? mydevice->idProduct : 0; } |
|
|
private: |
|
|
private: |
|
|
virtual bool claim_collection(Device_t *dev, uint32_t topusage); |
|
|
virtual bool claim_collection(Device_t *dev, uint32_t topusage); |
|
|
virtual void hid_input_begin(uint32_t topusage, uint32_t type, int lgmin, int lgmax); |
|
|
virtual void hid_input_begin(uint32_t topusage, uint32_t type, int lgmin, int lgmax); |
|
|
|
|
|
|
|
|
void add_to_list(); |
|
|
void add_to_list(); |
|
|
USBHIDInput *next; |
|
|
USBHIDInput *next; |
|
|
friend class USBHIDParser; |
|
|
friend class USBHIDParser; |
|
|
|
|
|
protected: |
|
|
|
|
|
Device_t *mydevice = NULL; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/************************************************/ |
|
|
/************************************************/ |
|
|
|
|
|
|
|
|
virtual void hid_input_end(); |
|
|
virtual void hid_input_end(); |
|
|
virtual void disconnect_collection(Device_t *dev); |
|
|
virtual void disconnect_collection(Device_t *dev); |
|
|
private: |
|
|
private: |
|
|
Device_t *mydevice = NULL; |
|
|
|
|
|
uint8_t collections_claimed = 0; |
|
|
uint8_t collections_claimed = 0; |
|
|
volatile bool mouseEvent = false; |
|
|
volatile bool mouseEvent = false; |
|
|
uint8_t buttons = 0; |
|
|
uint8_t buttons = 0; |
|
|
|
|
|
|
|
|
virtual void hid_input_end(); |
|
|
virtual void hid_input_end(); |
|
|
virtual void disconnect_collection(Device_t *dev); |
|
|
virtual void disconnect_collection(Device_t *dev); |
|
|
private: |
|
|
private: |
|
|
Device_t *mydevice = NULL; |
|
|
|
|
|
uint8_t collections_claimed = 0; |
|
|
uint8_t collections_claimed = 0; |
|
|
bool anychange = false; |
|
|
bool anychange = false; |
|
|
volatile bool joystickEvent = false; |
|
|
volatile bool joystickEvent = false; |