From 73c65839c44d0281ea45c769701d0f9d126f5ea6 Mon Sep 17 00:00:00 2001 From: Hiroyuki Yamasaki Date: Mon, 5 Oct 2020 23:27:40 +0900 Subject: [PATCH] M5.Axp.PowerOff (). I implemented M5.Axp.PowerOff (). --- src/AXP192.cpp | 8 +++++++- src/AXP192.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/AXP192.cpp b/src/AXP192.cpp index bccfe0c..449d627 100644 --- a/src/AXP192.cpp +++ b/src/AXP192.cpp @@ -467,4 +467,10 @@ void AXP192::SetLDO2( bool State ) else buf = ~(1<<2) & buf; Write1Byte( 0x12 , buf ); -} \ No newline at end of file +} + +// Cut all power, except for LDO1 (RTC) +void AXP192::PowerOff() +{ + Write1Byte(0x32, Read8bit(0x32) | 0x80); // MSB for Power Off +} diff --git a/src/AXP192.h b/src/AXP192.h index 07078ef..081dd00 100644 --- a/src/AXP192.h +++ b/src/AXP192.h @@ -62,6 +62,9 @@ class AXP192 { void SetCoulombClear(); void SetLDO2( bool State ); + // -- Power Off + void PowerOff(); + public: void Write1Byte( uint8_t Addr , uint8_t Data ); uint8_t Read8bit( uint8_t Addr );