4 ms·
Especially for embedded work (but for regular software too!) I've bought into the "sans-io pattern" for a lot of the software i write anymore https://sans-io.r
by bigfishrunning 3mo ago
Especially for embedded work (but for regular software too!) I've bought into the "sans-io pattern" for a lot of the software i write anymore
https://sans-io.readthedocs.io/how-to-sans-io.html https://sans-io.readthedocs.io/how-to-sans-io.html
Keeping all of the actual hardware/network/io interface code separate really makes writing unit tests and porting to different computers much simpler
- tylerc230 3mo agoI do something similar. I have all my esp/idf code in one crate and all my business logic in a separate crate. The business crate has no dependencies that won’t compile/run on the host. This is where all my tests live.
- sensora 3mo ago[flagged]
- tredre3 3mo agoThis is good advice however it should be noted that many of espressif's other purely software components depend on esp-hal, so you still want it to compile if you use any of espressif's provided components.
- waterTanuki 3mo agoInteresting pattern but it sounds like it's fundamentally incompatible with setups using embassy https://embassy.dev/ https://embassy.dev/
- bigfishrunning 3mo agoWhy would that be? one of the nice features of the sans-io pattern is that it seperates your HAL from the program itself; if your state machine says "send a network packet", send it using embassy (or tokio or bsd-sockets or whatever). The underlying libraries have little or no bearing on "write your program as a big synchronous state-machine" same goes for "wait 10 ms" or "change this gpio pin".