runtime: use waitForEvents when appropriate
This is better than using the wfe or wfi instruction directly as it can be replaced with build tags.
Этот коммит содержится в:
родитель
32c7f3baf9
коммит
b75f042c23
3 изменённых файлов: 3 добавлений и 4 удалений
|
@ -308,7 +308,7 @@ func timerSleep(ticks uint32) bool {
|
|||
sam.RTC_MODE0.INTENSET.SetBits(sam.RTC_MODE0_INTENSET_CMP0)
|
||||
|
||||
wait:
|
||||
arm.Asm("wfe")
|
||||
waitForEvents()
|
||||
if timerWakeup.Get() != 0 {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ func timerSleep(ticks uint32) bool {
|
|||
sam.RTC_MODE0.INTENSET.SetBits(sam.RTC_MODE0_INTENSET_CMP0)
|
||||
|
||||
wait:
|
||||
arm.Asm("wfe")
|
||||
waitForEvents()
|
||||
if timerWakeup.Get() != 0 {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
package runtime
|
||||
|
||||
import (
|
||||
"device/arm"
|
||||
"device/nrf"
|
||||
"machine"
|
||||
"runtime/interrupt"
|
||||
|
@ -114,6 +113,6 @@ func rtc_sleep(ticks uint32) {
|
|||
}
|
||||
nrf.RTC1.CC[0].Set((nrf.RTC1.COUNTER.Get() + ticks) & 0x00ffffff)
|
||||
for rtc_wakeup.Get() == 0 {
|
||||
arm.Asm("wfi")
|
||||
waitForEvents()
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче