Files
m5-docs/docs/en/api/axp192_core2.md

2.2 KiB
Raw Permalink Blame History

AXP192

AXP192 is a highly integrated power system management chip. A series of power chips are packaged in the M5Core2 library to control the power of peripheral peripherals.

SetLcdVoltage()

Syntax

void SetLcdVoltage(uint16_t voltage);

DescriptionSet screen voltage, adjust brightness, valid range of parameters is 2500-3300

Example

#include <M5Core2.h>

void setup() {
  M5.begin(); //By default, "M5.begin()" will initialize AXP192 chip
  M5.Lcd.fillScreen(RED);
}
void loop() {
  M5.update();
  for(int i=2500; i<3300;i++){
    M5.Axp.SetLcdVoltage(i);
    delay(10);
  }
  for(int i=3300; i>2500;i--){
    M5.Axp.SetLcdVoltage(i);
    delay(10);
  }
}

SetLed()

Syntax

void SetLed(uint8_t state);

DescriptionSet the built-in LED light, state: 1 is on, state: 0 is off

Example

#include <M5Core2.h>

void setup() {
  M5.begin();
}
void loop() {
  M5.Axp.SetLed(1);
  delay(1000);
  M5.Axp.SetLed(0);
  delay(1000);
}

SetBusPowerMode()

Syntax

void SetBusPowerMode( uint8_t state );

DescriptionSet BUS power mode, set 0 for USB/BAT power supply, set 1 for external input power supply

SetSpkEnable()

Syntax

void SetSpkEnable(uint8_t state);

DescriptionSet speaker power enable

SetCHGCurrent()

Syntax

void SetCHGCurrent(uint8_t state);

DescriptionSet battery charging current

GetBatVoltage()

Syntax

float GetBatVoltage();

DescriptionRead battery voltage

GetBatCurrent()

Syntax

float GetBatCurrent();

DescriptionRead battery current

GetVBusVoltage()

Syntax

float GetVBusVoltage();

DescriptionRead VBUS voltage

GetVBusCurrent()

Syntax

float GetVBusCurrent();

DescriptionRead VBUS current

GetTempInAXP192()

Syntax

float GetTempInAXP192();

DescriptionRead AXP192 chip temperature

GetBatPower()

Syntax

float GetBatPower();

DescriptionRead the current power consumption of the battery

GetBatChargeCurrent()

Syntax

float GetBatChargeCurrent();

DescriptionRead battery charging current

isCharging()

Syntax

bool isCharging();

DescriptionCheck if it is charging