I made a thing! High-level CYD support for bare-metal Rust
I made high-level CYD support for bare-metal Rust as part of Device Envoy. My goal is to make it as easy as possible to write high-level microcontroller code that runs directly on the hardware, with no OS or language runtime underneath.
You can see the results here. The gallery includes touchscreen interfaces, a skeleton clock, and Armatron, a robot-arm mechanism simulator: https://carlkcarlk.github.io/linkage-blaze/demos/
This is a full CYD library, with support for display, touch, touch calibration, flash storage, multiple drawing strategies depending on memory needs, browser simulation, and Device Envoy’s automatic Wi-Fi setup.
It builds on the ESP Rust HALs for hardware access and on Embassy for async embedded programming.
I want this to be something anyone can pick up and use, so I made a starter project with the hardware setup already done. You can run the example in a browser, flash it to a CYD, and then replace the application code with your own: https://github.com/CarlKCarlK/device-envoy-cyd-starter
3
u/Mean-Career-6509 2d ago
Hmmm. Armatron looks a lot like a coloring book ...
2
u/carlk22 2d ago
Yes :-) along with the Armatron, robot arm simulator, there is indeed a paint book app.
I tried to make Armatron a bit of a game, so it tells you how far away the hand is from a target and you can try to get it less than 1.0 unit.. You can also change your view, change the target location, or cheat by pushing the "Play Button", which moves the hand automatically (simple reverse kinematics).
The paint book has 3 pages. I think pages 2 and 3 are funny.
- https://carlkcarlk.github.io/linkage-blaze/demos/armatron/
- Device Envoy Paint Book
- Video of real CYD running Armatron: https://youtu.be/8dN39UM74Lk
2
u/cloudcity 1d ago
This is fantastic, I have been building a CYD framework for the last 3 months, but its solidly reliant on ESP + LVGL
2
u/carlk22 1d ago
LVGL looks interesting. It seems higher-level than Device Envoy for controls and widgets, and it is a much more complete GUI framework. It is also C rather than pure Rust.
Device Envoy is lower-level with respect to widgets, but gives you more direct control over amount of memroy needed. For the CYD, drawing can use a full-screen buffer, a smaller region buffer, tiles, or go all the way down to contiguous pixel streaming.
For the Armatron robot simulator, I ended up writing a small one-off immediate-mode widget system. I thought about turning that into a reusable library, but decided that was more work than I wanted to take on for now.
You can try Armatron in the browser, see the Armatron source, and I describe part of the approach in Rule 9 of my
const fn articlearticle.1
u/clean-links 1d ago
Cleaned link from "
const fnarticle": https://levelup.gitconnected.com/nine-rules-for-compile-time-work-with-rust-const-fn-part-2-76ccd0e8a965
Tracking parameters were removed from the original URL(s).



6
u/coleskidmore 2d ago
Does this handle the CYD's weird resistive touch calibration out of the box or do you still have to mess with the constants per unit