Table of Contents

Class Axp192

Namespace
Iot.Device.Axp192
Assembly
Iot.Device.Axp192.dll

Class for handling Axp192 device.

public class Axp192
Inheritance
Axp192

Constructors

Axp192(I2cDevice)

Initializes a new instance of the Axp192 class.

public Axp192(I2cDevice i2c)

Parameters

i2c I2cDevice

I2C device.

Exceptions

ArgumentNullException

When i2c device is null.

Fields

I2cDefaultAddress

Default address of I2C Axp192 device.

public const int I2cDefaultAddress = 52

Field Value

int

Properties

AdcFrequency

Gets or sets the ADC frequency.

public AdcFrequency AdcFrequency { get; set; }

Property Value

AdcFrequency

AdcPinCurrent

Gets or sets the ADC Pin output Current.

public AdcPinCurrent AdcPinCurrent { get; set; }

Property Value

AdcPinCurrent

AdcPinCurrentSetting

Gets or sets ADC pin current settings.

public AdcPinCurrentSetting AdcPinCurrentSetting { get; set; }

Property Value

AdcPinCurrentSetting

AdcPinEnabled

Gets or sets the ADC pin enabled.

public AdcPinEnabled AdcPinEnabled { get; set; }

Property Value

AdcPinEnabled

BatteryTemperatureMonitoring

Gets or sets a value indicating whether ADC battery temperature monitoring function is enabled.

public bool BatteryTemperatureMonitoring { get; set; }

Property Value

bool

ChargingCurrent

Gets or sets the charging current.

public ChargingCurrent ChargingCurrent { get; set; }

Property Value

ChargingCurrent

Remarks

Not recommend to set charge current > 100mA, since Battery is only 80mAh. more then 1C charge-rate may shorten battery life-span.

ChargingStopThreshold

Gets or sets charging threshold when battery should stop charging.

public ChargingStopThreshold ChargingStopThreshold { get; set; }

Property Value

ChargingStopThreshold

ChargingVoltage

Gets or sets the charging voltage.

public ChargingVoltage ChargingVoltage { get; set; }

Property Value

ChargingVoltage

DcDc1Voltage

Gets or sets DC-DC1 voltage.

public ElectricPotential DcDc1Voltage { get; set; }

Property Value

ElectricPotential

Remarks

Range is from 0.7 to 3.5V, steps of 25 mV.

DcDc2Voltage

Gets or sets DC-DC2 voltage.

public ElectricPotential DcDc2Voltage { get; set; }

Property Value

ElectricPotential

Remarks

Range is from 0.7 to 2.275V, steps of 25 mV.

DcDc3Voltage

Gets or sets DC-DC3 voltage.

public ElectricPotential DcDc3Voltage { get; set; }

Property Value

ElectricPotential

Remarks

Range is from 0.7 to 2.275V, steps of 25 mV.

EXTENEnable

Gets or sets a value indicating whether the state of EXTEN switch control.

public bool EXTENEnable { get; set; }

Property Value

bool

true if EXTEN switch is enabled, false otherwise.

Gpio0Behavior

Gets or sets the GPIO0 behavior.

public Gpio0Behavior Gpio0Behavior { get; set; }

Property Value

Gpio0Behavior

Gpio0Value

Gets or sets the pin value for GPIO0.

public PinValue Gpio0Value { get; set; }

Property Value

PinValue

Gpio1Behavior

Gets or sets the GPIO1 behavior.

public Gpio12Behavior Gpio1Behavior { get; set; }

Property Value

Gpio12Behavior

Gpio1Value

Gets or sets the pin value for GPIO1.

public PinValue Gpio1Value { get; set; }

Property Value

PinValue

Gpio2Behavior

Gets or sets the GPIO2 behavior.

public Gpio12Behavior Gpio2Behavior { get; set; }

Property Value

Gpio12Behavior

Gpio2Value

Gets or sets the pin value for GPIO2.

public PinValue Gpio2Value { get; set; }

Property Value

PinValue

Gpio3Behavior

Gets or sets the GPIO3 behavior.

public Gpio3Behavior Gpio3Behavior { get; set; }

Property Value

Gpio3Behavior

Gpio3Value

Gets or sets the pin value for GPIO3.

public PinValue Gpio3Value { get; set; }

Property Value

PinValue

Gpio4Behavior

Gets or sets the GPIO4 behavior.

public Gpio4Behavior Gpio4Behavior { get; set; }

Property Value

Gpio4Behavior

Gpio4Value

Gets or sets the pin value for GPIO4.

public PinValue Gpio4Value { get; set; }

Property Value

PinValue

LDO2OutputVoltage

Gets or sets LDO2 output voltage.

public ElectricPotential LDO2OutputVoltage { get; set; }

Property Value

ElectricPotential

Remarks

Range is from 1.8 to 3.3V, steps of 100 mV.

LDO3OutputVoltage

Gets or sets LDO3 output voltage.

public ElectricPotential LDO3OutputVoltage { get; set; }

Property Value

ElectricPotential

Remarks

Range is from 1.8 to 3.3V, steps of 100 mV.

LdoDcPinsEnabled

Gets or sets LDO and DC pins.

public LdoDcPinsEnabled LdoDcPinsEnabled { get; set; }

Property Value

LdoDcPinsEnabled

PinOutputVoltage

Gets or sets the global pin output voltage.

public PinOutputVoltage PinOutputVoltage { get; set; }

Property Value

PinOutputVoltage

Pwm1DutyCycleSetting1

Gets or sets PWM1 duty cycle setting 1.

public byte Pwm1DutyCycleSetting1 { get; set; }

Property Value

byte

Remarks

Default is 0x16.

Pwm1DutyCycleSetting2

Gets or sets PWM1 duty cycle setting 2.

public byte Pwm1DutyCycleSetting2 { get; set; }

Property Value

byte

Remarks

Default is 0x0B.

Pwm1OutputFrequencySetting

Gets or sets PWM1 output frequency.

public byte Pwm1OutputFrequencySetting { get; set; }

Property Value

byte

Remarks

Default is 0x00.

VoffVoltage

Gets or sets power off voltage.

public VoffVoltage VoffVoltage { get; set; }

Property Value

VoffVoltage

Methods

ClearAllIrq()

Clears all Irq.

public void ClearAllIrq()

ClearCoulombCounter()

Clear Coulomb counter.

public void ClearCoulombCounter()

DisableAllIRQ()

Disable all Irq.

public void DisableAllIRQ()

DisableCoulombCounter()

Disable Coulomb counter.

public void DisableCoulombCounter()

EnableButtonPressed(ButtonPressed)

Enable the button to be pressed and raise IRQ events.

public void EnableButtonPressed(ButtonPressed button)

Parameters

button ButtonPressed

Type of button press event.

EnableCoulombCounter()

Enable Coulomb counter.

public void EnableCoulombCounter()

EnableDCDC1(bool)

Sets the state of DC-DC1.

public void EnableDCDC1(bool state)

Parameters

state bool

True to enable DC-DC1.

EnableDCDC3(bool)

Sets the state of DC-DC3.

public void EnableDCDC3(bool state)

Parameters

state bool

True to enable DC-DC3.

EnableLDO2(bool)

Sets the state of LDO2.

public void EnableLDO2(bool state)

Parameters

state bool

True for on/high/1, false for off/low/O.

Remarks

On M5Stack, can turn LCD Backlight OFF for power saving.

EnableLDO3(bool)

Sets the state of LDO3.

public void EnableLDO3(bool state)

Parameters

state bool

True to enable LDO3.

GetApsVoltage()

Gets the APS voltage.

public ElectricPotential GetApsVoltage()

Returns

ElectricPotential

The APS voltage.

GetBatteryChargeCurrent()

Gets the battery charge Current.

public ElectricCurrent GetBatteryChargeCurrent()

Returns

ElectricCurrent

The battery charge Current.

GetBatteryChargingStatus()

Gets battery charging status.

public BatteryStatus GetBatteryChargingStatus()

Returns

BatteryStatus

The battery status.

GetBatteryDischargeCurrent()

Gets the battery discharge current.

public ElectricCurrent GetBatteryDischargeCurrent()

Returns

ElectricCurrent

The battery discharge current.

GetBatteryInstantaneousPower()

Gets the battery instantaneous consumption.

public Power GetBatteryInstantaneousPower()

Returns

Power

The power consumption.

GetBatteryVoltage()

Gets the battery voltage.

public ElectricPotential GetBatteryVoltage()

Returns

ElectricPotential

The battery voltage.

GetButtonStatus()

Get button status.

public ButtonPressed GetButtonStatus()

Returns

ButtonPressed

The state of a button.

GetCoulomb()

Gets Coulomb.

public double GetCoulomb()

Returns

double

The mA per hour.

GetInputCurrent()

Gets the input current.

public ElectricCurrent GetInputCurrent()

Returns

ElectricCurrent

The input current.

GetInputPowerStatus()

Gets the power status.

public PowerStatus GetInputPowerStatus()

Returns

PowerStatus

The power status.

GetInputVoltage()

Gets the input voltage.

public ElectricPotential GetInputVoltage()

Returns

ElectricPotential

The input voltage.

GetInternalTemperature()

Gets internal temperature.

public Temperature GetInternalTemperature()

Returns

Temperature

The temperature.

GetUsbCurrentInput()

Gets the USB current.

public ElectricCurrent GetUsbCurrentInput()

Returns

ElectricCurrent

The USB current.

GetUsbVoltageInput()

Gets the USB voltage input.

public ElectricPotential GetUsbVoltageInput()

Returns

ElectricPotential

The USB voltage input.

IsBatteryConnected()

Checks if the battery is connected.

public bool IsBatteryConnected()

Returns

bool

True if connected.

IsTemperatureWarning()

Is the temperature in warning.

public bool IsTemperatureWarning()

Returns

bool

True if internal temperature too high.

PowerOff()

Cut all power, except for LDO1 (RTC).

public void PowerOff()

Read6BytesStorage(SpanByte)

Reads the 6 bytes from the storage. AXP192 have a 6 byte storage, when the power is still valid, the data will not be lost.

public void Read6BytesStorage(SpanByte buffer)

Parameters

buffer SpanByte

A 6 bytes buffer.

SetAdcState(bool)

Sets the ADC state.

public void SetAdcState(bool state)

Parameters

state bool

True to enable, false to disable.

SetBackupBatteryChargingControl(bool, BackupBatteryCharingVoltage, BackupBatteryChargingCurrent)

Sets the backup battery charging control.

public void SetBackupBatteryChargingControl(bool enabled, BackupBatteryCharingVoltage voltage, BackupBatteryChargingCurrent current)

Parameters

enabled bool

Is enabled.

voltage BackupBatteryCharingVoltage

Battery charging voltage.

current BackupBatteryChargingCurrent

Battery charging current.

SetBatteryHighTemperatureThreshold(ElectricPotential)

Sets the high temperature threshold for the battery.

public void SetBatteryHighTemperatureThreshold(ElectricPotential potential)

Parameters

potential ElectricPotential

From 0 to 3.264V. Anything higher will be caped to the maximum.

SetButtonBehavior(LongPressTiming, ShortPressTiming, bool, SignalDelayAfterPowerUp, ShutdownTiming)

Sets the button default behavior.

public void SetButtonBehavior(LongPressTiming longPress, ShortPressTiming shortPress, bool automaticShutdownAtOvertime, SignalDelayAfterPowerUp signalDelay, ShutdownTiming shutdownTiming)

Parameters

longPress LongPressTiming

The long press timing.

shortPress ShortPressTiming

The short press timing.

automaticShutdownAtOvertime bool

True if automatic shutdown should be processed when over shutdown time.

signalDelay SignalDelayAfterPowerUp

The PWROK signal delay after power start-up.

shutdownTiming ShutdownTiming

The shutdown timing.

SetChargingFunctions(bool, ChargingVoltage, ChargingCurrent, ChargingStopThreshold)

Set the charging functions.

public void SetChargingFunctions(bool includeExternal, ChargingVoltage chargingVoltage, ChargingCurrent chargingCurrent, ChargingStopThreshold stopThreshold)

Parameters

includeExternal bool

True to include the external.

chargingVoltage ChargingVoltage

Charging voltage.

chargingCurrent ChargingCurrent

Charging current.

stopThreshold ChargingStopThreshold

Stop threshold.

SetShutdownBatteryDetectionControl(bool, bool, ShutdownBatteryPinFunction, bool, ShutdownBatteryTiming)

Sets shutdown battery detection control.

public void SetShutdownBatteryDetectionControl(bool turnOffAxp192, bool enabled, ShutdownBatteryPinFunction function, bool pinControl, ShutdownBatteryTiming timing)

Parameters

turnOffAxp192 bool

True to shutdown the AXP192.

enabled bool

True to enable the control.

function ShutdownBatteryPinFunction

The pin function.

pinControl bool

True to enable the pin function.

timing ShutdownBatteryTiming

Delay after AXP192 lowered to higher.

SetSleep()

Sets the sleep mode.

public void SetSleep()

SetVbusSettings(bool, bool, VholdVoltage, bool, VbusCurrentLimit)

Sets the VBUS settings.

public void SetVbusSettings(bool vbusIpsOut, bool vbusLimit, VholdVoltage vholdVoltage, bool currentLimitEnable, VbusCurrentLimit vbusCurrent)

Parameters

vbusIpsOut bool

The VBUS-IPSOUT path selects the control signal when VBUS is available.

vbusLimit bool

True to limit VBUS VHOLD control.

vholdVoltage VholdVoltage

VHOLD Voltage.

currentLimitEnable bool

True to limit VBUS current.

vbusCurrent VbusCurrentLimit

VBUS Current limit.

StopCoulombCounter()

Stops Coulomb counter.

public void StopCoulombCounter()

Write6BytesStorage(SpanByte)

Stores data in the storage. 6 bytes are available. AXP192 have a 6 byte storage, when the power is still valid, the data will not be lost.

public void Write6BytesStorage(SpanByte buffer)

Parameters

buffer SpanByte

A 6 bytes buffer.