Remove use of CGo in the runtime

CGo depends on syscall, which (in the standard library) depends on sync,
which depends on the runtime. There are also other import cycles. To be
able to use the syscall package from upstream, stop using CGo.
This commit is contained in:
Ayke van Laethem
2018-08-29 19:58:21 +02:00
parent d620f0d188
commit d4f5700625
3 changed files with 26 additions and 17 deletions
+3 -4
View File
@@ -2,14 +2,13 @@
package runtime
// #include "runtime_nrf.h"
import "C"
import (
"device/arm"
"device/nrf"
)
func _Cfunc_rtc_sleep(ticks uint32)
const Microsecond = 1
func init() {
@@ -51,7 +50,7 @@ func sleep(d Duration) {
for ticks64 != 0 {
monotime() // update timestamp
ticks := uint32(ticks64) & 0x7fffff // 23 bits (to be on the safe side)
C.rtc_sleep(C.uint32_t(ticks)) // TODO: not accurate (must be d / 30.5175...)
_Cfunc_rtc_sleep(ticks) // TODO: not accurate (must be d / 30.5175...)
ticks64 -= Duration(ticks)
}
}