Extract UsbCommand_GetAdcValue() to its own file.

This commit is contained in:
László Monda
2017-11-05 01:35:12 +01:00
parent 68f9aac883
commit 84ffe50dac
3 changed files with 18 additions and 6 deletions

View 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();
}

View 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

View File

@@ -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();