Skip to content

Comment on Go on Embedded Systems and WebAssemblyparent

Comments

It's really not so different! In embassy, DMA transfers and interrupts become things that you can .await on, the process is basically:

  * The software starts a transaction, or triggers some event (like putting data in the fifo)
  * The software task yields
  * When the "fifo empty" interrupt or "dma transfer done interrupt" occurs, it wakes the task to resume
  * the software task checks if it is done, and either reloads/restarts if there's more to do, or returns "done"
It's really not different than event driven state machines you would have written before, it's just "in-band" of the language now, and async/await gives you syntax to do it.

Even if you don't know Rust, I'd suggest poking around at some of the examples here:

https://github.com/embassy-rs/embassy/tree/main/examples

And if you want, look into the code behind it.

Precisely, I would say embassy is a satisfying middle-point between "baremetal" firmware and running something like FreeRTOS / NuttX that hides the event loop from you.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.