M5Unified
m5::AXP2101_Class Class Reference

#include <AXP2101_Class.hpp>

Inheritance diagram for m5::AXP2101_Class:
Collaboration diagram for m5::AXP2101_Class:

Public Member Functions

 AXP2101_Class (std::uint8_t i2c_addr=DEFAULT_ADDRESS, std::uint32_t freq=400000, I2C_Class *i2c=&In_I2C)
 
bool begin (void)
 
std::int8_t getBatteryLevel (void)
 
void setBatteryCharge (bool enable)
 
void setChargeCurrent (std::uint16_t max_mA)
 
void setChargeVoltage (std::uint16_t max_mV)
 
int getChargeStatus (void)
 
bool isCharging (void)
 Get whether the battery is currently charging or not. More...
 
void setALDO1 (int voltage)
 
void setALDO2 (int voltage)
 
void setALDO3 (int voltage)
 
void setALDO4 (int voltage)
 
void setBLDO1 (int voltage)
 
void setBLDO2 (int voltage)
 
void setDLDO1 (int voltage)
 
void setDLDO2 (int voltage)
 
bool getALDO1Enabled (void)
 
bool getALDO2Enabled (void)
 
bool getALDO3Enabled (void)
 
bool getALDO4Enabled (void)
 
bool getBLDO1Enabled (void)
 
bool getBLDO2Enabled (void)
 
void powerOff (void)
 
void setAdcState (bool enable)
 
void setAdcRate (std::uint8_t rate)
 
void setBACKUP (bool enable)
 
bool isACIN (void)
 
bool isVBUS (void)
 
bool getBatState (void)
 
float getBatteryVoltage (void)
 
float getBatteryDischargeCurrent (void)
 
float getBatteryChargeCurrent (void)
 
float getBatteryPower (void)
 
float getACINVoltage (void)
 
float getACINCurrent (void)
 
float getVBUSVoltage (void)
 
float getVBUSCurrent (void)
 
float getAPSVoltage (void)
 
float getInternalTemperature (void)
 
std::uint8_t getPekPress (void)
 
void setReg0x20Bit0 (bool)
 
- Public Member Functions inherited from m5::I2C_Device
 I2C_Device (std::uint8_t i2c_addr, std::uint32_t freq, I2C_Class *i2c=&In_I2C)
 
void setPort (I2C_Class *i2c)
 
bool writeRegister8 (std::uint8_t reg, std::uint8_t data) const
 
std::uint8_t readRegister8 (std::uint8_t reg) const
 
bool writeRegister8Array (const std::uint8_t *reg_data_array, std::size_t length) const
 
bool writeRegister (std::uint8_t reg, const std::uint8_t *data, std::size_t length) const
 
bool readRegister (std::uint8_t reg, std::uint8_t *result, std::size_t length) const
 
bool bitOn (std::uint8_t reg, std::uint8_t bit) const
 
bool bitOff (std::uint8_t reg, std::uint8_t bit) const
 
bool isEnabled (void) const
 

Static Public Attributes

static constexpr uint8_t AXP2101_EFUS_OP_CFG = 0xF0
 
static constexpr uint8_t AXP2101_EFREQ_CTRL = 0xF1
 
static constexpr uint8_t AXP2101_TWI_ADDR_EXT = 0xFF
 
static constexpr std::uint8_t DEFAULT_ADDRESS = 0x34
 

Additional Inherited Members

- Protected Attributes inherited from m5::I2C_Device
I2C_Class_i2c
 
std::uint32_t _freq
 
std::uint8_t _addr
 
bool _init
 

Detailed Description

Definition at line 11 of file AXP2101_Class.hpp.

Constructor & Destructor Documentation

◆ AXP2101_Class()

m5::AXP2101_Class::AXP2101_Class ( std::uint8_t  i2c_addr = DEFAULT_ADDRESS,
std::uint32_t  freq = 400000,
I2C_Class i2c = &In_I2C 
)
inline

Definition at line 20 of file AXP2101_Class.hpp.

Member Function Documentation

◆ begin()

bool m5::AXP2101_Class::begin ( void  )

Definition at line 25 of file AXP2101_Class.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getACINCurrent()

float m5::AXP2101_Class::getACINCurrent ( void  )

Definition at line 227 of file AXP2101_Class.cpp.

◆ getACINVoltage()

float m5::AXP2101_Class::getACINVoltage ( void  )

Definition at line 222 of file AXP2101_Class.cpp.

◆ getALDO1Enabled()

bool m5::AXP2101_Class::getALDO1Enabled ( void  )
inline

Definition at line 58 of file AXP2101_Class.hpp.

◆ getALDO2Enabled()

bool m5::AXP2101_Class::getALDO2Enabled ( void  )
inline

Definition at line 59 of file AXP2101_Class.hpp.

◆ getALDO3Enabled()

bool m5::AXP2101_Class::getALDO3Enabled ( void  )
inline

Definition at line 60 of file AXP2101_Class.hpp.

◆ getALDO4Enabled()

bool m5::AXP2101_Class::getALDO4Enabled ( void  )
inline

Definition at line 61 of file AXP2101_Class.hpp.

◆ getAPSVoltage()

float m5::AXP2101_Class::getAPSVoltage ( void  )

Definition at line 267 of file AXP2101_Class.cpp.

◆ getBatState()

bool m5::AXP2101_Class::getBatState ( void  )

Definition at line 210 of file AXP2101_Class.cpp.

Here is the call graph for this function:

◆ getBatteryChargeCurrent()

float m5::AXP2101_Class::getBatteryChargeCurrent ( void  )

Definition at line 257 of file AXP2101_Class.cpp.

◆ getBatteryDischargeCurrent()

float m5::AXP2101_Class::getBatteryDischargeCurrent ( void  )

Definition at line 262 of file AXP2101_Class.cpp.

◆ getBatteryLevel()

std::int8_t m5::AXP2101_Class::getBatteryLevel ( void  )

Get the remaining battery power.

Returns
0-100 level

Definition at line 153 of file AXP2101_Class.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBatteryPower()

float m5::AXP2101_Class::getBatteryPower ( void  )

Definition at line 247 of file AXP2101_Class.cpp.

◆ getBatteryVoltage()

float m5::AXP2101_Class::getBatteryVoltage ( void  )

Definition at line 252 of file AXP2101_Class.cpp.

Here is the caller graph for this function:

◆ getBLDO1Enabled()

bool m5::AXP2101_Class::getBLDO1Enabled ( void  )
inline

Definition at line 62 of file AXP2101_Class.hpp.

◆ getBLDO2Enabled()

bool m5::AXP2101_Class::getBLDO2Enabled ( void  )
inline

Definition at line 63 of file AXP2101_Class.hpp.

Here is the caller graph for this function:

◆ getChargeStatus()

int m5::AXP2101_Class::getChargeStatus ( void  )
Returns
-1:discharge / 0:standby / 1:charge

Definition at line 160 of file AXP2101_Class.cpp.

Here is the call graph for this function:

◆ getInternalTemperature()

float m5::AXP2101_Class::getInternalTemperature ( void  )

Definition at line 242 of file AXP2101_Class.cpp.

◆ getPekPress()

std::uint8_t m5::AXP2101_Class::getPekPress ( void  )
Returns
0:none / 1:Long press / 2:Short press / 3:both

Definition at line 215 of file AXP2101_Class.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVBUSCurrent()

float m5::AXP2101_Class::getVBUSCurrent ( void  )

Definition at line 237 of file AXP2101_Class.cpp.

◆ getVBUSVoltage()

float m5::AXP2101_Class::getVBUSVoltage ( void  )

Definition at line 232 of file AXP2101_Class.cpp.

◆ isACIN()

bool m5::AXP2101_Class::isACIN ( void  )

Definition at line 201 of file AXP2101_Class.cpp.

◆ isCharging()

bool m5::AXP2101_Class::isCharging ( void  )

Get whether the battery is currently charging or not.

Definition at line 167 of file AXP2101_Class.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isVBUS()

bool m5::AXP2101_Class::isVBUS ( void  )

Definition at line 205 of file AXP2101_Class.cpp.

Here is the call graph for this function:

◆ powerOff()

void m5::AXP2101_Class::powerOff ( void  )

Definition at line 172 of file AXP2101_Class.cpp.

Here is the call graph for this function:

◆ setAdcRate()

void m5::AXP2101_Class::setAdcRate ( std::uint8_t  rate)

Definition at line 181 of file AXP2101_Class.cpp.

◆ setAdcState()

void m5::AXP2101_Class::setAdcState ( bool  enable)

Definition at line 177 of file AXP2101_Class.cpp.

◆ setALDO1()

void m5::AXP2101_Class::setALDO1 ( int  voltage)
inline

Definition at line 49 of file AXP2101_Class.hpp.

◆ setALDO2()

void m5::AXP2101_Class::setALDO2 ( int  voltage)
inline

Definition at line 50 of file AXP2101_Class.hpp.

◆ setALDO3()

void m5::AXP2101_Class::setALDO3 ( int  voltage)
inline

Definition at line 51 of file AXP2101_Class.hpp.

◆ setALDO4()

void m5::AXP2101_Class::setALDO4 ( int  voltage)
inline

Definition at line 52 of file AXP2101_Class.hpp.

◆ setBACKUP()

void m5::AXP2101_Class::setBACKUP ( bool  enable)

Definition at line 185 of file AXP2101_Class.cpp.

◆ setBatteryCharge()

void m5::AXP2101_Class::setBatteryCharge ( bool  enable)

set battery charge enable.

Parameters
enabletrue=enable / false=disable

Definition at line 113 of file AXP2101_Class.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBLDO1()

void m5::AXP2101_Class::setBLDO1 ( int  voltage)
inline

Definition at line 53 of file AXP2101_Class.hpp.

◆ setBLDO2()

void m5::AXP2101_Class::setBLDO2 ( int  voltage)
inline

Definition at line 54 of file AXP2101_Class.hpp.

Here is the caller graph for this function:

◆ setChargeCurrent()

void m5::AXP2101_Class::setChargeCurrent ( std::uint16_t  max_mA)

set battery charge current

Parameters
max_mAmilli ampere. (100 - 1320).

Definition at line 122 of file AXP2101_Class.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setChargeVoltage()

void m5::AXP2101_Class::setChargeVoltage ( std::uint16_t  max_mV)

set battery charge voltage

Parameters
max_mVmilli volt. (4100 - 4360).

4100mV

4200mV

4350mV

4400mV

4600mV

Definition at line 134 of file AXP2101_Class.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDLDO1()

void m5::AXP2101_Class::setDLDO1 ( int  voltage)
inline

Definition at line 55 of file AXP2101_Class.hpp.

Here is the caller graph for this function:

◆ setDLDO2()

void m5::AXP2101_Class::setDLDO2 ( int  voltage)
inline

Definition at line 56 of file AXP2101_Class.hpp.

◆ setReg0x20Bit0()

void m5::AXP2101_Class::setReg0x20Bit0 ( bool  flg)

Definition at line 92 of file AXP2101_Class.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ AXP2101_EFREQ_CTRL

constexpr uint8_t m5::AXP2101_Class::AXP2101_EFREQ_CTRL = 0xF1
staticconstexpr

Definition at line 15 of file AXP2101_Class.hpp.

◆ AXP2101_EFUS_OP_CFG

constexpr uint8_t m5::AXP2101_Class::AXP2101_EFUS_OP_CFG = 0xF0
staticconstexpr

Definition at line 14 of file AXP2101_Class.hpp.

◆ AXP2101_TWI_ADDR_EXT

constexpr uint8_t m5::AXP2101_Class::AXP2101_TWI_ADDR_EXT = 0xFF
staticconstexpr

Definition at line 16 of file AXP2101_Class.hpp.

◆ DEFAULT_ADDRESS

constexpr std::uint8_t m5::AXP2101_Class::DEFAULT_ADDRESS = 0x34
staticconstexpr

Definition at line 18 of file AXP2101_Class.hpp.


The documentation for this class was generated from the following files: