I’m used to write programs for wavecom modules as tied together timers. It looks to me like the only way to make pauses between some actions. Is it right? Now I’m using SPI exchange with external processor and I have to organize process as:
- Write SPI data
- Pause for a while (10 ms is enough)
- Read SPI data
Now with wavecom’s timers I’ve got a very messy code which looks like timer to write data, timer called from within write for delay, timer called from delay to read data. Or a bit better option to have an FSM like timer calling itself and using STEP variable to pass from one step of algorithm to another.
I cannot use WHILE loops to make a pause from read to write since it blocks the entire module and I do not see a way to give execution to OS while staying in the while loop.
What can I do to make my program look better and what is the way to organize short and long delays in OpenAT?