Skip to content

Commit

Permalink
Add portA power control #99
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinyu-Zhao committed Aug 30, 2022
1 parent 2af1a42 commit 6fb8bfe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 355 deletions.
160 changes: 0 additions & 160 deletions examples/Unit/LoRaWAN470/LoRaWAN470.ino

This file was deleted.

195 changes: 0 additions & 195 deletions examples/Unit/LoRaWAN868/LoRaWAN868.ino

This file was deleted.

9 changes: 9 additions & 0 deletions src/AXP192.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ void AXP192::begin() {
delay(100);
// I2C_WriteByteDataAt(0X15,0XFE,0XFF);

SetPeripherialsPower(true);

// axp: check v-bus status
if (Read8bit(0x00) & 0x08) {
Write1Byte(0x30, Read8bit(0x30) | 0x80);
Expand Down Expand Up @@ -535,3 +537,10 @@ void AXP192::SetCHGCurrent(uint8_t state) {
data = data | (state & 0x0f);
Write1Byte(0x33, data);
}

void AXP192::SetPeripherialsPower(uint8_t state) {
if (!state)
Write1Byte(0x10, Read8bit(0x10) & 0XFB);
else if (state)
Write1Byte(0x10, Read8bit(0x10) | 0X02);
}
1 change: 1 addition & 0 deletions src/AXP192.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class AXP192 {
void SetLed(uint8_t state);
void SetSpkEnable(uint8_t state);
void SetCHGCurrent(uint8_t state);
void SetPeripherialsPower(uint8_t state);

private:
void Write1Byte(uint8_t Addr, uint8_t Data);
Expand Down

0 comments on commit 6fb8bfe

Please sign in to comment.