Add USB command to retrieve ADC value.
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include "slave_scheduler.h"
|
#include "slave_scheduler.h"
|
||||||
#include "slave_drivers/slave_driver_uhk_module.h"
|
#include "slave_drivers/slave_driver_uhk_module.h"
|
||||||
#include "wormhole.h"
|
#include "wormhole.h"
|
||||||
|
#include "peripherals/adc.h"
|
||||||
|
|
||||||
void setError(uint8_t error);
|
void setError(uint8_t error);
|
||||||
void setGenericError();
|
void setGenericError();
|
||||||
@@ -25,6 +26,7 @@ void readMergeSensor();
|
|||||||
void uploadConfig();
|
void uploadConfig();
|
||||||
void applyConfig();
|
void applyConfig();
|
||||||
void setLedPwm();
|
void setLedPwm();
|
||||||
|
void getAdcValue(void);
|
||||||
|
|
||||||
// Functions for setting error statuses
|
// Functions for setting error statuses
|
||||||
|
|
||||||
@@ -80,6 +82,9 @@ void usbProtocolHandler()
|
|||||||
case USB_COMMAND_SET_LED_PWM:
|
case USB_COMMAND_SET_LED_PWM:
|
||||||
setLedPwm();
|
setLedPwm();
|
||||||
break;
|
break;
|
||||||
|
case USB_COMMAND_GET_ADC_VALUE:
|
||||||
|
setLedPwm();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -198,3 +203,8 @@ void setLedPwm()
|
|||||||
UhkModuleStates[0].ledPwmBrightness = brightnessPercent;
|
UhkModuleStates[0].ledPwmBrightness = brightnessPercent;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getAdcValue(void)
|
||||||
|
{
|
||||||
|
*((uint32_t*)GenericHidOutBuffer) = ADC_Measure();
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#define UPLOAD_CONFIG_INVALID_PAYLOAD_SIZE 1
|
#define UPLOAD_CONFIG_INVALID_PAYLOAD_SIZE 1
|
||||||
#define USB_COMMAND_APPLY_CONFIG 9
|
#define USB_COMMAND_APPLY_CONFIG 9
|
||||||
#define USB_COMMAND_SET_LED_PWM 10
|
#define USB_COMMAND_SET_LED_PWM 10
|
||||||
|
#define USB_COMMAND_GET_ADC_VALUE 11
|
||||||
|
|
||||||
// Functions:
|
// Functions:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user