Add USB command to retrieve ADC value.

This commit is contained in:
László Monda
2017-05-08 02:31:38 +02:00
parent 13e0d02574
commit 19adb8d3a4
2 changed files with 11 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
#include "slave_scheduler.h"
#include "slave_drivers/slave_driver_uhk_module.h"
#include "wormhole.h"
#include "peripherals/adc.h"
void setError(uint8_t error);
void setGenericError();
@@ -25,6 +26,7 @@ void readMergeSensor();
void uploadConfig();
void applyConfig();
void setLedPwm();
void getAdcValue(void);
// Functions for setting error statuses
@@ -80,6 +82,9 @@ void usbProtocolHandler()
case USB_COMMAND_SET_LED_PWM:
setLedPwm();
break;
case USB_COMMAND_GET_ADC_VALUE:
setLedPwm();
break;
default:
break;
}
@@ -198,3 +203,8 @@ void setLedPwm()
UhkModuleStates[0].ledPwmBrightness = brightnessPercent;
#endif
}
void getAdcValue(void)
{
*((uint32_t*)GenericHidOutBuffer) = ADC_Measure();
}