Replace SET_DEBUG_BUFFER_UINT* macros with SetDebugBufferUint* functions for improved type safety and readability.
This commit is contained in:
@@ -3,15 +3,16 @@
|
||||
#include "usb_protocol_handler.h"
|
||||
#include "slave_scheduler.h"
|
||||
#include "i2c_watchdog.h"
|
||||
#include "buffer.h"
|
||||
|
||||
uint8_t DebugBuffer[USB_GENERIC_HID_OUT_BUFFER_LENGTH];
|
||||
|
||||
void UsbCommand_GetDebugBuffer(void)
|
||||
{
|
||||
SET_DEBUG_BUFFER_UINT32(1, I2C_Watchdog);
|
||||
SET_DEBUG_BUFFER_UINT32(5, I2cSlaveScheduler_Counter);
|
||||
SET_DEBUG_BUFFER_UINT32(9, I2cWatchdog_WatchCounter);
|
||||
SET_DEBUG_BUFFER_UINT32(13, I2cWatchdog_RecoveryCounter);
|
||||
SetDebugBufferUint32(1, I2C_Watchdog);
|
||||
SetDebugBufferUint32(5, I2cSlaveScheduler_Counter);
|
||||
SetDebugBufferUint32(9, I2cWatchdog_WatchCounter);
|
||||
SetDebugBufferUint32(13, I2cWatchdog_RecoveryCounter);
|
||||
|
||||
memcpy(GenericHidOutBuffer, DebugBuffer, USB_GENERIC_HID_OUT_BUFFER_LENGTH);
|
||||
|
||||
@@ -21,3 +22,18 @@ void UsbCommand_GetDebugBuffer(void)
|
||||
*(uint32_t*)(GenericHidOutBuffer+1) = ticks;
|
||||
*/
|
||||
}
|
||||
|
||||
void SetDebugBufferUint8(uint32_t offset, uint8_t value)
|
||||
{
|
||||
SetBufferUint8(DebugBuffer, offset, value);
|
||||
}
|
||||
|
||||
void SetDebugBufferUint16(uint32_t offset, uint16_t value)
|
||||
{
|
||||
SetBufferUint16(DebugBuffer, offset, value);
|
||||
}
|
||||
|
||||
void SetDebugBufferUint32(uint32_t offset, uint32_t value)
|
||||
{
|
||||
SetBufferUint32(DebugBuffer, offset, value);
|
||||
}
|
||||
|
||||
@@ -5,12 +5,6 @@
|
||||
|
||||
#include "usb_interfaces/usb_interface_generic_hid.h"
|
||||
|
||||
// Macros:
|
||||
|
||||
#define SET_DEBUG_BUFFER_UINT8(offset, value) (*(uint8_t*)(DebugBuffer+(offset)) = (value))
|
||||
#define SET_DEBUG_BUFFER_UINT16(offset, value) (*(uint16_t*)(DebugBuffer+(offset)) = (value))
|
||||
#define SET_DEBUG_BUFFER_UINT32(offset, value) (*(uint32_t*)(DebugBuffer+(offset)) = (value))
|
||||
|
||||
// Variables:
|
||||
|
||||
extern uint8_t DebugBuffer[USB_GENERIC_HID_OUT_BUFFER_LENGTH];
|
||||
@@ -19,4 +13,8 @@
|
||||
|
||||
void UsbCommand_GetDebugBuffer(void);
|
||||
|
||||
void SetDebugBufferUint8(uint32_t offset, uint8_t value);
|
||||
void SetDebugBufferUint16(uint32_t offset, uint16_t value);
|
||||
void SetDebugBufferUint32(uint32_t offset, uint32_t value);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user