Skip to content

Commit ed20a8b

Browse files
tronjeRahix
authored andcommitted
Add support for ATmega164pa
Adds the ATDF file provided from Microchip, and makes changes analog to 2906134. This has been tested on real hardware. Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Oskar Munz <[email protected]>
1 parent 829131b commit ed20a8b

File tree

7 files changed

+1442
-2
lines changed

7 files changed

+1442
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ at90usb1286 = ["device-selected"]
2727
atmega1280 = ["device-selected"]
2828
atmega1284p = ["device-selected"]
2929
atmega128rfa1 = ["device-selected"]
30+
atmega164pa = ["device-selected"]
3031
atmega168 = ["device-selected"]
3132
atmega2560 = ["device-selected"]
3233
atmega8 = ["device-selected"]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
all: deps chips
22

3-
CHIPS := at90usb1286 atmega1280 atmega1284p atmega128rfa1 atmega168 atmega2560 atmega8 atmega8u2 atmega328p atmega328pb atmega32u4 atmega4809 atmega48p atmega64 atmega644 attiny13a attiny202 attiny2313 attiny2313a attiny84 attiny85 attiny88 attiny816 attiny841 attiny861 attiny167 attiny1614
3+
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
44

55
RUSTUP_TOOLCHAIN ?= nightly
66

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Via the feature you can select which chip you want the register specifications f
2525
| `atmega1284p` | | | | `attiny861` |
2626
| `atmega128rfa1` | | | | `attiny1614`|
2727
| `atmega2560` | | | | `attiny2313`|
28-
| | | | | `attiny2313a`|
28+
| `atmega164pa` | | | | `attiny2313a`|
2929

3030
## Build Instructions
3131
The version on `crates.io` is pre-built. The following is only necessary when trying to build this crate from source.

patch/atmega164pa.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
_svd: ../svd/atmega164pa.svd
2+
3+
_include:
4+
- "common/adc.yaml"
5+
- "common/twi.yaml"
6+
- "common/usart.yaml"
7+
- "common/wdt.yaml"

src/devices/mod.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,25 @@ impl atmega128rfa1::Peripherals {
7979
}
8080
}
8181

82+
/// [ATmega164PA](https://www.microchip.com/en-us/product/ATmega164PA)
83+
#[cfg(feature = "atmega164pa")]
84+
pub mod atmega164pa;
85+
86+
#[cfg(feature = "atmega164pa")]
87+
impl atmega164pa::Peripherals {
88+
/// Returns all the peripherals *once*
89+
#[inline]
90+
pub fn take() -> Option<Self> {
91+
crate::interrupt::free(|_| {
92+
if unsafe { DEVICE_PERIPHERALS } {
93+
None
94+
} else {
95+
Some(unsafe { atmega164pa::Peripherals::steal() })
96+
}
97+
})
98+
}
99+
}
100+
82101
/// [ATmega168](https://www.microchip.com/wwwproducts/en/ATmega168)
83102
#[cfg(feature = "atmega168")]
84103
pub mod atmega168;

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![cfg_attr(feature = "atmega1280", doc = "**atmega1280**,")]
44
#![cfg_attr(feature = "atmega1284p", doc = "**atmega1284p**,")]
55
#![cfg_attr(feature = "atmega128rfa1", doc = "**atmega128rfa1**,")]
6+
#![cfg_attr(feature = "atmega164pa", doc = "**atmega164pa**,")]
67
#![cfg_attr(feature = "atmega168", doc = "**atmega168**,")]
78
#![cfg_attr(feature = "atmega2560", doc = "**atmega2560**,")]
89
#![cfg_attr(feature = "atmega8", doc = "**atmega8**,")]
@@ -38,6 +39,7 @@
3839
//! * `atmega1280`
3940
//! * `atmega1284p`
4041
//! * `atmega128rfa1`
42+
//! * `atmega164pa`
4143
//! * `atmega168`
4244
//! * `atmega2560`
4345
//! * `atmega8`
@@ -116,6 +118,7 @@ compile_error!(
116118
* atmega1280
117119
* atmega1284p
118120
* atmega128rfa1
121+
* atmega164pa
119122
* atmega168
120123
* atmega2560
121124
* atmega328p
@@ -153,6 +156,8 @@ pub use crate::devices::atmega1280;
153156
pub use crate::devices::atmega1284p;
154157
#[cfg(feature = "atmega128rfa1")]
155158
pub use crate::devices::atmega128rfa1;
159+
#[cfg(feature = "atmega164pa")]
160+
pub use crate::devices::atmega164pa;
156161
#[cfg(feature = "atmega168")]
157162
pub use crate::devices::atmega168;
158163
#[cfg(feature = "atmega2560")]

0 commit comments

Comments
 (0)