Skip to content

Commit 6fb8bfe

Browse files
committed
Add portA power control #99
1 parent 2af1a42 commit 6fb8bfe

File tree

4 files changed

+10
-355
lines changed

4 files changed

+10
-355
lines changed

examples/Unit/LoRaWAN470/LoRaWAN470.ino

Lines changed: 0 additions & 160 deletions
This file was deleted.

examples/Unit/LoRaWAN868/LoRaWAN868.ino

Lines changed: 0 additions & 195 deletions
This file was deleted.

src/AXP192.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ void AXP192::begin() {
6060
delay(100);
6161
// I2C_WriteByteDataAt(0X15,0XFE,0XFF);
6262

63+
SetPeripherialsPower(true);
64+
6365
// axp: check v-bus status
6466
if (Read8bit(0x00) & 0x08) {
6567
Write1Byte(0x30, Read8bit(0x30) | 0x80);
@@ -535,3 +537,10 @@ void AXP192::SetCHGCurrent(uint8_t state) {
535537
data = data | (state & 0x0f);
536538
Write1Byte(0x33, data);
537539
}
540+
541+
void AXP192::SetPeripherialsPower(uint8_t state) {
542+
if (!state)
543+
Write1Byte(0x10, Read8bit(0x10) & 0XFB);
544+
else if (state)
545+
Write1Byte(0x10, Read8bit(0x10) | 0X02);
546+
}

src/AXP192.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class AXP192 {
9797
void SetLed(uint8_t state);
9898
void SetSpkEnable(uint8_t state);
9999
void SetCHGCurrent(uint8_t state);
100+
void SetPeripherialsPower(uint8_t state);
100101

101102
private:
102103
void Write1Byte(uint8_t Addr, uint8_t Data);

0 commit comments

Comments
 (0)