Extract UsbCommand_GetDebugInfo() into its own file.
This commit is contained in:
22
right/src/usb_commands/usb_command_get_debug_info.c
Normal file
22
right/src/usb_commands/usb_command_get_debug_info.c
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "fsl_common.h"
|
||||||
|
#include "fsl_i2c.h"
|
||||||
|
#include "usb_commands/usb_command_get_debug_info.h"
|
||||||
|
#include "usb_protocol_handler.h"
|
||||||
|
#include "slave_scheduler.h"
|
||||||
|
#include "i2c_watchdog.h"
|
||||||
|
|
||||||
|
void UsbCommand_GetDebugInfo(void)
|
||||||
|
{
|
||||||
|
*(uint32_t*)(UsbDebugInfo+1) = I2C_Watchdog;
|
||||||
|
*(uint32_t*)(UsbDebugInfo+5) = I2cSchedulerCounter;
|
||||||
|
*(uint32_t*)(UsbDebugInfo+9) = I2cWatchdog_OuterCounter;
|
||||||
|
*(uint32_t*)(UsbDebugInfo+13) = I2cWatchdog_InnerCounter;
|
||||||
|
|
||||||
|
memcpy(GenericHidOutBuffer, UsbDebugInfo, USB_GENERIC_HID_OUT_BUFFER_LENGTH);
|
||||||
|
|
||||||
|
/* uint64_t ticks = microseconds_get_ticks();
|
||||||
|
uint32_t microseconds = microseconds_convert_to_microseconds(ticks);
|
||||||
|
uint32_t milliseconds = microseconds/1000;
|
||||||
|
*(uint32_t*)(GenericHidOutBuffer+1) = ticks;
|
||||||
|
*/
|
||||||
|
}
|
||||||
8
right/src/usb_commands/usb_command_get_debug_info.h
Normal file
8
right/src/usb_commands/usb_command_get_debug_info.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef __USB_COMMAND_GET_DEBUG_INFO_H__
|
||||||
|
#define __USB_COMMAND_GET_DEBUG_INFO_H__
|
||||||
|
|
||||||
|
// Functions:
|
||||||
|
|
||||||
|
void UsbCommand_GetDebugInfo(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "usb_commands/usb_command_send_kboot_command.h"
|
#include "usb_commands/usb_command_send_kboot_command.h"
|
||||||
#include "usb_commands/usb_command_launch_eeprom_transfer_legacy.h"
|
#include "usb_commands/usb_command_launch_eeprom_transfer_legacy.h"
|
||||||
#include "usb_commands/usb_command_get_keyboard_state.h"
|
#include "usb_commands/usb_command_get_keyboard_state.h"
|
||||||
|
#include "usb_commands/usb_command_get_debug_info.h"
|
||||||
|
|
||||||
uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH];
|
uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH];
|
||||||
|
|
||||||
@@ -78,22 +79,6 @@ void getAdcValue(void)
|
|||||||
*(uint32_t*)(GenericHidOutBuffer+1) = ADC_Measure();
|
*(uint32_t*)(GenericHidOutBuffer+1) = ADC_Measure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void getDebugInfo(void)
|
|
||||||
{
|
|
||||||
*(uint32_t*)(UsbDebugInfo+1) = I2C_Watchdog;
|
|
||||||
*(uint32_t*)(UsbDebugInfo+5) = I2cSchedulerCounter;
|
|
||||||
*(uint32_t*)(UsbDebugInfo+9) = I2cWatchdog_OuterCounter;
|
|
||||||
*(uint32_t*)(UsbDebugInfo+13) = I2cWatchdog_InnerCounter;
|
|
||||||
|
|
||||||
memcpy(GenericHidOutBuffer, UsbDebugInfo, USB_GENERIC_HID_OUT_BUFFER_LENGTH);
|
|
||||||
|
|
||||||
/* uint64_t ticks = microseconds_get_ticks();
|
|
||||||
uint32_t microseconds = microseconds_convert_to_microseconds(ticks);
|
|
||||||
uint32_t milliseconds = microseconds/1000;
|
|
||||||
*(uint32_t*)(GenericHidOutBuffer+1) = ticks;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// The main protocol handler function
|
// The main protocol handler function
|
||||||
|
|
||||||
void UsbProtocolHandler(void)
|
void UsbProtocolHandler(void)
|
||||||
@@ -143,7 +128,7 @@ void UsbProtocolHandler(void)
|
|||||||
UsbCommand_GetKeyboardState();
|
UsbCommand_GetKeyboardState();
|
||||||
break;
|
break;
|
||||||
case UsbCommandId_GetDebugInfo:
|
case UsbCommandId_GetDebugInfo:
|
||||||
getDebugInfo();
|
UsbCommand_GetDebugInfo();
|
||||||
break;
|
break;
|
||||||
case UsbCommandId_JumpToSlaveBootloader:
|
case UsbCommandId_JumpToSlaveBootloader:
|
||||||
UsbCommand_JumpToSlaveBootloader();
|
UsbCommand_JumpToSlaveBootloader();
|
||||||
|
|||||||
Reference in New Issue
Block a user