#include "driver/gpio.h"
#include "esp_err.h"
#include "general/adc.h"
Go to the source code of this file.
◆ BATTERY_DURACELL_AA
| #define BATTERY_DURACELL_AA 1 |
◆ BATTERY_SERIES_COUNT
| #define BATTERY_SERIES_COUNT 3 |
◆ VOLTAGE_MULTIPLIER
| #define VOLTAGE_MULTIPLIER 2.0f |
◆ battery_sensor_init()
Initialize the battery voltage sensor.
Sets up ADC channel and calibration. Call once before battery_sensor_read().
- Parameters
-
- Returns
- ESP_OK on success, error code otherwise
◆ battery_sensor_read()
Read battery voltage and percentage.
Updates sensor->voltage_v and sensor->percentage.
- Parameters
-
- Returns
- ESP_OK on success, error code otherwise