Skip to content

Commit e6df726

Browse files
committed
fixed wire begin overload bug
1 parent aed6824 commit e6df726

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

examples/Module/SERVO/SERVO.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
#define SERVO_ADDR 0x53
2121
void setup() {
22-
M5.begin(true,false,true,true,kMBusModeInput);
23-
/* kMBusModeOutput,powered by USB or Battery
22+
M5.begin(true, false, true, true, kMBusModeInput);
23+
/* kMBusModeOutput,powered by USB or Battery
2424
kMBusModeInput,powered by outside input need to fill in this Otherwise M5Core2 will not work properly
2525
由外部供电时此项必填,否则M5Core2将无法正常工作 */
2626
M5.Lcd.setTextFont(4);
2727
M5.Lcd.setCursor(70, 100);
2828
M5.Lcd.print("Servo Example");
2929

30-
Wire.begin(32, 33, 100000);
30+
Wire.begin(32, 33, 100000UL);
3131
}
3232

3333
// addr 0x01 mean control the number 1 servo by us
@@ -48,12 +48,12 @@ void Servo_write_angle(uint8_t number, uint8_t angle) {
4848
}
4949

5050
void loop() {
51-
for(uint8_t i = 0; i < 12; i++){
51+
for (uint8_t i = 0; i < 12; i++) {
5252
Servo_write_us(i, 700);
5353
// Servo_write_angle(i, 0);
5454
}
5555
delay(1000);
56-
for(uint8_t i = 0; i < 12; i++){
56+
for (uint8_t i = 0; i < 12; i++) {
5757
Servo_write_us(i, 2300);
5858
// Servo_write_angle(i, 180);
5959
}

examples/Unit/JOYSTICK/JOYSTICK.ino

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,34 @@
1515

1616
#include <M5Core2.h>
1717

18-
#define JOY_ADDR 0x52 //define Joystick I2C address. 定义摇杆的I2C地址
18+
#define JOY_ADDR 0x52 //define Joystick I2C address. 定义摇杆的I2C地址
1919

2020
void setup() {
2121
M5.begin();
2222
M5.Lcd.setCursor(70, 0, 4);
2323
M5.Lcd.println(("Joystick Test"));
2424
dacWrite(25, 0); //disable the speak noise. 禁用语音噪音
25-
Wire.begin(32, 33, 400000);
25+
Wire.begin(32, 33, 400000UL);
2626
}
2727

2828
char data[100];
2929
void loop() {
30-
static uint8_t x_data,y_data,button_data;
31-
M5.Lcd.setCursor(100, 50, 4);
32-
M5.Lcd.printf("X:%d ",x_data);
33-
M5.Lcd.setCursor(100, 80, 4);
34-
M5.Lcd.printf("Y:%d ",y_data);
35-
M5.Lcd.setCursor(100, 110, 4);
36-
M5.Lcd.printf("B:%d ",button_data);
37-
Wire.requestFrom(JOY_ADDR, 3); //Request 3 bytes from the slave device. 向从设备请求3个字节
38-
if (Wire.available()) { //If data is received. 如果接收到数据
30+
static uint8_t x_data, y_data, button_data;
31+
M5.Lcd.setCursor(100, 50, 4);
32+
M5.Lcd.printf("X:%d ", x_data);
33+
M5.Lcd.setCursor(100, 80, 4);
34+
M5.Lcd.printf("Y:%d ", y_data);
35+
M5.Lcd.setCursor(100, 110, 4);
36+
M5.Lcd.printf("B:%d ", button_data);
37+
Wire.requestFrom(
38+
JOY_ADDR,
39+
3); //Request 3 bytes from the slave device. 向从设备请求3个字节
40+
if (Wire.available()) { //If data is received. 如果接收到数据
3941
x_data = Wire.read();
4042
y_data = Wire.read();
4143
button_data = Wire.read();
4244
sprintf(data, "x:%d y:%d button:%d\n", x_data, y_data, button_data);
4345
Serial.print(data);
44-
45-
4646
}
4747
delay(200);
4848
}

examples/core2_for_aws/FactoryTest/FactoryTest.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ int checkAETCC608AInit()
521521
Serial.println();
522522

523523
myECCX08.end();
524-
Wire1.begin(21,22,100000);
524+
Wire1.begin(21,22,100000UL);
525525
}
526526

527527
int checkSDCard()
@@ -2223,7 +2223,7 @@ void setup()
22232223
}
22242224
FastLED.show();
22252225

2226-
Wire1.begin(21, 22, 10000);
2226+
Wire1.begin(21, 22, 100000UL);
22272227
checkI2cAddr();
22282228
checkAETCC608AInit();
22292229
checkPsram();

examples/core2_for_aws/FactoryTest/main.cpp.old

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void setup()
2121
}
2222
FastLED.show();
2323

24-
Wire1.begin(21, 22, 10000);
24+
Wire1.begin(21, 22, 100000UL);
2525
for (int i = 0; i < 128; i++)
2626
{
2727
Wire1.beginTransmission(i);
@@ -53,4 +53,4 @@ void loop()
5353
FastLED.show();
5454
delay(100);
5555
M5.update();
56-
}
56+
}

0 commit comments

Comments
 (0)