all: rewrite sleep function

time.Sleep now compiles on all systems, so lets use that.
Additionally, do a few improvements in time unit handling for the
scheduler. This should lead to somewhat longer sleep durations without
wrapping (on some platforms).

Some examples got smaller, some got bigger. In particular, code using
the scheduler got bigger and the blinky1 example got smaller (especially
on Arduino: 380 -> 314 bytes).
This commit is contained in:
Ayke van Laethem
2018-09-15 01:08:31 +02:00
parent 1ac67cf8de
commit 2a20c0c7f0
12 changed files with 75 additions and 72 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ package main
import (
"machine"
"runtime"
"time"
)
// This example assumes that the button is connected to pin 8. Change the value
@@ -23,6 +23,6 @@ func main() {
led.High()
}
runtime.Sleep(runtime.Millisecond * 10)
time.Sleep(time.Millisecond * 10)
}
}