by butterisgood · 5y ago · 0 comments
https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
which inspired: http://dunkels.com/adam/pt/
And that stuff is just neat!
switch (foo) {
if (0) {
case X:
/* X-specific code */
} else {
case Y:
/* Y-specific code */
}
/* common code for X and Y */
break;
}Do not recommend.
If I had my time again, I would do it with a explicit state machine that runs in the I2C interrupt handler, and a submission and response queue accessed by the main app loop (the equivalent of "userland" for non-embedded folks).