M5Unified
IP5306_Class.hpp
Go to the documentation of this file.
1 // Copyright (c) M5Stack. All rights reserved.
2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 
4 #ifndef __M5_IP5306_CLASS_H__
5 #define __M5_IP5306_CLASS_H__
6 
7 #include "I2C_Class.hpp"
8 
9 namespace m5
10 {
11  class IP5306_Class : public I2C_Device
12  {
13  public:
14 
15  static constexpr std::uint8_t DEFAULT_ADDRESS = 0x75;
16 
17  IP5306_Class(std::uint8_t i2c_addr = DEFAULT_ADDRESS, std::uint32_t freq = 400000, I2C_Class* i2c = &In_I2C)
18  : I2C_Device ( i2c_addr, freq, i2c )
19  {}
20 
21  bool begin(void);
22 
25  std::int8_t getBatteryLevel(void);
26 
29  void setBatteryCharge(bool enable);
30 
33  void setChargeCurrent(std::uint16_t max_mA);
34 
37  void setChargeVoltage(std::uint16_t max_mV);
38 
40  bool isCharging(void);
41 
43  bool setPowerBoostKeepOn(bool en);
44 
45  private:
46  };
47 }
48 
49 #endif
std::int8_t getBatteryLevel(void)
static constexpr std::uint8_t DEFAULT_ADDRESS
void setChargeVoltage(std::uint16_t max_mV)
void setBatteryCharge(bool enable)
void setChargeCurrent(std::uint16_t max_mA)
IP5306_Class(std::uint8_t i2c_addr=DEFAULT_ADDRESS, std::uint32_t freq=400000, I2C_Class *i2c=&In_I2C)
bool isCharging(void)
Get whether the battery is currently charging or not.
bool setPowerBoostKeepOn(bool en)
Set whether or not to continue supplying power even at low loads.
bool begin(void)
Definition: M5Unified.cpp:48
I2C_Class In_I2C
for internal I2C device
Definition: I2C_Class.cpp:10