From 41c74f40bda4371c7701211b9631df124e1e7929 Mon Sep 17 00:00:00 2001 From: khimaros Date: Wed, 28 Oct 2020 20:36:14 -0700 Subject: [PATCH] Add AT90USB1286 support Ref: #80 --- Cargo.toml | 1 + Makefile | 2 +- README.md | 1 + patch/at90usb1286.yaml | 8 + src/devices/mod.rs | 19 + src/lib.rs | 4 + vendor/at90usb1286.atdf | 1229 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 1263 insertions(+), 1 deletion(-) create mode 100644 patch/at90usb1286.yaml create mode 100644 vendor/at90usb1286.atdf diff --git a/Cargo.toml b/Cargo.toml index 814a9df..762b549 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ all-features = true [features] device-selected = [] +at90usb1286 = ["device-selected"] atmega1280 = ["device-selected"] atmega168 = ["device-selected"] atmega2560 = ["device-selected"] diff --git a/Makefile b/Makefile index ba3532a..ef55b54 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: deps chips -CHIPS := atmega1280 atmega168 atmega2560 atmega8 atmega8u2 atmega328p atmega328pb atmega32u4 atmega4809 atmega48p atmega64 atmega644 attiny84 attiny85 attiny88 attiny841 attiny861 +CHIPS := at90usb1286 atmega1280 atmega168 atmega2560 atmega8 atmega8u2 atmega328p atmega328pb atmega32u4 atmega4809 atmega48p atmega64 atmega644 attiny84 attiny85 attiny88 attiny841 attiny861 RUSTUP_TOOLCHAIN ?= nightly diff --git a/README.md b/README.md index ede01dd..dc9d773 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ features = ["atmega32u4"] ``` Via the feature you can select which chip you want the register specifications for. The following list is what is currently supported: +* `at90usb1286` * `atmega1280` * `atmega168` * `atmega2560` diff --git a/patch/at90usb1286.yaml b/patch/at90usb1286.yaml new file mode 100644 index 0000000..7ca8b0f --- /dev/null +++ b/patch/at90usb1286.yaml @@ -0,0 +1,8 @@ +_svd: ../svd/at90usb1286.svd + +_include: + - "common/ac.yaml" + - "common/adc.yaml" + - "common/spi.yaml" + - "common/usart.yaml" + - "common/twi.yaml" diff --git a/src/devices/mod.rs b/src/devices/mod.rs index 6f34800..fd18ec8 100644 --- a/src/devices/mod.rs +++ b/src/devices/mod.rs @@ -3,6 +3,25 @@ #[no_mangle] pub(crate) static mut DEVICE_PERIPHERALS: bool = false; +/// [AT90USB1286](https://www.microchip.com/wwwproducts/en/AT90USB1286) +#[cfg(feature = "at90usb1286")] +pub mod at90usb1286; + +#[cfg(feature = "at90usb1286")] +impl at90usb1286::Peripherals { + /// Returns all the peripherals *once* + #[inline] + pub fn take() -> Option { + crate::interrupt::free(|_| { + if unsafe { DEVICE_PERIPHERALS } { + None + } else { + Some(unsafe { at90usb1286::Peripherals::steal() }) + } + }) + } +} + /// [ATmega1280](https://www.microchip.com/wwwproducts/en/ATmega1280) #[cfg(feature = "atmega1280")] pub mod atmega1280; diff --git a/src/lib.rs b/src/lib.rs index 0ecf323..1ebe90c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ //! This crate contains register definitions for +#![cfg_attr(feature = "at90usb1286", doc = "**at90usb1286**,")] #![cfg_attr(feature = "atmega1280", doc = "**atmega1280**,")] #![cfg_attr(feature = "atmega168", doc = "**atmega168**,")] #![cfg_attr(feature = "atmega2560", doc = "**atmega2560**,")] @@ -20,6 +21,7 @@ //! //! Which chips the crate is built for depends on the feature flag used. //! The following chips are available (using feature flags of the same name): +//! * `at90usb1286` //! * `atmega1280` //! * `atmega168` //! * `atmega2560` @@ -111,6 +113,8 @@ compile_error!( #[allow(non_camel_case_types, unused_attributes, unreachable_patterns)] mod devices; +#[cfg(feature = "at90usb1286")] +pub use crate::devices::at90usb1286; #[cfg(feature = "atmega1280")] pub use crate::devices::atmega1280; #[cfg(feature = "atmega168")] diff --git a/vendor/at90usb1286.atdf b/vendor/at90usb1286.atdf new file mode 100644 index 0000000..59c3c7a --- /dev/null +++ b/vendor/at90usb1286.atdf @@ -0,0 +1,1229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 2.49.0