Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit abc478c

Browse files
deadprogramaykevl
authored andcommittedFeb 27, 2021
Revert "Allow interrupts in stm32f103xx (#1466)" as discussed in #1608
This reverts commit 3bb994d.
1 parent 66f7683 commit abc478c

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed
 

‎src/runtime/runtime_stm32f103.go

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ func sleepTicks(d timeUnit) {
120120
for d != 0 {
121121
ticks() // update timestamp
122122
ticks := uint32(d) // current scaling only supports 100 usec to 6553 msec
123-
if !timerSleep(ticks) {
124-
return
125-
}
123+
timerSleep(ticks)
126124
d -= timeUnit(ticks)
127125
}
128126
}
@@ -143,8 +141,7 @@ func ticks() timeUnit {
143141
}
144142

145143
// ticks are in microseconds
146-
// returns false if an interrupt occured
147-
func timerSleep(ticks uint32) bool {
144+
func timerSleep(ticks uint32) {
148145
timerWakeup.Set(0)
149146

150147
// STM32 timer update event period is calculated as follows:
@@ -191,19 +188,10 @@ func timerSleep(ticks uint32) bool {
191188
// Enable the timer.
192189
stm32.TIM3.CR1.SetBits(stm32.TIM_CR1_CEN)
193190

194-
wait:
195-
arm.Asm("wfi")
196-
if timerWakeup.Get() != 0 {
197-
return true
191+
// wait till timer wakes up
192+
for timerWakeup.Get() == 0 {
193+
arm.Asm("wfi")
198194
}
199-
200-
if hasScheduler {
201-
return false
202-
} else {
203-
// keep looping until the routine exits or is interrupted
204-
goto wait
205-
}
206-
207195
}
208196

209197
func handleTIM3(interrupt.Interrupt) {

0 commit comments

Comments
 (0)
Please sign in to comment.