Skip to content

Commit

Permalink
Add ATmega16U2 and ATmega32U2
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharytomlinson authored and Rahix committed Jan 4, 2025
1 parent 410a7e9 commit 066a428
Show file tree
Hide file tree
Showing 9 changed files with 2,210 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ atmega1284p = ["device-selected"]
atmega128a = ["device-selected"]
atmega128rfa1 = ["device-selected"]
atmega16 = ["device-selected"]
atmega16u2 = ["device-selected"]
atmega164pa = ["device-selected"]
atmega168 = ["device-selected"]
atmega2560 = ["device-selected"]
Expand All @@ -41,6 +42,7 @@ atmega4808 = ["device-selected"]
atmega4809 = ["device-selected"]
atmega48p = ["device-selected"]
atmega32a = ["device-selected"]
atmega32u2 = ["device-selected"]
atmega32u4 = ["device-selected"]
atmega64 = ["device-selected"]
atmega644 = ["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 atmega128a atmega128rfa1 atmega16 atmega164pa atmega168 atmega2560 atmega8 atmega8u2 atmega324pa atmega328p atmega328pb atmega32a atmega32u4 atmega4808 atmega4809 atmega48p atmega64 atmega644 atmega88p attiny13a attiny202 attiny212 attiny214 attiny2313 attiny2313a attiny26 attiny402 attiny404 attiny412 attiny414 attiny416 attiny44a attiny84 attiny85 attiny88 attiny816 attiny828 attiny841 attiny84a attiny861 attiny167 attiny1614 avr64du32 avr64du28
CHIPS := at90usb1286 atmega1280 atmega1284p atmega128a atmega128rfa1 atmega16 atmega164pa atmega168 atmega16u2 atmega2560 atmega8 atmega8u2 atmega324pa atmega328p atmega328pb atmega32a atmega32u2 atmega32u4 atmega4808 atmega4809 atmega48p atmega64 atmega644 atmega88p attiny13a attiny202 attiny212 attiny214 attiny2313 attiny2313a attiny26 attiny402 attiny404 attiny412 attiny414 attiny416 attiny44a attiny84 attiny85 attiny88 attiny816 attiny828 attiny841 attiny84a attiny861 attiny167 attiny1614 avr64du32 avr64du28

RUSTUP_TOOLCHAIN ?= nightly

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Via the feature you can select which chip you want the register specifications f
| ATmega | ATmega USB | ATmega 0,1 Series | AT90 | ATtiny |
| :-------------: | :----------: | :---------------: | :-----------: | :-----------: |
| `atmega8` | `atmega8u2` | `atmega4808` | `at90usb1286` | `attiny13a` |
| `atmega48p` | `atmega32u4` | `atmega4809` | | `attiny167` |
| `atmega64` | `avr64du32` | | | `attiny202` |
| `atmega644` | `avr64du28` | | | `attiny212` |
| `atmega88p` | | | | `attiny214` |
| `atmega16` | | | | `attiny402` |
| `atmega48p` | `atmega16u2` | `atmega4809` | | `attiny167` |
| `atmega64` | `atmega32u2` | | | `attiny202` |
| `atmega644` | `atmega32u4` | | | `attiny212` |
| `atmega88p` | `avr64du32` | | | `attiny214` |
| `atmega16` | `avr64du28` | | | `attiny402` |
| `atmega168` | | | | `attiny404` |
| `atmega324pa` | | | | `attiny412` |
| `atmega328p` | | | | `attiny414` |
Expand Down
16 changes: 16 additions & 0 deletions patch/atmega16u2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
_svd: ../svd/atmega16u2.svd

_include:
- "common/ac.yaml"
- "common/eeprom.yaml"
- "common/spi.yaml"
- "common/usart.yaml"
- "common/wdt.yaml"

- "timer/atmega8u2.yaml"

PLL:
PLLCSR:
_modify:
PLOCK:
access: read-only
16 changes: 16 additions & 0 deletions patch/atmega32u2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
_svd: ../svd/atmega32u2.svd

_include:
- "common/ac.yaml"
- "common/eeprom.yaml"
- "common/spi.yaml"
- "common/usart.yaml"
- "common/wdt.yaml"

- "timer/atmega8u2.yaml"

PLL:
PLLCSR:
_modify:
PLOCK:
access: read-only
8 changes: 8 additions & 0 deletions src/devices/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ pub mod atmega164pa;
#[cfg(feature = "atmega168")]
pub mod atmega168;

/// [ATmega16u2](https://www.microchip.com/wwwproducts/en/ATmega16u2)
#[cfg(feature = "atmega16u2")]
pub mod atmega16u2;

/// [ATmega2560](https://www.microchip.com/wwwproducts/en/ATmega2560)
#[cfg(feature = "atmega2560")]
pub mod atmega2560;
Expand All @@ -55,6 +59,10 @@ pub mod atmega328pb;
#[cfg(feature = "atmega32a")]
pub mod atmega32a;

/// [ATmega32u2](https://www.microchip.com/wwwproducts/en/ATmega32u2)
#[cfg(feature = "atmega32u2")]
pub mod atmega32u2;

/// [ATmega32U4](https://www.microchip.com/wwwproducts/en/ATmega32U4)
#[cfg(feature = "atmega32u4")]
pub mod atmega32u4;
Expand Down
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
#![cfg_attr(feature = "atmega16", doc = "**atmega16**,")]
#![cfg_attr(feature = "atmega164pa", doc = "**atmega164pa**,")]
#![cfg_attr(feature = "atmega168", doc = "**atmega168**,")]
#![cfg_attr(feature = "atmega16u2", doc = "**atmega16u2**,")]
#![cfg_attr(feature = "atmega2560", doc = "**atmega2560**,")]
#![cfg_attr(feature = "atmega8", doc = "**atmega8**,")]
#![cfg_attr(feature = "atmega8u2", doc = "**atmega8u2**,")]
#![cfg_attr(feature = "atmega324pa", doc = "**atmega324pa**,")]
#![cfg_attr(feature = "atmega328p", doc = "**atmega328p**,")]
#![cfg_attr(feature = "atmega328pb", doc = "**atmega328pb**,")]
#![cfg_attr(feature = "atmega32a", doc = "**atmega32a**,")]
#![cfg_attr(feature = "atmega32u2", doc = "**atmega32u2**,")]
#![cfg_attr(feature = "atmega32u4", doc = "**atmega32u4**,")]
#![cfg_attr(feature = "atmega4808", doc = "**atmega4808**,")]
#![cfg_attr(feature = "atmega4809", doc = "**atmega4809**,")]
Expand Down Expand Up @@ -63,13 +65,15 @@
//! `atmega16`,
//! `atmega164pa`,
//! `atmega168`,
//! `atmega16u2`,
//! `atmega2560`,
//! `atmega8`,
//! `atmega8u2`,
//! `atmega324pa`
//! `atmega328p`,
//! `atmega328pb`,
//! `atmega32a`
//! `atmega32u2`,
//! `atmega32u4`,
//! `atmega4808`,
//! `atmega4809`,
Expand Down Expand Up @@ -232,11 +236,13 @@ compile_error!(
* atmega16
* atmega164pa
* atmega168
* atmega16u2
* atmega2560
* atmega324pa
* atmega328p
* atmega328pb
* atmega32a
* atmega32u2
* atmega32u4
* atmega4808
* atmega4809
Expand Down Expand Up @@ -292,6 +298,8 @@ pub use crate::devices::atmega16;
pub use crate::devices::atmega164pa;
#[cfg(feature = "atmega168")]
pub use crate::devices::atmega168;
#[cfg(feature = "atmega16u2")]
pub use crate::devices::atmega16u2;
#[cfg(feature = "atmega2560")]
pub use crate::devices::atmega2560;
#[cfg(feature = "atmega324pa")]
Expand All @@ -302,6 +310,8 @@ pub use crate::devices::atmega328p;
pub use crate::devices::atmega328pb;
#[cfg(feature = "atmega32a")]
pub use crate::devices::atmega32a;
#[cfg(feature = "atmega32u2")]
pub use crate::devices::atmega32u2;
#[cfg(feature = "atmega32u4")]
pub use crate::devices::atmega32u4;
#[cfg(feature = "atmega4808")]
Expand Down
Loading

0 comments on commit 066a428

Please sign in to comment.