M5Unified
|
#include <Power_Class.hpp>
Public Types | |
enum | pmic_t { pmic_unknown , pmic_adc , pmic_axp192 , pmic_ip5306 , pmic_axp2101 } |
enum | is_charging_t { is_discharging = 0 , is_charging , charge_unknown } |
Public Member Functions | |
bool | begin (void) |
void | setExtOutput (bool enable, ext_port_mask_t port_mask=(ext_port_mask_t) 0xFF) |
void | setExtPower (bool enable, ext_port_mask_t port_mask=(ext_port_mask_t) 0xFF) |
deprecated : Change to "setExtOutput" More... | |
bool | getExtOutput (void) |
void | setUsbOutput (bool enable) |
bool | getUsbOutput (void) |
void | setLed (uint8_t brightness=255) |
void | powerOff (void) |
all power off. More... | |
void | timerSleep (int seconds) |
void | timerSleep (const rtc_time_t &time) |
void | timerSleep (const rtc_date_t &date, const rtc_time_t &time) |
void | deepSleep (std::uint64_t micro_seconds=0, bool touch_wakeup=true) |
void | lightSleep (std::uint64_t micro_seconds=0, bool touch_wakeup=true) |
std::int32_t | getBatteryLevel (void) |
void | setBatteryCharge (bool enable) |
void | setChargeCurrent (std::uint16_t max_mA) |
void | setChargeVoltage (std::uint16_t max_mV) |
is_charging_t | isCharging (void) |
int16_t | getBatteryVoltage (void) |
int32_t | getBatteryCurrent (void) |
uint8_t | getKeyState (void) |
void | setVibration (uint8_t level) |
pmic_t | getType (void) const |
Public Attributes | |
AXP2101_Class | Axp2101 |
AXP192_Class | Axp192 |
IP5306_Class | Ip5306 |
INA3221_Class | Ina3221 |
Definition at line 36 of file Power_Class.hpp.
Enumerator | |
---|---|
is_discharging | |
is_charging | |
charge_unknown |
Definition at line 49 of file Power_Class.hpp.
Enumerator | |
---|---|
pmic_unknown | |
pmic_adc | |
pmic_axp192 | |
pmic_ip5306 | |
pmic_axp2101 |
Definition at line 41 of file Power_Class.hpp.
bool m5::Power_Class::begin | ( | void | ) |
setup power management ic
++-----— reserved (00) ||+----— boost enable |||+---— charge enable ||||+--— reserved (0) |||||+-— Insert load auto power on function enable ||||||+— BOOST output normally open function (※ DeepSleepやRTC Timer使用時は1にすること (負荷が軽いと電力供給を停止されてしまうため)) |||||||+– Push button shutdown enable ||||||||
+------— Off boost control signal selection (1:Long press ; 0:Short press twice) |+-----— Switch WLED flashlight control signal selection (1:Short press twice ; 0:Long press) ||+----— Short press switch boost |||++--— reserved(11) |||||+-— Whether to turn on Boost after VIN is pulled out ||||||+— reserved(0) |||||||+– Batlow 3.0V Low Power Shutdown Enable ||||||||
+++----— reserved(011) |||+---— KEY Long press time setting (0:2s ; 1:3s) ||||++-— Light load shutdown time setting (00:8s ; 01:32s ; 10:16s ; 11:64s) ||||||++– reserved(00) ||||||||
++++++-— reserved(0) ||||||++– Charge full stop setting 4.14/4.26/4.305/4.35 ||||||||
++-----— Battery side stop charging current detection ||+----— reserved(0) |||+++-— Charging undervoltage loop setting (voltage at output VOUT during charging) ||||||++– reserved(01) ||||||||
++++---— reserved(0000) ||||++-— Battery voltage setting (00:4.2V ; 01:4.3V ; 10:4.35V ; 11:4.4V) ||||||++– Constant voltage charging voltage boost setting (00:nothing ; 01:14mV ; 10:28mV ; 11:42mV) ||||||||
++-----— reserved(10) ||+----— Charging constant current loop selection. (1:CC at VIN side ; 0:CC at BAT side) |||+++++– reserved(01110) ||||||||
+++----— reserved(110) |||+++++– Charger (VIN side) current setting. (I:0.05+b0*0.1+b1*0.2+b2*0.4+b3*0.8+b4*1.6A) ||||||||
+------— VBUS-IPSOUT channel selection control signal when VBUS is available (0:The N_VBUSEN pin determines whether to open this channel. / 1: The VBUS-IPSOUT path can be selected to be opened regardless of the status of N_VBUSEN) |+-----— VBUS VHOLD pressure limit control (0:disable ; 1:enable) ||+++--— VHOLD setting (x 100mV + 4.0V ; 000:4.0V ~ 111:4.7V) |||||+-— reserved(0) ||||||+— VBUS current limit control enable signal |||||||+– VBUS current limit control opens time limit flow selection (0:500mA ; 1:100mA) ||||||||
++++---— reserved ||||+--— PWRON short press wake-up function enable setting in Sleep mode. |||||+++– VOFF Settings (x 100mV + 2.6V 000:2.6V ~ 111:3.3V) ||||||||
+------— Shutdown control under mode A Writing 1 to this bit will turn off the output of the AXP192 |+-----— Battery monitoring function setting (0:off ; 1:on) ||++---— CHGLED pin function setting (00:High resistance ; 01:25% 1Hz blinking ; 10:25% 4Hz blinking ; 11:Output low level) ||||+--— CHGLED pin control settings (0: Controlled by charging function ; 1: Controlled by register REG 32HBit[5:4]) |||||+-— reserved(1) ||||||++– AXP192 Shutdown delay time after N_OE changes from low to high Delay time (00: 0.5S ; 01: 1S ; 10: 2S ; 11: 3S) ||||||||
+------— Charge function enable control bit, including internal and external channels |++----— Charging target voltage setting ( 00:4.1V ; 01:4.15V ; 10:4.2V ; 11:4.36V) |||+---— Charging end current setting (0:End charging when charging current is less than 10% setting ; 1: End charging when charging current is less than 15% setting) ||||++++– Internal path charging current setting ||||||||
Definition at line 46 of file Power_Class.cpp.
void m5::Power_Class::deepSleep | ( | std::uint64_t | micro_seconds = 0 , |
bool | touch_wakeup = true |
||
) |
ESP32 deepsleep
seconds | Number of micro seconds to wakeup. |
Definition at line 695 of file Power_Class.cpp.
int32_t m5::Power_Class::getBatteryCurrent | ( | void | ) |
get battery current
Definition at line 953 of file Power_Class.cpp.
std::int32_t m5::Power_Class::getBatteryLevel | ( | void | ) |
Get the remaining battery power.
Definition at line 854 of file Power_Class.cpp.
int16_t m5::Power_Class::getBatteryVoltage | ( | void | ) |
Get battery voltage
Definition at line 822 of file Power_Class.cpp.
bool m5::Power_Class::getExtOutput | ( | void | ) |
Get power output of the external ports.
Definition at line 466 of file Power_Class.cpp.
uint8_t m5::Power_Class::getKeyState | ( | void | ) |
Get Power Key Press condition.
Definition at line 1046 of file Power_Class.cpp.
|
inline |
Definition at line 154 of file Power_Class.hpp.
bool m5::Power_Class::getUsbOutput | ( | void | ) |
Get power output of the main USB port.
Definition at line 520 of file Power_Class.cpp.
Power_Class::is_charging_t m5::Power_Class::isCharging | ( | void | ) |
Get whether the battery is currently charging or not.
Definition at line 1019 of file Power_Class.cpp.
void m5::Power_Class::lightSleep | ( | std::uint64_t | micro_seconds = 0 , |
bool | touch_wakeup = true |
||
) |
ESP32 lightsleep
seconds | Number of micro seconds to wakeup. |
Definition at line 733 of file Power_Class.cpp.
void m5::Power_Class::powerOff | ( | void | ) |
all power off.
Definition at line 768 of file Power_Class.cpp.
void m5::Power_Class::setBatteryCharge | ( | bool | enable | ) |
set battery charge enable.
enable | true=enable / false=disable |
Definition at line 897 of file Power_Class.cpp.
void m5::Power_Class::setChargeCurrent | ( | std::uint16_t | max_mA | ) |
set battery charge current
max_mA | milli ampere. |
Definition at line 925 of file Power_Class.cpp.
void m5::Power_Class::setChargeVoltage | ( | std::uint16_t | max_mV | ) |
set battery charge voltage
max_mV | milli volt. |
Definition at line 990 of file Power_Class.cpp.
void m5::Power_Class::setExtOutput | ( | bool | enable, |
ext_port_mask_t | port_mask = (ext_port_mask_t)0xFF |
||
) |
Set power output of the external ports.
enable | true=output / false=input |
port_mask | for M5Station. ext_port (bitmask). |
Definition at line 395 of file Power_Class.cpp.
|
inline |
deprecated : Change to "setExtOutput"
Definition at line 64 of file Power_Class.hpp.
void m5::Power_Class::setLed | ( | uint8_t | brightness = 255 | ) |
Turn on/off the power LED.
brightness | 0=OFF: 1~255=ON (Set brightness if possible.) |
M5StickC,CPlus /CoreInk : LED = GPIO10 / TimerCam:LED = GPIO2
Definition at line 539 of file Power_Class.cpp.
void m5::Power_Class::setUsbOutput | ( | bool | enable | ) |
Set power output of the main USB port.
enable | true=output / false=input |
Definition at line 505 of file Power_Class.cpp.
void m5::Power_Class::setVibration | ( | uint8_t | level | ) |
Operate the vibration motor
level | Vibration strength of the motor. (0=stop) |
Definition at line 1070 of file Power_Class.cpp.
void m5::Power_Class::timerSleep | ( | const rtc_date_t & | date, |
const rtc_time_t & | time | ||
) |
sleep and timer boot. The boot condition can be specified by the argument.
date | Date to boot. (only date and weekDay can be specified. Ignore year and month) |
time | Time to boot. (only minutes and hours can be specified. Ignore seconds) |
Definition at line 792 of file Power_Class.cpp.
void m5::Power_Class::timerSleep | ( | const rtc_time_t & | time | ) |
sleep and timer boot. The boot condition can be specified by the argument.
time | Time to boot. (only minutes and hours can be specified. Ignore seconds) |
Definition at line 785 of file Power_Class.cpp.
void m5::Power_Class::timerSleep | ( | int | seconds | ) |
sleep and timer boot. The boot condition can be specified by the argument.
seconds | Number of seconds to boot. |
Definition at line 775 of file Power_Class.cpp.
AXP192_Class m5::Power_Class::Axp192 |
Definition at line 165 of file Power_Class.hpp.
AXP2101_Class m5::Power_Class::Axp2101 |
Definition at line 164 of file Power_Class.hpp.
INA3221_Class m5::Power_Class::Ina3221 |
Definition at line 167 of file Power_Class.hpp.
IP5306_Class m5::Power_Class::Ip5306 |
Definition at line 166 of file Power_Class.hpp.