Example crate for the CH32V203 version of Adafruit's QT Py.
Instructions | Board Info | Dependencies
Support for the CH32 series of chips has become surprisingly good recently thanks to lots of great work to bring support for these and many other microcontrollers. These 32-bit chips are super cheap, small, fairly full-featured, and relatively fast, with the caveat that support and documentation for them tends to be more limited than other microcontrollers.
There are a few good reasons to use Rust over something like the Arduino framework for 32-bit platforms. Efficiency, better compile-time guarantees, a more modern language, more modern and flexible tooling, access to the Rust no_std ecosystem, a solid HAL, and async with Embassy all contribute to solid low level access and better high level control. A simple but more explicit build system, code that's no more complex, and barely more boilerplate (mostly more explicit dependencies than arduino standard libraries or importing whole .h files) mean not much cost by the programer for these benefits. Only 10kb are flashed for this program, 3x less than the 30kb for the comparable Arduino program.
Note
This crate currently relies on a nightly toolchain and some early development crates
- Make sure you have Rust installed
- Clone this repo using
git clone https://github.com/fourMew/neopixel_qtpy.git - Install wchisp and its dependencies according to the instructions in their repo to use for flashing the program
- While holding down BOOT (the inner button), reset your board, either by connecting to USB or pressing the RST (outer) button
- Verify your chip is connected with
wchisp showand usecargo run --releaseto compile and flash the program. Therust-toolchain.tomlfile should take care of getting the appropriate toolchain for you.
Important
Always compile using the release profile to ensure your program is small enough to fit in flash
ch32_hal: Hardware Abstraction Layer providing convenient, unified, and safe bindings to low level hardwaresmart_leds: Thin layer for convenient LED control and thews2812-delaydriver from rappet based on delay from the hal- a few odds and ends from core and the necessary hardware libraries