ESP32-PaxCounter/include/power.h
2019-09-09 21:45:19 +02:00

24 lines
535 B
C

#ifndef _POWER_H
#define _POWER_H
#include <Arduino.h>
#include <driver/adc.h>
#include <esp_adc_cal.h>
#include "i2cscan.h"
#define DEFAULT_VREF 1100 // tbd: use adc2_vref_to_gpio() for better estimate
#define NO_OF_SAMPLES 64 // we do some multisampling to get better values
#ifdef HAS_PMU
#include <axp20x.h>
extern AXP20X_Class pmu; // Make axp instance globally availabe
void pover_event_IRQ(void);
#endif
void AXP192_init(void);
uint16_t read_voltage(void);
void calibrate_voltage(void);
uint8_t getBattLevel(void);
#endif