A minimal implementation of a USB volume knob, utilizing a rotary encoder (volume increment, decrement) with a switch (mute). This firmware targets the specially crafted volume.control board, which is based on the RP2040 MCU.
The firmware itself is based solely on embedded Rust, and makes use of the Real-Time Interrupt-Driven Concurrency, or RTIC framework.
The host volume is controlled in the same way as it is controlled by keyboard media keys - by presenting the host with a USB-HID device, and dispatching Consumer Control HID reports indicating the Volume Increment 0xE9
, Volume Decrement 0xEA
and Mute 0xE2
Usage IDs.
USB-HID functionality is provided by @dlkj's usbd-human-interface-device library, and by implementing a minimal, single-byte report descriptor:
The latest firmware release can be found in the releases page.
To flash a new firmware to the volume.control board - keep the mute button pressed while plugging the volume.control into your host USB.
The device should boot into PICOBOOT
mode, which allows for updates using picotool.
Building the firmware yourself is kept simple thanks to Cargo and elf2uf-rs:
➜ ~ git clone https://github.com/0xa10/volume.control
➜ volume.control git:(main) ✗ cargo build --release
Finished release [optimized] target(s) in 0.03s
➜ volume.control git:(main) ✗ elf2uf2-rs target/thumbv6m-none-eabi/release/volume-control volume-control.uf2
In case flashing fails catastrophically, or for some other reason the device does not boot into the application or PICOBOOT
mode - it is possible to force it into BOOTSEL
mode, by shorting the small pad on the top left corner of the board (orange arrow) to any ground pad (gray arrows) with a paper clip or conductor of your choice - whilst plugging into the USB port.
This will cause the volume.control board to boot to BOOTSEL
mode, in which both the PICOBOOT
interface and a Mass Storage Device interface will be available, allowing you to update it like you would a Raspberry Pi Pico or any equivalent board with a BOOTSEL
button.
pini//grigio
2022