Skip to content

Commit 1d2125e

Browse files
author
fm
committed
Revert "Merge pull request #20 from felmue/fm-fix-setbuspowermode-2"
This reverts commit 08ec82a, reversing changes made to adbdc80.
1 parent fabef4e commit 1d2125e

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/AXP192.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -527,32 +527,31 @@ void AXP192::SetLCDRSet(bool state)
527527
Write1Byte(reg_addr, data);
528528
}
529529

530-
// Select source for BUS_5V
531-
// 0 : use internal boost
532-
// 1 : powered externally
533530
void AXP192::SetBusPowerMode(uint8_t state)
534531
{
535532
uint8_t data;
536533
if (state == 0)
537534
{
538-
// Set GPIO to 3.3V (LDO OUTPUT mode)
539535
data = Read8bit(0x91);
540-
Write1Byte(0x91, (data & 0x0F) | 0xF0);
541-
// Set GPIO0 to LDO OUTPUT, pullup N_VBUSEN to disable VBUS supply from BUS_5V
536+
Write1Byte(0x91, (data & 0X0F) | 0XF0);
537+
542538
data = Read8bit(0x90);
543-
Write1Byte(0x90, (data & 0xF8) | 0x02);
544-
// Set EXTEN to enable 5v boost
545-
data = Read8bit(0x10);
546-
Write1Byte(0x10, data | 0x04);
539+
Write1Byte(0x90, (data & 0XF8) | 0X02); //set GPIO0 to LDO OUTPUT , pullup N_VBUSEN to disable supply from BUS_5V
540+
541+
data = Read8bit(0x91);
542+
543+
data = Read8bit(0x12); //read reg 0x12
544+
Write1Byte(0x12, data | 0x40); //set EXTEN to enable 5v boost
547545
}
548546
else
549547
{
550-
// Set EXTEN to disable 5v boost
551-
data = Read8bit(0x10);
552-
Write1Byte(0x10, data & ~0x04);
553-
// Set GPIO0 to float, using enternal pulldown resistor to enable VBUS supply from BUS_5V
548+
data = Read8bit(0x12); //read reg 0x10
549+
Write1Byte(0x12, data & 0XBF); //set EXTEN to disable 5v boost
550+
551+
//delay(2000);
552+
554553
data = Read8bit(0x90);
555-
Write1Byte(0x90, (data & 0xF8) | 0x07);
554+
Write1Byte(0x90, (data & 0xF8) | 0X01); //set GPIO0 to float , using enternal pulldown resistor to enable supply from BUS_5VS
556555
}
557556
}
558557

0 commit comments

Comments
 (0)