Extract UsbCommand_GetAdcValue() to its own file.
This commit is contained in:
8
right/src/usb_commands/usb_command_get_adc_value.c
Normal file
8
right/src/usb_commands/usb_command_get_adc_value.c
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "usb_protocol_handler.h"
|
||||||
|
#include "slave_drivers/kboot_driver.h"
|
||||||
|
#include "peripherals/adc.h"
|
||||||
|
|
||||||
|
void UsbCommand_GetAdcValue(void)
|
||||||
|
{
|
||||||
|
*(uint32_t*)(GenericHidOutBuffer+1) = ADC_Measure();
|
||||||
|
}
|
||||||
8
right/src/usb_commands/usb_command_get_adc_value.h
Normal file
8
right/src/usb_commands/usb_command_get_adc_value.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef __USB_COMMAND_GET_ADC_VALUE_H__
|
||||||
|
#define __USB_COMMAND_GET_ADC_VALUE_H__
|
||||||
|
|
||||||
|
// Functions:
|
||||||
|
|
||||||
|
void UsbCommand_GetAdcValue(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "usb_commands/usb_command_get_debug_info.h"
|
#include "usb_commands/usb_command_get_debug_info.h"
|
||||||
#include "usb_commands/usb_command_reenumerate.h"
|
#include "usb_commands/usb_command_reenumerate.h"
|
||||||
#include "usb_commands/usb_command_set_test_led.h"
|
#include "usb_commands/usb_command_set_test_led.h"
|
||||||
|
#include "usb_commands/usb_command_get_adc_value.h"
|
||||||
|
|
||||||
uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH];
|
uint8_t UsbDebugInfo[USB_GENERIC_HID_OUT_BUFFER_LENGTH];
|
||||||
|
|
||||||
@@ -55,11 +56,6 @@ void setLedPwm(void)
|
|||||||
UhkModuleStates[UhkModuleDriverId_LeftKeyboardHalf].sourceVars.ledPwmBrightness = brightnessPercent;
|
UhkModuleStates[UhkModuleDriverId_LeftKeyboardHalf].sourceVars.ledPwmBrightness = brightnessPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getAdcValue(void)
|
|
||||||
{
|
|
||||||
*(uint32_t*)(GenericHidOutBuffer+1) = ADC_Measure();
|
|
||||||
}
|
|
||||||
|
|
||||||
// The main protocol handler function
|
// The main protocol handler function
|
||||||
|
|
||||||
void UsbProtocolHandler(void)
|
void UsbProtocolHandler(void)
|
||||||
@@ -88,7 +84,7 @@ void UsbProtocolHandler(void)
|
|||||||
setLedPwm();
|
setLedPwm();
|
||||||
break;
|
break;
|
||||||
case UsbCommandId_GetAdcValue:
|
case UsbCommandId_GetAdcValue:
|
||||||
getAdcValue();
|
UsbCommand_GetAdcValue();
|
||||||
break;
|
break;
|
||||||
case UsbCommandId_LaunchEepromTransferLegacy:
|
case UsbCommandId_LaunchEepromTransferLegacy:
|
||||||
UsbCommand_LaunchEepromTransferLegacy();
|
UsbCommand_LaunchEepromTransferLegacy();
|
||||||
|
|||||||
Reference in New Issue
Block a user