diff --git a/right/src/usb_commands/usb_command_set_test_led.c b/right/src/usb_commands/usb_command_set_test_led.c new file mode 100644 index 0000000..3eb0953 --- /dev/null +++ b/right/src/usb_commands/usb_command_set_test_led.c @@ -0,0 +1,11 @@ +#include "usb_commands/usb_command_set_test_led.h" +#include "usb_protocol_handler.h" +#include "peripherals/test_led.h" +#include "slave_drivers/uhk_module_driver.h" + +void UsbCommand_SetTestLed(void) +{ + uint8_t ledState = GenericHidInBuffer[1]; + TEST_LED_SET(ledState); + UhkModuleStates[UhkModuleDriverId_LeftKeyboardHalf].sourceVars.isTestLedOn = ledState; +} diff --git a/right/src/usb_commands/usb_command_set_test_led.h b/right/src/usb_commands/usb_command_set_test_led.h new file mode 100644 index 0000000..718e8fe --- /dev/null +++ b/right/src/usb_commands/usb_command_set_test_led.h @@ -0,0 +1,8 @@ +#ifndef __USB_COMMAND_SET_TEST_LED_H__ +#define __USB_COMMAND_SET_TEST_LED_H__ + +// Functions: + + void UsbCommand_SetTestLed(void); + +#endif diff --git a/right/src/usb_protocol_handler.c b/right/src/usb_protocol_handler.c index 08c9494..8a6323f 100644 --- a/right/src/usb_protocol_handler.c +++ b/right/src/usb_protocol_handler.c @@ -25,6 +25,7 @@ #include "usb_commands/usb_command_get_keyboard_state.h" #include "usb_commands/usb_command_get_debug_info.h" #include "usb_commands/usb_command_reenumerate.h" +#include "usb_commands/usb_command_set_test_led.h" uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH]; @@ -47,13 +48,6 @@ void SetUsbResponseWord(uint16_t response) // Per command protocol command handlers -void setTestLed(void) -{ - uint8_t ledState = GenericHidInBuffer[1]; - TEST_LED_SET(ledState); - UhkModuleStates[UhkModuleDriverId_LeftKeyboardHalf].sourceVars.isTestLedOn = ledState; -} - void setLedPwm(void) { uint8_t brightnessPercent = GenericHidInBuffer[1]; @@ -80,7 +74,7 @@ void UsbProtocolHandler(void) UsbCommand_Reenumerate(); break; case UsbCommandId_SetTestLed: - setTestLed(); + UsbCommand_SetTestLed(); break; case UsbCommandId_WriteLedDriver: break;