Add general purpose ADC API

ADC1 is configured to sample channels 0 to 15 continuously
at about 30kHz. Users can now set their GPIO of choice to
analog mode (as long as it's wired to one of the analog
channels) and then read the voltage at any time.

The values can be read like this:

GPIO_set_to_analog(GPIO_3_GPIO_Port, GPIO_3_Pin);
my_voltage = get_adc_voltage(GPIO_3_GPIO_Port, GPIO_3_Pin);
This commit is contained in:
Samuel Sadok
2018-04-27 17:46:56 -07:00
parent 59187ef1f2
commit b064800116
8 changed files with 131 additions and 1 deletions
+3
View File
@@ -81,6 +81,9 @@ int odrive_main(void) {
*encoder, *sensorless_estimator, *controller, *motor);
}
// Start ADC for temperature measurements and user measurements
start_general_purpose_adc();
// TODO: make dynamically reconfigurable
#if HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR >= 3
if (board_config.enable_uart) {