mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-22 08:04:07 +08:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user