From 10b826e311f366ca58a6732912471bfd772514e7 Mon Sep 17 00:00:00 2001 From: Boris Vinogradov Date: Tue, 25 Aug 2020 11:10:45 +0300 Subject: [PATCH] Add basic support for ATmega644 --- Cargo.toml | 1 + Makefile | 2 +- README.md | 1 + patch/atmega644.yaml | 10 + src/devices/mod.rs | 19 + src/lib.rs | 4 + vendor/atmega644.atdf | 1263 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 1299 insertions(+), 1 deletion(-) create mode 100644 patch/atmega644.yaml create mode 100644 vendor/atmega644.atdf diff --git a/Cargo.toml b/Cargo.toml index 8966152..b873d25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ atmega328p = [] atmega48p = [] atmega32u4 = [] atmega64 = [] +atmega644 = [] attiny84 = [] attiny85 = [] attiny88 = [] diff --git a/Makefile b/Makefile index 96fb6eb..73bd16b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: deps chips -CHIPS := atmega1280 atmega168 atmega2560 atmega8 atmega328p atmega32u4 atmega48p atmega64 attiny84 attiny85 attiny88 +CHIPS := atmega1280 atmega168 atmega2560 atmega8 atmega328p atmega32u4 atmega48p atmega64 atmega644 attiny84 attiny85 attiny88 RUSTUP_TOOLCHAIN ?= nightly diff --git a/README.md b/README.md index 20b7c9a..58f348a 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Via the feature you can select which chip you want the register specifications f * `atmega32u4` * `atmega48p` * `atmega64` +* `atmega644` * `attiny84` * `attiny85` * `attiny88` diff --git a/patch/atmega644.yaml b/patch/atmega644.yaml new file mode 100644 index 0000000..d62d515 --- /dev/null +++ b/patch/atmega644.yaml @@ -0,0 +1,10 @@ +_include: + - "common/ac.yaml" + - "common/adc.yaml" + - "common/port.yaml" + - "common/spi.yaml" + - "common/twi.yaml" + - "common/usart.yaml" + - "common/wdt.yaml" + + - "timer/atmega328p.yaml" diff --git a/src/devices/mod.rs b/src/devices/mod.rs index 2b38408..ca4253d 100644 --- a/src/devices/mod.rs +++ b/src/devices/mod.rs @@ -155,6 +155,25 @@ impl atmega64::Peripherals { } } +/// [ATmega644](https://www.microchip.com/wwwproducts/en/ATmega644) +#[cfg(feature = "atmega644")] +pub mod atmega644; + +#[cfg(feature = "atmega644")] +impl atmega644::Peripherals { + /// Returns all the peripherals *once* + #[inline] + pub fn take() -> Option { + crate::interrupt::free(|_| { + if unsafe { DEVICE_PERIPHERALS } { + None + } else { + Some(unsafe { atmega644::Peripherals::steal() }) + } + }) + } +} + /// [ATtiny84](https://www.microchip.com/wwwproducts/en/ATtiny84) #[cfg(feature = "attiny84")] pub mod attiny84; diff --git a/src/lib.rs b/src/lib.rs index 62fbe01..57083f4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,7 @@ #![cfg_attr(feature = "atmega32u4", doc = "**atmega32u4**,")] #![cfg_attr(feature = "atmega48p", doc = "**atmega48p**,")] #![cfg_attr(feature = "atmega64", doc = "**atmega64**,")] +#![cfg_attr(feature = "atmega644", doc = "**atmega644**,")] #![cfg_attr(feature = "attiny84", doc = "**attiny84**,")] #![cfg_attr(feature = "attiny85", doc = "**attiny85**,")] #![cfg_attr(feature = "attiny88", doc = "**attiny88**,")] @@ -86,6 +87,8 @@ pub use crate::devices::atmega32u4; pub use crate::devices::atmega48p; #[cfg(feature = "atmega64")] pub use crate::devices::atmega64; +#[cfg(feature = "atmega644")] +pub use crate::devices::atmega644; #[cfg(feature = "atmega8")] pub use crate::devices::atmega8; #[cfg(feature = "attiny84")] @@ -104,6 +107,7 @@ pub use crate::devices::attiny88; feature = "atmega32u4", feature = "atmega48p", feature = "atmega64", + feature = "atmega644", feature = "attiny84", feature = "attiny85", feature = "attiny88", diff --git a/vendor/atmega644.atdf b/vendor/atmega644.atdf new file mode 100644 index 0000000..c9f9730 --- /dev/null +++ b/vendor/atmega644.atdf @@ -0,0 +1,1263 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 2.49.0