Skip to content

Commit fa9f9ec

Browse files
committed
added m5stack-fire ip5306 i2c method
1 parent e306109 commit fa9f9ec

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/M5Stack.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ void M5Stack::begin(bool LCDEnable, bool SDEnable) {
1313
// I2C Startup BUG?
1414
// pinMode(SCL, OUTPUT);
1515
// digitalWrite(SCL, 1);
16+
#ifdef M5STACK_FIRE
1617
Wire.begin(21, 22);
1718
setPowerBoostKeepOn(true);
19+
#endif
1820

1921
// TONE
2022
Speaker.begin();
@@ -52,6 +54,7 @@ void M5Stack::update() {
5254
Speaker.update();
5355
}
5456

57+
#ifdef M5STACK_FIRE
5558
// ================ Power IC IP5306 ===================
5659
#define IP5306_ADDR 117
5760
#define IP5306_REG_SYS_CTL0 0x00
@@ -78,16 +81,19 @@ uint8_t M5Stack::isChargeFull()
7881
if (data & (1 << CHARGE_FULL_BIT)) return true;
7982
else return false;
8083
}
81-
84+
#endif
8285

8386
// ================== Low power mode =====================
8487
void M5Stack::setWakeupButton(uint8_t button) {
8588
_wakeupPin = button;
8689
}
8790

8891
void M5Stack::powerOFF() {
92+
93+
#ifdef M5STACK_FIRE
8994
// Keep power keep boost on
9095
setPowerBoostKeepOn(true);
96+
#endif
9197

9298
// power off the Lcd
9399
Lcd.setBrightness(0);

src/M5Stack.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ class M5Stack {
109109
void begin(bool LCDEnable=true, bool SDEnable=true);
110110
void update();
111111

112+
#ifdef M5STACK_FIRE
112113
void setPowerBoostKeepOn(bool en);
113114
uint8_t isChargeFull();
115+
#endif
116+
114117
void setWakeupButton(uint8_t button);
115118
void powerOFF();
116119

0 commit comments

Comments
 (0)