mbeddr.arduino icon indicating copy to clipboard operation
mbeddr.arduino copied to clipboard

none busy wait

Open coolya opened this issue 12 years ago • 1 comments
trafficstars

split the linear code into different functions. Analyse the uses variables in the code after the wait and create global variables for these replace all referencens to the local once with the global. Set a timer interrupt for the the desired sleep time, store the callback to the second part of the execution (the second function) in some global variable. send the controller to sleep. In the interrupt handler jump to the second part of the execution, by calling the function pointer placed in the global variable.

coolya avatar Apr 20 '13 18:04 coolya

Basicly this just needs a simple sleep mode statement, since the stack is restored after a wakeup from a interrupt. What needs to be done is to simply setup a timer to wake the device aber a given time. Maybe we can use some kind of scheduler for this in combination with long jumps.

coolya avatar Sep 13 '13 20:09 coolya