maix.ext_dev.pmu

maix.ext_dev.pmu module

You can use maix.ext_dev.pmu to access this module with MaixPy
This module is generated from MaixPy and MaixCDK

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__

def __init__(self, driver: str = 'axp2101', i2c_bus: int = -1, addr: int = 52) -> None

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

def poweroff(self) -> maix.err.Err

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

def is_bat_connect(self) -> bool

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

def is_vbus_in(self) -> bool

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

def is_charging(self) -> bool

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

def get_bat_percent(self) -> int

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

def get_charger_status(self) -> ChargerStatus

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

def get_vat_vol(self) -> int

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

def clean_irq(self) -> maix.err.Err

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

def set_bat_charging_cur(self, current: int) -> maix.err.Err

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

def get_bat_charging_cur(self) -> int

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

def set_vol(self, channel: PowerChannel, voltage: int) -> maix.err.Err

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

def get_vol(self, channel: PowerChannel) -> int

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)