aboutsummaryrefslogtreecommitdiffhomepage
path: root/monitor.go
diff options
context:
space:
mode:
authorsago35 <[email protected]>2022-09-25 02:09:41 +0900
committerGitHub <[email protected]>2022-09-24 19:09:41 +0200
commit9e2444197826290f1d774a5c0f6be9802afab2f6 (patch)
tree85c70627ddb510f0ee15a154fa8dfcfad4e15038 /monitor.go
parent1e6c14b3e4015fa25e921cb1748e10f176e8c209 (diff)
downloadtinygo-9e2444197826290f1d774a5c0f6be9802afab2f6.tar.gz
tinygo-9e2444197826290f1d774a5c0f6be9802afab2f6.zip
main: allow setting the baud rate for serial monitors (#3190)
* main: allow setting the baud rate for serial monitors with default baudrate of 115200 bps
Diffstat (limited to 'monitor.go')
-rw-r--r--monitor.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/monitor.go b/monitor.go
index ec433bb7a..74f5c219c 100644
--- a/monitor.go
+++ b/monitor.go
@@ -32,10 +32,15 @@ func Monitor(port string, options *compileopts.Options) error {
break
}
+ br := options.BaudRate
+ if br <= 0 {
+ br = 115200
+ }
+
wait = 300
var p serial.Port
for i := 0; i <= wait; i++ {
- p, err = serial.Open(port, &serial.Mode{})
+ p, err = serial.Open(port, &serial.Mode{BaudRate: br})
if err != nil {
if i < wait {
time.Sleep(10 * time.Millisecond)