Skip to content

Commit 9c6e58d

Browse files
committed
WioTerminal_USB2Serial_Burn8720:auto set baud.
1 parent 5bc4d55 commit 9c6e58d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

examples/WioTerminal_USB2Serial_Burn8720/WioTerminal_USB2Serial_Burn8720.ino

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void key_c_input()
2626
void setup()
2727
{
2828
Serial.begin(115200);
29-
29+
//Serial1.begin(115200);
3030
pinMode(WIO_KEY_A, INPUT_PULLUP);
3131

3232
pinMode(WIO_KEY_B, INPUT_PULLUP);
@@ -47,6 +47,9 @@ void loop()
4747

4848
if (state_a == LOW)
4949
{
50+
uint32_t baud;
51+
52+
uint32_t old_baud;
5053
while (digitalRead(WIO_KEY_A) == LOW)
5154
;
5255
tft.drawString("Burn RTL8720 fw", 70, 80); //prints string at (70,80)
@@ -62,10 +65,18 @@ void loop()
6265
pinMode(PIN_SERIAL2_RX, INPUT);
6366
Serial.beginWithoutDTR(115200);
6467
// Serial.baud
65-
RTL8720D.begin(115200);
68+
old_baud = Serial.baud();
69+
RTL8720D.begin(old_baud);
70+
6671
delay(500);
6772
while (1)
6873
{
74+
baud = Serial.baud();
75+
if(baud != old_baud)
76+
{
77+
RTL8720D.begin(baud);
78+
old_baud = baud;
79+
}
6980
// read from port 1, send to port 0:
7081

7182
if (Serial.available())
@@ -167,4 +178,3 @@ void loop()
167178

168179
}
169180
}
170-

0 commit comments

Comments
 (0)