diff --git a/right/src/usb_commands/usb_command_send_kboot_command.c b/right/src/usb_commands/usb_command_send_kboot_command.c new file mode 100644 index 0000000..2d0e109 --- /dev/null +++ b/right/src/usb_commands/usb_command_send_kboot_command.c @@ -0,0 +1,9 @@ +#include "usb_protocol_handler.h" +#include "slave_drivers/kboot_driver.h" + +void UsbCommand_SendKbootCommand(void) +{ + KbootDriverState.phase = 0; + KbootDriverState.i2cAddress = GenericHidInBuffer[2]; + KbootDriverState.commandType = GenericHidInBuffer[1]; // Command should be set last. +} diff --git a/right/src/usb_commands/usb_command_send_kboot_command.h b/right/src/usb_commands/usb_command_send_kboot_command.h new file mode 100644 index 0000000..0da7a26 --- /dev/null +++ b/right/src/usb_commands/usb_command_send_kboot_command.h @@ -0,0 +1,8 @@ +#ifndef __USB_COMMAND_SEND_KBOOT_COMMAND_H__ +#define __USB_COMMAND_SEND_KBOOT_COMMAND_H__ + +// Functions: + + void UsbCommand_SendKbootCommand(void); + +#endif diff --git a/right/src/usb_protocol_handler.c b/right/src/usb_protocol_handler.c index aab3343..f5dc994 100644 --- a/right/src/usb_protocol_handler.c +++ b/right/src/usb_protocol_handler.c @@ -19,6 +19,7 @@ #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" +#include "usb_commands/usb_command_send_kboot_command.h" uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH]; @@ -139,13 +140,6 @@ void getDebugInfo(void) */ } -void sendKbootCommand(void) -{ - KbootDriverState.phase = 0; - KbootDriverState.i2cAddress = GenericHidInBuffer[2]; - KbootDriverState.commandType = GenericHidInBuffer[1]; -} - // The main protocol handler function void UsbProtocolHandler(void) @@ -201,7 +195,7 @@ void UsbProtocolHandler(void) UsbCommand_JumpToSlaveBootloader(); break; case UsbCommandId_SendKbootCommand: - sendKbootCommand(); + UsbCommand_SendKbootCommand(); break; default: break;