Low level access to ATmega32U4 registers in Rust

Overview

Deprecation Note:

This crate will soon be deprecated in favor of avr-device.

The approach of generating the svd from hand-written register definitions has proven to be way to tedious to be scalable. In avr-device, we base our work on atdf files provided by Atmel(Microchip). This allows much faster growth of the list of supported devices (and peripherals). Please head over there if you want a register-access-crate for AVR microcontrollers.


ATmega32U4 crates.io page docs.rs

Low level access to ATmega32U4 registers. Refer to the ATmega32U4 datasheet for more detailed information.

Implemented Peripherals

This crate not yet done and support for a lot of peripherals is still missing. The following have been implemented already:

  • PORTB: Digital IO
  • PORTC: Digital IO
  • PORTD: Digital IO
  • PORTE: Digital IO
  • PORTF: Digital IO
  • TIMER0: 8-bit Timer/Counter0 with PWM
  • TIMER1: 16-bit Timer/Counter1
  • TIMER3: 16-bit Timer/Counter3
  • TIMER4: 10-bit High Speed Timer/Counter4
  • EXT_INT: External Interrupts
  • USB: USB Controller

If support for a peripheral you need is missing, please open an issue or implement it yourself and send a pull request ;)

Generating this crate

This crate is built using svd2rust. However, as there are no svd files available for ATmega32U4, a python script is used to generate the svd file. Take a look at gen-svd.py and svd/peripheral.py.

Peripherals can be specified in a toml format which should make adding new ones easier. Use the existing ones as reference (eg. svd/timer0.svd).

To actually perform a build, run build.sh.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

You might also like...
High level rust abstractions for the libretro API

libretro-rs Design Philosophy The approach to this crate can best be summarized as wanting to expose all functionality, even if not idiomatically. The

Mononym is a library for creating unique type-level names for each value in Rust.

Mononym is a library for creating unique type-level names for each value in Rust.

High-level documentation for rerun

rerun-docs This is the high-level documentation for rerun that is hosted at https://www.rerun.io/docs Other documentation API-level documentation for

k-mer counter in Rust using the rust-bio and rayon crates

krust is a k-mer counter written in Rust and run from the command line that will output canonical k-mers and their frequency across the records in a f

Experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code

Diplomat is an experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code. With Diplomat, you can simply define Rust APIs to be exposed over FFI and get high-level C, C++, and JavaScript bindings automatically!

Aws-sdk-rust - AWS SDK for the Rust Programming Language

The AWS SDK for Rust This repo contains the new AWS SDK for Rust (the SDK) and its public roadmap. Please Note: The SDK is currently released as a dev

Rust + Yew + Axum + Tauri, full-stack Rust development for Desktop apps.

rust-yew-axum-tauri-desktop template Rust + Yew + Axum + Tauri, full-stack Rust development for Desktop apps. Crates frontend: Yew frontend app for de

A lightning fast version of tmux-fingers written in Rust, copy/pasting tmux like vimium/vimperator
A lightning fast version of tmux-fingers written in Rust, copy/pasting tmux like vimium/vimperator

tmux-thumbs A lightning fast version of tmux-fingers written in Rust for copy pasting with vimium/vimperator like hints. Usage Press ( prefix + Space

A command-line tool collection to assist development written in RUST

dtool dtool is a command-line tool collection to assist development Table of Contents Description Usage Tips Installation Description Now dtool suppor

Comments
  • Support for different atmega controllers

    Support for different atmega controllers

    Hi, and thanks for creating this useful crate; especially the svd generator. I've started working on modifying this library so it can support the atmega1280 mcu. It will obviously need a different svd, but at the same time it will use the same kind of interrupt logic etc. The question here is, would it not be better to move the atmega core logic out of this crate into an atmega crate?

    opened by peacememories 47
  • svd2rust doesn't print any output

    svd2rust doesn't print any output

    When feeding the generated svd file into svd2rust (version 0.14.0) it prints no output at all. I'm not sure if this is a problem with svd2rust or with the generated svd file.

    opened by peacememories 1
  • Update interrupt macro to match cortex-m-rt

    Update interrupt macro to match cortex-m-rt

    I think it is worth it to have a similar API surface to cortex-m-rt, since it seems to be the most popular embedded abstraction in rust at the moment. The crate uses procmacros to define attributes (like #[interrupt]) instead of macro_rules!, which might result in some slightly cleaner code.

    Of course this would mean creating an additional crate, since afaik procmacro crates cannot expose anything else.

    opened by peacememories 1
Releases(v0.1.3)
  • v0.1.3(Oct 1, 2018)

    Changed

    • Made a few registers safe to write

    Added

    • Enumerated values for Compare Output Mode & Clock Source
    • Internal: Add safe flag for registers and fields
    Source code(tar.gz)
    Source code(zip)
  • v0.1.2(Sep 26, 2018)

    • Support for interrupt! macro to define custom interrupt handlers
    • USB and EXT_INT peripherals
    • Internal: Support for defining enumerated values in toml format
    • Internal: Support for custom xml in toml format
    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Sep 26, 2018)

    Bare minimum version, contains support for the following peripherals:

    • [x] PORTB: Digital IO
    • [x] PORTC: Digital IO
    • [x] PORTD: Digital IO
    • [x] PORTE: Digital IO
    • [x] PORTF: Digital IO
    • [x] TIMER0: 8-bit Timer/Counter0 with PWM
    • [x] TIMER1: 16-bit Timer/Counter1
    • [x] TIMER3: 16-bit Timer/Counter3
    • [x] TIMER4: 10-bit High Speed Timer/Counter4
    Source code(tar.gz)
    Source code(zip)
Owner
Rahix
Rahix
A Rust framework to develop and use plugins within your project, without worrying about the low-level details.

VPlugin: A plugin framework for Rust. Website | Issues | Documentation VPlugin is a Rust framework to develop and use plugins on applications and libr

VPlugin 11 Dec 31, 2022
A low-ish level tool for easily writing and hosting WASM based plugins.

A low-ish level tool for easily writing and hosting WASM based plugins. The goal of wasm_plugin is to make communicating across the host-plugin bounda

Alec Deason 62 Sep 20, 2022
A low-level I/O ownership and borrowing library

This library introduces OwnedFd, BorrowedFd, and supporting types and traits, and corresponding features for Windows, which implement safe owning and

Dan Gohman 74 Jan 2, 2023
Rust crate which provides direct access to files within a Debian archive

debarchive This Rust crate provides direct access to files within a Debian archive. This crate is used by our debrep utility to generate the Packages

Pop!_OS 11 Dec 18, 2021
SubStrings, Slices and Random String Access in Rust

SubStrings, Slices and Random String Access in Rust This is a simple way to do it. Description Rust string processing is kind of hard, because text in

João Nuno Carvalho 2 Oct 24, 2021
Rust wrapper for the Google Places API. Access their hundreds of millions of places, reviews, and ratings.

Google Places API Working Examples cargo run --example nearby_search cargo run --example place_details cargo run --example find_place cargo run --exam

Jared Ucherek 4 Jun 12, 2023
Register access crate for AVR microcontrollers

avr-device Auto-generated wrappers around registers for AVR microcontrollers. Usage Add the following to Cargo.toml: [dependencies.avr-device] version

Rahix 103 Dec 23, 2022
A simple interpreter for the mathematical random-access machine

Random-access machine runner A simple Rust RAM program runner. Lexer/Parser Program executor Code formatter Web Compiled to WASM to run in the browser

Marcin Wojnarowski 5 Jan 14, 2023
Rust mid-level IR Abstract Interpreter

MIRAI MIRAI is an abstract interpreter for the Rust compiler's mid-level intermediate representation (MIR). It is intended to become a widely used sta

Facebook Experimental 793 Jan 2, 2023
A high level diffing library for rust based on diffs

Similar: A Diffing Library Similar is a dependency free crate for Rust that implements different diffing algorithms and high level interfaces for it.

Armin Ronacher 617 Dec 30, 2022