2018-07-17 15:15:58 +02:00
|
|
|
#ifndef _BATTERY_H
|
|
|
|
#define _BATTERY_H
|
2018-07-15 14:28:05 +02:00
|
|
|
|
|
|
|
#include <driver/adc.h>
|
|
|
|
#include <esp_adc_cal.h>
|
|
|
|
|
|
|
|
#define DEFAULT_VREF 1100 // tbd: use adc2_vref_to_gpio() for better estimate
|
2018-07-22 11:08:55 +02:00
|
|
|
#define NO_OF_SAMPLES 64 // we do some multisampling to get better values
|
2018-07-15 14:28:05 +02:00
|
|
|
|
|
|
|
uint16_t read_voltage(void);
|
2018-07-22 11:08:55 +02:00
|
|
|
void calibrate_voltage(void);
|
2018-09-27 21:13:18 +02:00
|
|
|
bool batt_sufficient(void);
|
2018-07-15 14:28:05 +02:00
|
|
|
|
|
|
|
#endif
|