battery
- group battery
ADC driver for sensing battery voltage.
battery_start_sample() must be called periodically within the main application every 5 samples will be averaged, and the battery voltage and SoC updated.
Functions
-
void battery_init(void)
Initialize the ADC.
This includes setting up buffering.
-
void battery_start_sample(void)
-
float battery_get_voltage(void)
Get current, precomputed voltage of the battery.
- Returns
Voltage value updated by the ADC.
-
uint8_t battery_get_percent(void)
Get current, precomputed state-of-charge of the battery.
- Returns
Remaining percentage of the battery.
-
void battery_init(void)