ST/USBHOST forked to add another HID handler for raw keyboard data to get more detail not available with current handlers (all pressed keys, all releases, and periodic updates)
Dependents: C64-stm429_discovery
Diff: USBHostHID/USBHostKeyboard.h
- Revision:
- 7:9dc1cb9d5e12
- Parent:
- 1:ab240722d7ef
--- a/USBHostHID/USBHostKeyboard.h Wed Apr 26 20:08:31 2017 +0000 +++ b/USBHostHID/USBHostKeyboard.h Mon Apr 13 05:25:10 2020 +0000 @@ -70,6 +70,17 @@ } } + /** + * Attach a callback called when data received from keyboard + * + * @param ptr function pointer + */ + inline void attach(void (*ptr)(uint8_t size, uint8_t* data)) { + if (ptr != NULL) { + onKeyData = ptr; + } + } + protected: //From IUSBEnumerator virtual void setVidPid(uint16_t vid, uint16_t pid); @@ -90,6 +101,7 @@ void (*onKey)(uint8_t key); void (*onKeyCode)(uint8_t key, uint8_t modifier); + void (*onKeyData)(uint8_t len, uint8_t* data); int report_id;