#ifndef VBAT_H #define VBAT_H #include #include #define VBAT_INVALID_VALUE ((uint32_t)(-1)) typedef struct { bool (*Init)(); void (*SetMeasureInterval)(uint32_t ms); bool (*ServeMonitor)(); uint32_t (*GetVoltage)(); void (*DeInit)(); } sVBat_Handle_t; extern const sVBat_Handle_t VBatHandle; #define VBAT_MONITOR_INTERVAL 10000 // [ms] #define VBAT_MONITOR_MEAS_TIMEOUT 5 // [ms], ADC is running is High-priority fast mode, 5ms is enough #define VBAT_INIT_FOR_MEASURE 1 // 0/1, initialize VBAT sensing circuit for single measure #define VBAT_AVERAGING_POINTS 3 // Number measurements for averaging the result, set to zero to disable #define VBAT_AVERAGING_INTERVAL 100 // interval in [ms] between measurements while averaging #define VBAT_VOLTAGE_MULTIPLIER 2 #define VBAT_VOLTAGE_DIVIDER 1 #endif