News for hackers. Stuff that matters.
Re:The Rust on ESP Book by bigfishrunning on Wednesday July 29, 2026 @01:49PM (#49100703)
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

Keeping all of the actual hardware/network/io interface code separate really makes writing unit tests and porting to different computers much simpler

Re:The Rust on ESP Book by tylerc230 on Wednesday July 29, 2026 @02:18PM (#49101058)
I 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.
Re:The Rust on ESP Book by tredre3 on Wednesday July 29, 2026 @02:19PM (#49101079)
This 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.
Re:The Rust on ESP Book by waterTanuki on Wednesday July 29, 2026 @09:45PM (#49105259)
Interesting pattern but it sounds like it's fundamentally incompatible with setups using embassy

https://embassy.dev/

Re:The Rust on ESP Book by bigfishrunning on Thursday July 30, 2026 @08:39AM (#49109198)
Why 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".