diff options
author | Florian Didron <fd@librem.one> | 2019-11-20 09:41:42 +0900 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2019-12-06 08:20:51 +0900 |
commit | 925c43c4c0e9360d2fe0032b3c41c2a84e1a4d8b (patch) | |
tree | 1d2bcbbf5db10d3eddd249c3ac4835d4b6734e64 /tmk_core/protocol/lufa | |
parent | b3c0f3b0eff91172ced5b51fb1232e47dfbd6753 (diff) |
feat: update examples + pairing process
Diffstat (limited to 'tmk_core/protocol/lufa')
-rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index c68c3c2e5b..660633fd12 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -280,19 +280,18 @@ void webusb_send(uint8_t *data, uint8_t length) { Endpoint_SelectEndpoint(WEBUSB_IN_EPNUM); - if (Endpoint_IsINReady()) { - Endpoint_Write_Stream_LE(data, length, NULL); - Endpoint_ClearIN(); - } + Endpoint_Write_Stream_LE(data, length, NULL); + Endpoint_ClearIN(); } -__attribute__((weak)) void webusb_receive(uint8_t *data, uint8_t length) { } +__attribute__((weak)) void webusb_receive_kb(uint8_t *data, uint8_t length) { } static void webusb_task(void) { // Create a temporary buffer to hold the read in data from the host uint8_t data[WEBUSB_EPSIZE]; bool data_read = false; + // Device must be connected and configured for the task to run if (USB_DeviceState != DEVICE_STATE_Configured) return; @@ -311,12 +310,7 @@ static void webusb_task(void) { Endpoint_ClearOUT(); if (data_read) { - if(webusb_state.paired == true) { - webusb_receive(data, sizeof(data)); - } - else { - webusb_error(WEBUSB_STATUS_NOT_PAIRED); - } + webusb_receive(data, sizeof(data)); } } } |