diff --git a/arduino/USB-Core/HID.cpp b/arduino/USB-Core/HID.cpp index 082905d..4ac49ca 100644 --- a/arduino/USB-Core/HID.cpp +++ b/arduino/USB-Core/HID.cpp @@ -57,6 +57,10 @@ const HIDDescriptor _hidInterface = D_ENDPOINT(USB_ENDPOINT_IN(HID_ENDPOINT_INT), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x01) }; +#if defined(HID_KEYBOARD_LEDS_ENABLED) +uint8_t hid_keyboard_leds = 0; +#endif + //================================================================================ //================================================================================ // Driver @@ -122,7 +126,7 @@ bool WEAK HID_Setup(Setup& setup) // write led out report data uint8_t data[2]; if (2 == USB_RecvControl(data, 2)) - HID_SetKeyboardLedReport(data[1]); + hid_keyboard_leds = data[1]; } // else TODO check for other devices like RAW HID, not needed for now } @@ -131,13 +135,6 @@ bool WEAK HID_Setup(Setup& setup) return false; } -#if defined(HID_KEYBOARD_LEDS_ENABLED) -void WEAK HID_SetKeyboardLedReport(uint8_t leds){ - // weak function implemented by the Keyboard API - // to not always create the Keyboard object, if it isn't used -} -#endif - #endif #else /* if defined(USBCON) */ diff --git a/arduino/USB-Core/HID.h b/arduino/USB-Core/HID.h index 74e5dc3..b64fb60 100644 --- a/arduino/USB-Core/HID.h +++ b/arduino/USB-Core/HID.h @@ -27,6 +27,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define HID_KEYBOARD_LEDS_ENABLED #endif +// extern accessible led out report +#if defined(HID_KEYBOARD_LEDS_ENABLED) +extern uint8_t hid_keyboard_leds; +#endif + // HID report IDs // note by NicoHood: I would not change the current IDs, since it can confuse the OS // I had several problems if i change the report id and its use. @@ -322,9 +327,6 @@ int HID_GetInterface(uint8_t* interfaceNum); int HID_GetDescriptor(int i); bool HID_Setup(Setup& setup); void HID_SendReport(uint8_t id, const void* data, int len); -#if defined(HID_KEYBOARD_LEDS_ENABLED) -void HID_SetKeyboardLedReport(uint8_t leds); -#endif #else /* if defined(USBCON) */ diff --git a/arduino/USB-Core/Keyboard.cpp b/arduino/USB-Core/Keyboard.cpp index 0ab9d4e..09732a8 100644 --- a/arduino/USB-Core/Keyboard.cpp +++ b/arduino/USB-Core/Keyboard.cpp @@ -23,14 +23,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA //================================================================================ // Keyboard -#if defined(HID_KEYBOARD_LEDS_ENABLED) -uint8_t hid_keyboard_leds = 0; -void HID_SetKeyboardLedReport(uint8_t leds){ - // implementation of the weak function in HID.cpp - hid_keyboard_leds = leds; -} -#endif - Keyboard_ Keyboard; void Keyboard_::sendReport(KeyReport* keys) diff --git a/arduino/USB-Core/Keyboard.h b/arduino/USB-Core/Keyboard.h index 67c50b6..a1003e7 100644 --- a/arduino/USB-Core/Keyboard.h +++ b/arduino/USB-Core/Keyboard.h @@ -131,11 +131,6 @@ typedef struct uint8_t keys[6]; } KeyReport; -// extern accessible led out report -#if defined(HID_KEYBOARD_LEDS_ENABLED) -extern uint8_t hid_keyboard_leds; -#endif - class Keyboard_ : public Print { protected: