mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 06:53:40 +00:00
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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user