Skip to content

Commit f9953af

Browse files
committed
Add power api, Set battery charging init in M5.Power.begin()
1. Reduce battery charging current to 650ma 2. Set battery charging voltage to 4.2v
1 parent 3d1d9f4 commit f9953af

File tree

44 files changed

+148
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+148
-6
lines changed

examples/Basics/Button/Button.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
void setup() {
1010
// init lcd, serial, but don't init sd card
1111
M5.begin(true, false, true);
12+
13+
/*
14+
Power chip connected to gpio21, gpio22, I2C device
15+
Set battery charging voltage and current
16+
If used battery, please call this function in your project
17+
*/
18+
M5.Power.begin();
19+
1220
M5.Lcd.clear(BLACK);
1321
M5.Lcd.setTextColor(YELLOW);
1422
M5.Lcd.setTextSize(2);
@@ -22,6 +30,7 @@ void setup() {
2230

2331
// Add the main program code into the continuous loop() function
2432
void loop() {
33+
// update button state
2534
M5.update();
2635

2736
// if you want to use Releasefor("was released for"), use .wasReleasefor(int time) below

examples/Basics/Display/Display.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ void setup() {
66
// initialize the M5Stack object
77
M5.begin();
88

9+
/*
10+
Power chip connected to gpio21, gpio22, I2C device
11+
Set battery charging voltage and current
12+
If used battery, please call this function in your project
13+
*/
14+
M5.Power.begin();
15+
916
// Lcd display
1017
M5.Lcd.fillScreen(WHITE);
1118
delay(500);

examples/Basics/FactoryTest/FactoryTest.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,13 @@ void setup() {
469469
// initialize the M5Stack object
470470
M5.begin();
471471

472+
/*
473+
Power chip connected to gpio21, gpio22, I2C device
474+
Set battery charging voltage and current
475+
If used battery, please call this function in your project
476+
*/
477+
M5.Power.begin();
478+
472479
// dac test
473480
// if (gpio_test_flg)
474481
// {

examples/Basics/HelloWorld/HelloWorld.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ void setup(){
66
// Initialize the M5Stack object
77
M5.begin();
88

9+
/*
10+
Power chip connected to gpio21, gpio22, I2C device
11+
Set battery charging voltage and current
12+
If used battery, please call this function in your project
13+
*/
14+
M5.Power.begin();
15+
916
// LCD display
1017
M5.Lcd.print("Hello World");
1118
}

examples/Basics/PowerOFF/PowerOFF.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ void setup(){
55

66
// initialize the M5Stack object
77
M5.begin();
8+
9+
/*
10+
Power chip connected to gpio21, gpio22, I2C device
11+
Set battery charging voltage and current
12+
If used battery, please call this function in your project
13+
*/
14+
M5.Power.begin();
815

916
// Lcd display
1017
M5.Lcd.println("This is software power off demo");

examples/Basics/Sleep/Sleep.ino

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
void setup() {
44
M5.begin();
5+
6+
/*
7+
Power chip connected to gpio21, gpio22, I2C device
8+
Set battery charging voltage and current
9+
If used battery, please call this function in your project
10+
*/
511
M5.Power.begin();
612
M5.Lcd.setBrightness(200);
713

examples/Basics/Speaker/Speaker.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ void setup() {
3030
// Initialize the M5Stack object
3131
M5.begin();
3232

33+
/*
34+
Power chip connected to gpio21, gpio22, I2C device
35+
Set battery charging voltage and current
36+
If used battery, please call this function in your project
37+
*/
38+
M5.Power.begin();
39+
3340
M5.Lcd.printf("M5Stack Speaker test:\r\n");
3441
}
3542

examples/Unit/ADC_ADS1100/ADC_ADS1100.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ ADS1100 ads;
1111
void setup(void)
1212
{
1313
M5.begin(true, false, false);
14+
M5.Power.begin();
1415
Serial.begin(115200);
15-
1616
M5.Lcd.fillScreen(BLACK);
1717
M5.Lcd.setTextColor(ORANGE);
1818

examples/Unit/ANGLE/ANGLE.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ int cur_sensorValue = 0;
88

99
void setup() {
1010
M5.begin();
11+
M5.Power.begin();
1112
pinMode(sensorPin, INPUT);
1213
dacWrite(25, 0);
1314
M5.Lcd.setTextSize(2);

examples/Unit/BUTTON/BUTTON.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ int cur_value = 0;
66
void setup() {
77
// init lcd
88
M5.begin();
9+
M5.Power.begin();
910
Serial.begin(115200);
1011
pinMode(36, INPUT);
1112
M5.Lcd.clear(BLACK);

0 commit comments

Comments
 (0)