func setSystick(sysclk int) { if noos.MaxTasks() == 0 { return } // Set tick period to 2 ms (500 context switches per second). const period = 2 systick.SetReload(uint32(sysclk)*(1e6*period/1e3) - 1) noos.SetTickPeriod(period) }
func millisec(ms int) { if noos.MaxTasks() == 0 { panic("no support for delay.Millisec") } period := noos.TickPeriod() if period == 0 { panic("tick period not configured in runtime/noos") } dt := ms / period if dt == 0 { return } to := noos.Ticks() + uint64(dt) for { noos.TickEvent().Wait() if noos.Ticks() >= to { return } } }