maix::ext_dev::pmu

maix.ext_dev.pmu module

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

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
}

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,
}

Variable

Function

Class

PMU

PMU driver class

C++ defination code:

class PMU

__init__

Construct a new PMU object, will open PMU.

item description
type func
param driver: driver name, only support "axp2101".
i2c_bus: i2c bus number. Automatically selects the on-board pmu when -1 is passed in.
addr: PMU i2c addr.
static False

C++ defination code:

PMU(std::string driver = "axp2101", int i2c_bus = -1, int addr = 0x34)

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::pmu::ChargerStatus get_charger_status()

get_vat_vol

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.
return err::Err type, if set success, return err::ERR_NONE.
static False

C++ defination code:

err::Err set_bat_charging_cur(int current)

get_bat_charging_cur

Get the battery charging current.

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

C++ defination code:

int get_bat_charging_cur()

set_vol

Set the PMU channel voltage.\nYou can retrieve the available channel from ext_dev.pmu.PowerChannel.

item description
type func
param voltage: The voltage to be set.
return int, return the channel voltage.
static False

C++ defination code:

err::Err set_vol(ext_dev::pmu::PowerChannel channel, int voltage)

get_vol

Get the PMU channel voltage.\nYou can retrieve the available channel from ext_dev.pmu.PowerChannel.

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

C++ defination code:

int get_vol(ext_dev::pmu::PowerChannel channel)