https://github.com/mogenson/atmega32u4-usb-serial
Rust USB serial driver crate for atmega32u4 based on FFI bindings for Teensy AVR-C library
https://github.com/mogenson/atmega32u4-usb-serial
arduino avr ffi rust rust-embedded usb
Last synced: about 1 year ago
JSON representation
Rust USB serial driver crate for atmega32u4 based on FFI bindings for Teensy AVR-C library
- Host: GitHub
- URL: https://github.com/mogenson/atmega32u4-usb-serial
- Owner: mogenson
- License: mit
- Created: 2020-10-05T20:09:36.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-06T18:02:13.000Z (over 5 years ago)
- Last Synced: 2025-04-01T05:11:51.258Z (about 1 year ago)
- Topics: arduino, avr, ffi, rust, rust-embedded, usb
- Language: C
- Homepage:
- Size: 16.6 KB
- Stars: 9
- Watchers: 4
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://www.pjrc.com/teensy/usb_serial.html).
This crate provides a `UsbSerial` struct that implements the [embedded_hal serial](https://docs.rs/embedded-hal/0.2.4/embedded_hal/serial/index.html) `Read` and `Write` traits. It also implements the [ufmt](https://docs.rs/ufmt/0.1.0/ufmt/trait.uWrite.html) `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.