diff --git a/right/src/usb_commands/usb_command_jump_to_slave_bootloader.c b/right/src/usb_commands/usb_command_jump_to_slave_bootloader.c new file mode 100644 index 0000000..c4b53db --- /dev/null +++ b/right/src/usb_commands/usb_command_jump_to_slave_bootloader.c @@ -0,0 +1,14 @@ +#include "usb_protocol_handler.h" +#include "slave_drivers/uhk_module_driver.h" + +void UsbCommand_JumpToSlaveBootloader(void) +{ + uint8_t uhkModuleDriverId = GenericHidInBuffer[1]; + + if (uhkModuleDriverId >= UHK_MODULE_MAX_COUNT) { + SetUsbError(JumpToBootloaderError_InvalidModuleDriverId); + return; + } + + UhkModuleStates[uhkModuleDriverId].jumpToBootloader = true; +} diff --git a/right/src/usb_commands/usb_command_jump_to_slave_bootloader.h b/right/src/usb_commands/usb_command_jump_to_slave_bootloader.h new file mode 100644 index 0000000..240a8a9 --- /dev/null +++ b/right/src/usb_commands/usb_command_jump_to_slave_bootloader.h @@ -0,0 +1,8 @@ +#ifndef __USB_COMMAND_JUMP_TO_SLAVE_BOOTLOADER_H__ +#define __USB_COMMAND_JUMP_TO_SLAVE_BOOTLOADER_H__ + +// Functions: + + void UsbCommand_JumpToSlaveBootloader(void); + +#endif diff --git a/right/src/usb_protocol_handler.c b/right/src/usb_protocol_handler.c index 08c3b55..aab3343 100644 --- a/right/src/usb_protocol_handler.c +++ b/right/src/usb_protocol_handler.c @@ -18,6 +18,7 @@ #include "usb_commands/usb_command_apply_config.h" #include "usb_commands/usb_command_read_config.h" #include "usb_commands/usb_command_get_property.h" +#include "usb_commands/usb_command_jump_to_slave_bootloader.h" uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH]; @@ -138,18 +139,6 @@ void getDebugInfo(void) */ } -void jumpToSlaveBootloader(void) -{ - uint8_t uhkModuleDriverId = GenericHidInBuffer[1]; - - if (uhkModuleDriverId >= UHK_MODULE_MAX_COUNT) { - SetUsbError(JumpToBootloaderError_InvalidModuleDriverId); - return; - } - - UhkModuleStates[uhkModuleDriverId].jumpToBootloader = true; -} - void sendKbootCommand(void) { KbootDriverState.phase = 0; @@ -209,7 +198,7 @@ void UsbProtocolHandler(void) getDebugInfo(); break; case UsbCommandId_JumpToSlaveBootloader: - jumpToSlaveBootloader(); + UsbCommand_JumpToSlaveBootloader(); break; case UsbCommandId_SendKbootCommand: sendKbootCommand();