maix::ext_dev::axp2101

maix.ext_dev.axp2101 module

This is maix::ext_dev::axp2101 module of MaixCDK.
All of these elements are in namespace maix::ext_dev::axp2101.

For MaixCDK developer: DO NOT edit this doc file manually, this doc is auto generated!

Module

No module

Enum

ChargerStatus

charger status

item describe
values CHG_TRI_STATE: tri_charge
CHG_PRE_STATE: pre_charge
CHG_CC_STATE: constant charge
CHG_CV_STATE: constant voltage
CHG_DONE_STATE: charge done
CHG_STOP_STATE: not charge

C++ defination code:

enum class ChargerStatus {
        CHG_TRI_STATE,   //tri_charge
        CHG_PRE_STATE,   //pre_charge
        CHG_CC_STATE,    //constant charge
        CHG_CV_STATE,    //constant voltage
        CHG_DONE_STATE,  //charge done
        CHG_STOP_STATE,  //not charge
    }

ChargerCurrent

charger current

item describe
values CHG_CUR_0MA:
CHG_CUR_100MA:
CHG_CUR_125MA:
CHG_CUR_150MA:
CHG_CUR_175MA:
CHG_CUR_200MA:
CHG_CUR_300MA:
CHG_CUR_400MA:
CHG_CUR_500MA:
CHG_CUR_600MA:
CHG_CUR_700MA:
CHG_CUR_800MA:
CHG_CUR_900MA:
CHG_CUR_1000MA:

C++ defination code:

enum class ChargerCurrent {
        CHG_CUR_0MA,
        CHG_CUR_100MA = 4,
        CHG_CUR_125MA,
        CHG_CUR_150MA,
        CHG_CUR_175MA,
        CHG_CUR_200MA,
        CHG_CUR_300MA,
        CHG_CUR_400MA,
        CHG_CUR_500MA,
        CHG_CUR_600MA,
        CHG_CUR_700MA,
        CHG_CUR_800MA,
        CHG_CUR_900MA,
        CHG_CUR_1000MA,
    }

PowerChannel

power channel

item describe
values DCDC1:
DCDC2:
DCDC3:
DCDC4:
DCDC5:
ALDO1:
ALDO2:
ALDO3:
ALDO4:
BLDO1:
BLDO2:
DLDO1:
DLDO2:
VBACKUP:
CPULDO:

C++ defination code:

enum class PowerChannel {
        DCDC1,
        DCDC2,
        DCDC3,
        DCDC4,
        DCDC5,
        ALDO1,
        ALDO2,
        ALDO3,
        ALDO4,
        BLDO1,
        BLDO2,
        DLDO1,
        DLDO2,
        VBACKUP,
        CPULDO,
    }

PowerOffTime

power off time

item describe
values POWEROFF_4S:
POWEROFF_6S:
POWEROFF_8S:
POWEROFF_10S:
POWEROFF_DISABLE:

C++ defination code:

enum class PowerOffTime {
        POWEROFF_4S,
        POWEROFF_6S,
        POWEROFF_8S,
        POWEROFF_10S,
        POWEROFF_DISABLE = 65535,
    }

PowerOnTime

power on time

item describe
values POWERON_128MS:
POWERON_512MS:
POWERON_1S:
POWERON_2S:

C++ defination code:

enum class PowerOnTime {
        POWERON_128MS,
        POWERON_512MS,
        POWERON_1S,
        POWERON_2S,
    }

Variable

Function

Class

AXP2101

Peripheral AXP2101 class

C++ defination code:

class AXP2101

__init__

AXP2101 constructor.

item description
type func
param i2c_bus: i2c bus number.
addr: pmu device addr.
static False

C++ defination code:

AXP2101(int i2c_bus = -1, uint8_t addr = 0x34)

init

Initialise the AXP2101.

item description
type func
return err::Err type, if init success, return err::ERR_NONE.
static False

C++ defination code:

err::Err init()

poweroff

Poweroff immediately.

item description
type func
return err::Err type, if init success, return err::ERR_NONE.
static False

C++ defination code:

err::Err poweroff()

is_bat_connect

Is the battery connected.

item description
type func
return bool type, if battery is connected, return true.
static False

C++ defination code:

bool is_bat_connect()

is_vbus_in

Is the power adapter connected.

item description
type func
return bool type, if power adapter is connected, return true.
static False

C++ defination code:

bool is_vbus_in()

is_charging

Is bat charging.

item description
type func
return bool type, if bat is charging, return true.
static False

C++ defination code:

bool is_charging()

get_bat_percent

Get the battery percentage.

item description
type func
return int type, return battery percentage.
static False

C++ defination code:

int get_bat_percent()

get_charger_status

Get the battery charging status.

item description
type func
return int type, return battery charging status.
static False

C++ defination code:

ext_dev::axp2101::ChargerStatus get_charger_status()

get_charger_status (overload 1)

Get the battery voltage.

item description
type func
return uint16_t type, return battery voltage.
static False

C++ defination code:

uint16_t get_bat_vol()

clean_irq

Clear interrupt flag.

item description
type func
return err::Err type, if clean success, return err::ERR_NONE.
static False

C++ defination code:

err::Err clean_irq()

set_bat_charging_cur

Set the battery charging current.

item description
type func
param current: The current to be set.
The available values are 0mA, 100mA, 125mA, 150mA, 175mA,
200mA, 300mA, 400mA, 500mA, 600mA, 700mA, 800mA, 900mA, and 1000mA.
return err::Err type, if set success, return err::ERR_NONE.
static False

C++ defination code:

err::Err set_bat_charging_cur(ext_dev::axp2101::ChargerCurrent current)

get_bat_charging_cur

Get the battery charging current.

item description
type func
return ChargerCurrent, return the currently set charging current.
static False

C++ defination code:

ext_dev::axp2101::ChargerCurrent get_bat_charging_cur()

dcdc1

Set and get the PMU DCDC1 voltage.

item description
type func
param voltage: The voltage to be set,
voltage range is 1500mV~3400mV(step 20mV).
return int, return the PMU DCDC1 voltage.
static False

C++ defination code:

int dcdc1(int voltage = -1)

dcdc2

Set and get the PMU DCDC2 voltage.

item description
type func
param voltage: The voltage to be set,
voltage range is 500mV~1200mV(step 10mV) and 1220mV~1540mV(step 20mV).
return int, return the PMU DCDC2 voltage.
static False

C++ defination code:

int dcdc2(int voltage = -1)

dcdc3

Set and get the PMU DCDC3 voltage.

item description
type func
param voltage: The voltage to be set,
voltage range is 500mV~1200mV(step 10mV) and 1220mV~1540mV(step 20mV).
return int, return the PMU DCDC3 voltage.
static False

C++ defination code:

int dcdc3(int voltage = -1)

dcdc4

Set and get the PMU DCDC4 voltage.

item description
type func
param voltage: The voltage to be set,
voltage range is 500mV~1200mV(step 10mV) and 1220mV~1840mV(step 20mV).
return int, return the PMU DCDC4 voltage.
static False

C++ defination code:

int dcdc4(int voltage = -1)

dcdc5

Set and get the PMU DCDC5 voltage.

item description
type func
param voltage: The voltage to be set,
voltage range is 1400mV~3700mV(step 100mV).
return int, return the PMU DCDC5 voltage.
static False

C++ defination code:

int dcdc5(int voltage = -1)

aldo1

Set and get the PMU ALDO1 voltage.

item description
type func
param voltage: The voltage to be set,
voltage range is 500mV~3500mV(step 100mV).
return int, return the PMU ALDO1 voltage.
static False

C++ defination code:

int aldo1(int voltage = -1)

aldo2

Set and get the PMU ALDO2 voltage.

item description
type func
param voltage: The voltage to be set,
voltage range is 500mV~3500mV(step 100mV).
return int, return the PMU ALDO2 voltage.
static False

C++ defination code:

int aldo2(int voltage = -1)

aldo3

Set and get the PMU ALDO3 voltage.

item description
type func
param voltage: The voltage to be set,
voltage range is 500mV~3500mV(step 100mV).
return int, return the PMU ALDO3 voltage.
static False

C++ defination code:

int aldo3(int voltage = -1)

aldo4

Set and get the PMU ALDO4 voltage.

item description
type func
param voltage: The voltage to be set,
voltage range is 500mV~3500mV(step 100mV).
return int, return the PMU ALDO4 voltage.
static False

C++ defination code:

int aldo4(int voltage = -1)

bldo1

Set and get the PMU BLDO1 voltage.

item description
type func
param voltage: The voltage to be set,
voltage range is 500mV~3500mV(step 100mV).
return int, return the PMU BLDO1 voltage.
static False

C++ defination code:

int bldo1(int voltage = -1)

bldo2

Set and get the PMU BLDO2 voltage.

item description
type func
param voltage: The voltage to be set,
voltage range is 500mV~3500mV(step 100mV).
return int, return the PMU BLDO2 voltage.
static False

C++ defination code:

int bldo2(int voltage = -1)

set_poweroff_time

Set power-off time, The device will shut down\nif the power button is held down longer than this time.

item description
type func
param tm: The time to be set, you can set it to 4s, 6s, 8s, or 10s.
return err::Err type, if set success, return err::ERR_NONE.
static False

C++ defination code:

err::Err set_poweroff_time(ext_dev::axp2101::PowerOffTime tm)

get_poweroff_time

Get power-off time.

item description
type func
return PowerOffTime, return power-off time.
static False

C++ defination code:

ext_dev::axp2101::PowerOffTime get_poweroff_time()

set_poweron_time

Set power-on time, The device will power on\nif the power button is held down longer than this time.

item description
type func
param tm: The time to be set, you can set it to 128ms, 512ms, 1s, or 2s.
return err::Err type, if set success, return err::ERR_NONE.
static False

C++ defination code:

err::Err set_poweron_time(ext_dev::axp2101::PowerOnTime tm)

get_poweron_time

Get power-on time.

item description
type func
return PowerOnTime, return power-on time.
static False

C++ defination code:

ext_dev::axp2101::PowerOnTime get_poweron_time()