diff --git a/Cargo.toml b/Cargo.toml index 08b0bc1..b0f0667 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ atmega16 = ["device-selected"] atmega16u2 = ["device-selected"] atmega164pa = ["device-selected"] atmega168 = ["device-selected"] +atmega169pa = ["device-selected"] atmega2560 = ["device-selected"] atmega8 = ["device-selected"] atmega8u2 = ["device-selected"] diff --git a/Makefile b/Makefile index e90eead..3c2a7e0 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: deps chips -CHIPS := at90usb1286 atmega1280 atmega1284p atmega128a atmega128rfa1 atmega16 atmega164pa atmega168 atmega16u2 atmega2560 atmega8 atmega8u2 atmega324pa atmega328p atmega328pb atmega32a atmega32u2 atmega32u4 atmega3208 atmega3209 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 atmega169pa atmega16u2 atmega2560 atmega8 atmega8u2 atmega324pa atmega328p atmega328pb atmega32a atmega32u2 atmega32u4 atmega3208 atmega3209 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 diff --git a/README.md b/README.md index d427a4a..8136b8d 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Via the feature you can select which chip you want the register specifications f | `atmega128rfa1` | | | | `attiny816` | | `atmega2560` | | | | `attiny828` | | `atmega164pa` | | | | `attiny841` | -| | | | | `attiny84a` | +| `atmega169pa` | | | | `attiny84a` | | | | | | `attiny861` | | | | | | `attiny1614` | | | | | | `attiny2313` | diff --git a/patch/atmega169pa.yaml b/patch/atmega169pa.yaml new file mode 100644 index 0000000..6d3006c --- /dev/null +++ b/patch/atmega169pa.yaml @@ -0,0 +1,71 @@ +_svd: ../svd/atmega169pa.svd + +_include: + - "common/ac.yaml" + - "common/adc.yaml" + - "common/spi.yaml" + - "timer/atmega169pa.yaml" + +EXINT: + EIMSK: + _delete: + - PCIE + _add: + PCIE0: + description: "Pin Change Interrupt Enable 0" + bitOffset: 6 + bitWidth: 1 + access: read-write + PCIE1: + description: "Pin Change Interrupt Enable 1" + bitOffset: 7 + bitWidth: 1 + access: read-write + +USART?: + UCSR?B: + _modify: + RXB8?: + access: read-only + UCSR?C: + UCSZ?: + _replace_enum: + CHR5: [0, "Character Size: 5 bit"] + CHR6: [1, "Character Size: 6 bit"] + CHR7: [2, "Character Size: 7 bit"] + CHR8: [3, "Character Size: 8 bit"] + UCPOL?: + _replace_enum: + RISING_EDGE: [0, "Transmit on Rising XCKn Edge, Receive on Falling XCKn Edge"] + FALLING_EDGE: [1, "Transmit on Falling XCKn Edge, Receive on Rising XCKn Edge"] + UMSEL?: + _replace_enum: + USART_ASYNC: [0, "Asynchronous USART"] + USART_SYNC: [1, "Synchronous USART"] + UPM?: + _replace_enum: + DISABLED: [0, "Disabled"] + PARITY_EVEN: [2, "Enabled, Even Parity"] + PARITY_ODD: [3, "Enabled, Odd Parity"] + USBS?: + _replace_enum: + STOP1: [0, "1-bit"] + STOP2: [1, "2-bit"] + +WDT: + WDTCR: + _delete: + - WDP + _add: + WDPL: + description: "Watchdog Timer Prescaler - Low Bits" + bitRange: "[2:0]" + WDPL: + CYCLES_16K: [0, "- 16K (16,384) cycles, ~15ms"] + CYCLES_32K: [1, "- 32K (32,768) cycles, ~29ms"] + CYCLES_64K: [2, "- 64K (65,536) cycles, ~59ms"] + CYCLES_128K: [3, "- 128K (131,072) cycles, ~0.12s"] + CYCLES_256K: [4, "- 256K (262,144) cycles, ~0.23s"] + CYCLES_512K: [5, "- 512K (524,288) cycles, ~0.47s"] + CYCLES_1024K: [6, "- 1024K (1,048,576) cycles, ~0.9s"] + CYCLES_2048K: [7, "- 2048K (2,097,152) cycles, ~1.9s"] diff --git a/patch/timer/atmega169pa.yaml b/patch/timer/atmega169pa.yaml new file mode 100644 index 0000000..1132dad --- /dev/null +++ b/patch/timer/atmega169pa.yaml @@ -0,0 +1,77 @@ +TC0: + TCCR?A: + _delete: + - "WGM??" + _add: + WGM00: + description: Waveform Generation Mode + bitOffset: 6 + bitWidth: 1 + access: read-write + WGM01: + description: Waveform Generation Mode + bitOffset: 3 + bitWidth: 1 + access: read-write + _modify: + COM?A: + description: "Compare Output A Mode" + _write_constraint: enum + FOC??: + access: write-only + COM??: + _replace_enum: + DISCONNECTED: [0, "Normal port operation, OCix disconnected"] + MATCH_TOGGLE: [1, "Toggle OCix on Compare Match (Might depend on WGM)"] + MATCH_CLEAR: [2, "Clear OCix on Compare Match (If PWM is enabled, OCix is set at TOP)"] + MATCH_SET: [3, "Set OCix on Compare Match (If PWM is enabled, OCix is cleared at TOP)"] + CS?: + _replace_enum: + NO_CLOCK: [0, "No clock source (Timer/Counter stopped)"] + DIRECT: [1, "Running, No Prescaling"] + PRESCALE_8: [2, "Running, CLK/8"] + PRESCALE_64: [3, "Running, CLK/64"] + PRESCALE_256: [4, "Running, CLK/256"] + PRESCALE_1024: [5, "Running, CLK/1024"] + EXT_FALLING: [6, "Running, ExtClk Tx Falling Edge"] + EXT_RISING: [7, "Running, ExtClk Tx Rising Edge"] + +TC1: + _include: + - "dev/16bit.yaml" + +TC2: + TCCR?A: + _delete: + - "WGM??" + _add: + WGM20: + description: Waveform Generation Mode + bitOffset: 6 + bitWidth: 1 + access: read-write + WGM21: + description: Waveform Generation Mode + bitOffset: 3 + bitWidth: 1 + access: read-write + _modify: + COM?A: + description: "Compare Output A Mode" + _write_constraint: enum + COM??: + _replace_enum: + DISCONNECTED: [0, "Normal port operation, OCix disconnected"] + MATCH_TOGGLE: [1, "Toggle OCix on Compare Match (Might depend on WGM)"] + MATCH_CLEAR: [2, "Clear OCix on Compare Match (If PWM is enabled, OCix is set at TOP)"] + MATCH_SET: [3, "Set OCix on Compare Match (If PWM is enabled, OCix is cleared at TOP)"] + CS?: + _replace_enum: + NO_CLOCK: [0, "No clock source (Timer/Counter stopped)"] + DIRECT: [1, "Running, No Prescaling"] + PRESCALE_8: [2, "Running, CLK/8"] + PRESCALE_32: [3, "Running, CLK/32"] + PRESCALE_64: [4, "Running, CLK/64"] + PRESCALE_128: [5, "Running, CLK/128"] + PRESCALE_256: [6, "Running, CLK/256"] + PRESCALE_1024: [7, "Running, CLK/1024"] diff --git a/src/devices/mod.rs b/src/devices/mod.rs index 6d5b538..ea0c255 100644 --- a/src/devices/mod.rs +++ b/src/devices/mod.rs @@ -35,6 +35,10 @@ pub mod atmega164pa; #[cfg(feature = "atmega168")] pub mod atmega168; +/// [ATmega169PA](https://www.microchip.com/en-us/product/ATmega169PA) +#[cfg(feature = "atmega169pa")] +pub mod atmega169pa; + /// [ATmega16u2](https://www.microchip.com/wwwproducts/en/ATmega16u2) #[cfg(feature = "atmega16u2")] pub mod atmega16u2; diff --git a/src/lib.rs b/src/lib.rs index 7db14ec..56fd941 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,7 @@ #![cfg_attr(feature = "atmega16", doc = "**atmega16**,")] #![cfg_attr(feature = "atmega164pa", doc = "**atmega164pa**,")] #![cfg_attr(feature = "atmega168", doc = "**atmega168**,")] +#![cfg_attr(feature = "atmega169pa", doc = "**atmega169pa**,")] #![cfg_attr(feature = "atmega16u2", doc = "**atmega16u2**,")] #![cfg_attr(feature = "atmega2560", doc = "**atmega2560**,")] #![cfg_attr(feature = "atmega8", doc = "**atmega8**,")] @@ -67,6 +68,7 @@ //! `atmega16`, //! `atmega164pa`, //! `atmega168`, +//! `atmega169pa`, //! `atmega16u2`, //! `atmega2560`, //! `atmega8`, @@ -240,6 +242,7 @@ compile_error!( * atmega16 * atmega164pa * atmega168 + * atmega169pa * atmega16u2 * atmega2560 * atmega324pa @@ -304,6 +307,8 @@ pub use crate::devices::atmega16; pub use crate::devices::atmega164pa; #[cfg(feature = "atmega168")] pub use crate::devices::atmega168; +#[cfg(feature = "atmega169pa")] +pub use crate::devices::atmega169pa; #[cfg(feature = "atmega16u2")] pub use crate::devices::atmega16u2; #[cfg(feature = "atmega2560")] diff --git a/vendor/atmega169pa.atdf b/vendor/atmega169pa.atdf new file mode 100644 index 0000000..0280b87 --- /dev/null +++ b/vendor/atmega169pa.atdf @@ -0,0 +1,1445 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +