Skip to content

Insufficient-Charge/ESP32C-Rust-Embassy-Wokwi

Repository files navigation

Unnamed ESP32C3 Rust-Embassy Project

Authors

  • InsufficientCharge (MyMy)
  • Other awesome devs that will add their usernames in the future

Disclaimer

Finding information about ESP32 Embassy development on Rust often has you pooling through Github repos, which is why I made this public. However, note that I am simply an individual developer.

Current functionality

Follows Apollolabsdev's implementation of GPIO, but modified to activate a singular LED, blinking it on and off while maintaining a count between tasks.

  1. Spins up a task for turning on an LED, waiting one second, and then turning off an LED. Main releases async control every 5 seconds.
  2. Viewable within diagram.json (if you have the VS Code extension for Wokwi) is an ESP32 simulation, connected to an LED and a resistor, where if you run the simulation, should show the functionality in step (1).

Age

Throughout this project, I've found that how old a project is changes what you're capable of implementing with ESP32 Embassy. This repo was developed originally on March 2nd, 2024. Watch the age of the commits; if they're older than 2 years, you may have better luck searching for other Embassy ESP32 WokWi examples.

Example projects

Many Embassy projects out on Github right now have "examples" folders. If other examples are made using the dynamic used to form this repo, they will be linked in this section. Until then, it is empty. I encourage those working alongside me to develop rust-embedded projects to update this README with hyperlinks to their examples.

Goals

  • Run a no_std project on an ESP32 to be simulated and tested with CI on Wokwi
  • Provide a decent example for doing this for other esp32c3+embassy+wokwi projects in the future
  • Have some fun in Rust and see what's possible

Setup

Note the Cargo.toml: as it stands, we need these outdated versions to make everything run in Wokwi. Hopefully this is mended in the future. Outdated crates include:

  • esp32c3-hal
  • embassy-time
  • riscv-rt

Also note: I am using WSL: Ubuntu with rust and cargo installed. Though I have Platform IO installed I am not using it.

Install Rust Embassy

  • To those following along: Within the embassy folder, make a projects file. This is a project. You can pull this repo into your new project directory.

Install Wokwi for VS Code

  • You will need to create a Wokwi account.
  • You will need to enable a community license; this is available for 30 days. I think you can just re-renew it every 30 days; otherwise I'm not sure how anyone gets anything done with Wokwi in a reasonable amount of time.
  • The community edition CANNOT edit the diagram using the tool, only simulate. You can edit diagram.json manually.

If you're intending to setup CI, install Wokwi CI.

  • You can do CI tests using Wokwi's "scenarios".
  • These aren't technically mocks, but they might be a good approach for what we're trying to do for the time being.
  • Scenarios are NOT YET DOCUMENTED. Behold, Wokwi's example scenarios.

How to Run

  1. Use cargo build --release. This will build a binary in the target/ directory.
  2. If you're using a physical device, use cargo run --release. Otherwise, open diagram.json in VS Code (with the Wokwi VS Code extension properly installed), and click the start simulation button (the "play" button).

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages