mirror of
https://github.com/m5stack/M5Stack.git
synced 2026-05-20 10:06:46 -07:00
34 lines
1007 B
C++
34 lines
1007 B
C++
/******************************************************************************
|
|
* M5Snake : Power management *
|
|
* -------------------------- *
|
|
* Management of the charge of the battery to avoid over charging *
|
|
* Author: Olivier Staquet *
|
|
* Last version available on https://github.com/ostaquet/M5Snake *
|
|
*****************************************************************************/
|
|
#ifndef _POWER_H_
|
|
#define _POWER_H_
|
|
|
|
#include <Arduino.h>
|
|
#include <M5Stack.h>
|
|
|
|
class PowerClass {
|
|
public:
|
|
// Initialize
|
|
void begin();
|
|
|
|
// Adjust charge mode
|
|
void adaptChargeMode();
|
|
|
|
// Return battery level (0-100%)
|
|
// (-1 if cannot communicate with the controller)
|
|
int8_t getBatteryLevel();
|
|
|
|
private:
|
|
// Power control available
|
|
bool canControl = false;
|
|
};
|
|
|
|
extern PowerClass Power;
|
|
|
|
#endif // _POWER_H_
|