![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
ADC1 binding of the BattTask: VBAT and current pins, VREFINT. More...
Go to the source code of this file.
Functions | |
| int | batt_adc_init (void) |
| 0 = ok | |
| int | batt_adc_read (float *vbat_pin, float *cur_pin) |
| 0 = a new sample: pin voltages in volts | |
ADC1 binding of the BattTask: VBAT and current pins, VREFINT.
Injected group of three conversions (VBAT, CUR, VREFINT), 16× hardware oversampling, 247.5-cycle sampling (the 100k/10k divider is a 9 kΩ source), started by software. batt_adc_read() returns the previous conversion and starts the next one, so the BattTask never waits for the ADC. Pin voltages are scaled with VREFINT and its factory calibration, so the result does not depend on the exact 3.1 V supply.
Register level (LL), no CubeMX ADC configuration needed. Channels and pins come from app_config.h (APP_BATT_*).
Definition in file batt_adc.h.
| int batt_adc_init | ( | void | ) |
0 = ok
Definition at line 30 of file batt_adc.c.
References analog_pin(), APP_BATT_CUR_CH, APP_BATT_CUR_PIN, APP_BATT_CUR_PORT, APP_BATT_VBAT_CH, APP_BATT_VBAT_PIN, APP_BATT_VBAT_PORT, delay_us(), and s_started.
Referenced by app_start().
| int batt_adc_read | ( | float * | vbat_pin, |
| float * | cur_pin | ||
| ) |
0 = a new sample: pin voltages in volts
Definition at line 79 of file batt_adc.c.
References s_started.
Referenced by app_start().