3 ms·
You don't need an OS to do more advanced or efficient sleeping. You could have one of the timer peripherals generate an interrupt on a regular basis, and then p
by lochsh 6y ago
You don't need an OS to do more advanced or efficient sleeping. You could have one of the timer peripherals generate an interrupt on a regular basis, and then put the chip in a lower power sleep mode in between interrupts.
- saagarjha 6y agoIsn't that what an OS would do, essentially?
- lochsh 6y agoYes, probably! But you can do it yourself without one. Here is an example in C using libopencm3, that uses timers to trigger an interrupt used to flash LEDs https://github.com/libopencm3/libopencm3-examples/tree/master/examples/stm32/f4/stm32f4-discovery/timer https://github.com/libopencm3/libopencm3-examples/tree/maste...
- als0 6y agoSure, but putting the chip to sleep is one instruction, and programming the timer interval is only about a dozen instructions. So you don't really need an OS in this context.
- yjftsjthsd-h 6y agoThere is a blurry line on the edges of "library" and "OS"; most people would put this particular example on the "library" side.