atmega32u4-usb-serial

Rust USB serial driver crate for atmega32u4 based on FFI bindings for Teensy AVR-C library

MIT License

Stars
5

Atmega32u4 USB Serial Crate

This is a Rust crate for the Atmega32u4 microcontroller. It implements a CDC ACM USB serial device using the Teensy AVR C library.

This crate provides a UsbSerial struct that implements the embedded_hal serial Read and Write traits. It also implements the ufmt uWrite trait.

To build

Use a nightly compiler version with AVR support by appending +nightly to each cargo command, or running rustup override set nightly once in the crate directory.

Run cargo build.

To use

To upload the echo.rs example to a connected Arduino Leonardo board, run cargo run --example echo. Open the virtual serial port with a serial terminal and enter lowercase characters. They should be repeated back in uppercase.

Look at src/lib.rs and examples/echo.rs to see how to use the available USB serial methods.