diff --git a/right/src/usb_protocol_handler.c b/right/src/usb_protocol_handler.c index dae4ae7..47c0aca 100644 --- a/right/src/usb_protocol_handler.c +++ b/right/src/usb_protocol_handler.c @@ -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(); +} diff --git a/right/src/usb_protocol_handler.h b/right/src/usb_protocol_handler.h index 83b432d..364611b 100644 --- a/right/src/usb_protocol_handler.h +++ b/right/src/usb_protocol_handler.h @@ -28,6 +28,7 @@ #define UPLOAD_CONFIG_INVALID_PAYLOAD_SIZE 1 #define USB_COMMAND_APPLY_CONFIG 9 #define USB_COMMAND_SET_LED_PWM 10 + #define USB_COMMAND_GET_ADC_VALUE 11 // Functions: