Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ATtiny404 #111

Merged
merged 1 commit into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ attiny167 = ["device-selected"]
attiny202 = ["device-selected"]
attiny2313 = ["device-selected"]
attiny2313a = ["device-selected"]
attiny404 = ["device-selected"]
attiny816 = ["device-selected"]
attiny84 = ["device-selected"]
attiny841 = ["device-selected"]
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
all: deps chips

CHIPS := at90usb1286 atmega1280 atmega1284p atmega128rfa1 atmega164pa atmega168 atmega2560 atmega8 atmega8u2 atmega328p atmega328pb atmega32u4 atmega4809 atmega48p atmega64 atmega644 attiny13a attiny202 attiny2313 attiny2313a attiny84 attiny85 attiny88 attiny816 attiny841 attiny861 attiny167 attiny1614
CHIPS := at90usb1286 atmega1280 atmega1284p atmega128rfa1 atmega164pa atmega168 atmega2560 atmega8 atmega8u2 atmega328p atmega328pb atmega32u4 atmega4809 atmega48p atmega64 atmega644 attiny13a attiny202 attiny2313 attiny2313a attiny404 attiny84 attiny85 attiny88 attiny816 attiny841 attiny861 attiny167 attiny1614

RUSTUP_TOOLCHAIN ?= nightly

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Via the feature you can select which chip you want the register specifications f
| `atmega128rfa1` | | | | `attiny1614`|
| `atmega2560` | | | | `attiny2313`|
| `atmega164pa` | | | | `attiny2313a`|
| | | | | `attiny404` |

## Build Instructions
The version on `crates.io` is pre-built. The following is only necessary when trying to build this crate from source.
Expand Down
4 changes: 4 additions & 0 deletions patch/attiny404.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_svd: ../svd/attiny404.svd

_include:
- common/attiny-0-series.yaml
19 changes: 19 additions & 0 deletions src/devices/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,25 @@ impl attiny2313a::Peripherals {
}
}

/// [ATtiny404](https://www.microchip.com/en-us/product/ATTINY404)
#[cfg(feature = "attiny404")]
pub mod attiny404;

#[cfg(feature = "attiny404")]
impl attiny404::Peripherals {
/// Returns all the peripherals *once*
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { attiny404::Peripherals::steal() })
}
})
}
}

/// [ATtiny816](https://www.microchip.com/wwwproducts/en/ATtiny816)
#[cfg(feature = "attiny816")]
pub mod attiny816;
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#![cfg_attr(feature = "attiny202", doc = "**attiny202**,")]
#![cfg_attr(feature = "attiny2313", doc = "**attiny2313**,")]
#![cfg_attr(feature = "attiny2313a", doc = "**attiny2313a**,")]
#![cfg_attr(feature = "attiny404", doc = "**attiny404**,")]
#![cfg_attr(feature = "attiny816", doc = "**attiny816**,")]
#![cfg_attr(feature = "attiny84", doc = "**attiny84**,")]
#![cfg_attr(feature = "attiny841", doc = "**attiny841**,")]
Expand Down Expand Up @@ -57,6 +58,7 @@
//! `attiny202`,
//! `attiny2313`,
//! `attiny2313a`,
//! `attiny404`,
//! `attiny816`,
//! `attiny84`,
//! `attiny841`,
Expand Down Expand Up @@ -262,6 +264,8 @@ pub use crate::devices::attiny202;
pub use crate::devices::attiny2313;
#[cfg(feature = "attiny2313a")]
pub use crate::devices::attiny2313a;
#[cfg(feature = "attiny404")]
pub use crate::devices::attiny404;
#[cfg(feature = "attiny816")]
pub use crate::devices::attiny816;
#[cfg(feature = "attiny84")]
Expand Down
Loading