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 atmega324pa #392

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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 mcu/atmega-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ device-selected = []
enable-extra-adc = []
atmega48p = ["avr-device/atmega48p", "device-selected"]
atmega168 = ["avr-device/atmega168", "device-selected"]
atmega324pa = ["avr-device/atmega324pa", "device-selected"]
atmega328p = ["avr-device/atmega328p", "device-selected"]
atmega328pb = ["avr-device/atmega328pb", "device-selected"]
atmega32u4 = ["avr-device/atmega32u4", "device-selected"]
Expand Down
6 changes: 5 additions & 1 deletion mcu/atmega-hal/src/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pub mod channel {
#[cfg(all(
any(
feature = "atmega168",
feature = "atmega324pa",
feature = "atmega328p",
feature = "atmega328pb",
feature = "atmega48p",
Expand All @@ -85,6 +86,7 @@ pub mod channel {
#[cfg(all(
any(
feature = "atmega168",
feature = "atmega324pa",
feature = "atmega328p",
feature = "atmega328pb",
feature = "atmega48p",
Expand All @@ -98,6 +100,7 @@ pub mod channel {
feature = "atmega1280",
feature = "atmega168",
feature = "atmega2560",
feature = "atmega324pa",
feature = "atmega328p",
feature = "atmega328pb",
feature = "atmega32u4",
Expand All @@ -110,6 +113,7 @@ pub mod channel {
feature = "atmega1280",
feature = "atmega168",
feature = "atmega2560",
feature = "atmega324pa",
feature = "atmega328p",
feature = "atmega328pb",
feature = "atmega32u4",
Expand Down Expand Up @@ -229,7 +233,7 @@ avr_hal_generic::impl_adc! {
},
}

#[cfg(any(feature = "atmega1284p"))]
#[cfg(any(feature = "atmega1284p", feature = "atmega324pa"))]
avr_hal_generic::impl_adc! {
hal: crate::Atmega,
peripheral: crate::pac::ADC,
Expand Down
4 changes: 1 addition & 3 deletions mcu/atmega-hal/src/eeprom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ avr_hal_generic::impl_eeprom_atmega! {
},
}

#[cfg(any(
feature = "atmega8"
))]
#[cfg(any(feature = "atmega8"))]
avr_hal_generic::impl_eeprom_atmega_old! {
hal: crate::Atmega,
peripheral: crate::pac::EEPROM,
Expand Down
4 changes: 2 additions & 2 deletions mcu/atmega-hal/src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ avr_hal_generic::impl_i2c_twi! {
scl: port::PE1,
}

#[cfg(any(feature = "atmega1284p"))]
#[cfg(any(feature = "atmega1284p", feature = "atmega324pa"))]
pub type I2c<CLOCK> = avr_hal_generic::i2c::I2c<
crate::Atmega,
crate::pac::TWI,
port::Pin<port::mode::Input, port::PC1>,
port::Pin<port::mode::Input, port::PC0>,
CLOCK,
>;
#[cfg(any(feature = "atmega1284p"))]
#[cfg(any(feature = "atmega1284p", feature = "atmega324pa"))]
avr_hal_generic::impl_i2c_twi! {
hal: crate::Atmega,
peripheral: crate::pac::TWI,
Expand Down
7 changes: 6 additions & 1 deletion mcu/atmega-hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#![cfg_attr(feature = "atmega48p", doc = "**ATmega48P**.")]
#![cfg_attr(feature = "atmega168", doc = "**ATmega168**.")]
#![cfg_attr(feature = "atmega328p", doc = "**ATmega328P**.")]
#![cfg_attr(feature = "atmega324pa", doc = "**ATmega324PA**.")]
#![cfg_attr(feature = "atmega328pb", doc = "**ATmega328PB**.")]
#![cfg_attr(feature = "atmega32u4", doc = "**ATmega32U4**.")]
#![cfg_attr(feature = "atmega2560", doc = "**ATmega2560**.")]
Expand All @@ -32,6 +33,7 @@ compile_error!(

* atmega48p
* atmega168
* atmega324pa
* atmega328p
* atmega328pb
* atmega32u4
Expand All @@ -51,6 +53,9 @@ pub use avr_device::atmega168 as pac;
/// Reexport of `atmega2560` from `avr-device`
#[cfg(feature = "atmega2560")]
pub use avr_device::atmega2560 as pac;
/// Reexport of `atmega324pa` from `avr-device`
#[cfg(feature = "atmega324pa")]
pub use avr_device::atmega324pa as pac;
/// Reexport of `atmega328p` from `avr-device`
#[cfg(feature = "atmega328p")]
pub use avr_device::atmega328p as pac;
Expand Down Expand Up @@ -154,7 +159,7 @@ macro_rules! pins {
};
}

#[cfg(any(feature = "atmega1284p"))]
#[cfg(any(feature = "atmega1284p", feature = "atmega324pa"))]
#[macro_export]
macro_rules! pins {
($p:expr) => {
Expand Down
2 changes: 1 addition & 1 deletion mcu/atmega-hal/src/port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ avr_hal_generic::impl_port_traditional! {
}
}

#[cfg(any(feature = "atmega1284p"))]
#[cfg(any(feature = "atmega1284p", feature = "atmega324pa"))]
avr_hal_generic::impl_port_traditional! {
enum Ports {
PORTA: (crate::pac::PORTA, porta, pina, ddra),
Expand Down
6 changes: 3 additions & 3 deletions mcu/atmega-hal/src/simple_pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ avr_hal_generic::impl_simple_pwm! {
}
}

#[cfg(any(feature = "atmega1284p"))]
#[cfg(any(feature = "atmega1284p", feature = "atmega324pa"))]
avr_hal_generic::impl_simple_pwm! {
/// Use `TC0` for PWM (pins `PB3`, `PB4`)
///
Expand Down Expand Up @@ -852,7 +852,7 @@ avr_hal_generic::impl_simple_pwm! {
}
}

#[cfg(any(feature = "atmega1284p"))]
#[cfg(any(feature = "atmega1284p", feature = "atmega324pa"))]
avr_hal_generic::impl_simple_pwm! {
/// Use `TC1` for PWM (pins `PD5`, `PD4`)
///
Expand Down Expand Up @@ -904,7 +904,7 @@ avr_hal_generic::impl_simple_pwm! {
}
}

#[cfg(any(feature = "atmega1284p"))]
#[cfg(any(feature = "atmega1284p", feature = "atmega324pa"))]
avr_hal_generic::impl_simple_pwm! {
/// Use `TC2` for PWM (pins `PD7`, `PD6`)
///
Expand Down
2 changes: 1 addition & 1 deletion mcu/atmega-hal/src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ avr_hal_generic::impl_spi! {
cs: port::PE2,
}

#[cfg(any(feature = "atmega1284p"))]
#[cfg(any(feature = "atmega1284p", feature = "atmega324pa"))]
pub type Spi = avr_hal_generic::spi::Spi<
crate::Atmega,
crate::pac::SPI,
Expand Down
8 changes: 4 additions & 4 deletions mcu/atmega-hal/src/usart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ pub type UsartWriter<USART, RX, TX, CLOCK> =
pub type UsartReader<USART, RX, TX, CLOCK> =
avr_hal_generic::usart::UsartReader<crate::Atmega, USART, RX, TX, CLOCK>;

#[cfg(any(feature = "atmega168", feature = "atmega328p", feature = "atmega328pb", feature = "atmega1284p"))]
#[cfg(any(feature = "atmega168", feature = "atmega324pa", feature = "atmega328p", feature = "atmega328pb", feature = "atmega1284p"))]
pub type Usart0<CLOCK> = Usart<
crate::pac::USART0,
port::Pin<port::mode::Input, port::PD0>,
port::Pin<port::mode::Output, port::PD1>,
CLOCK,
>;
#[cfg(any(feature = "atmega168", feature = "atmega328p", feature = "atmega328pb", feature = "atmega1284p"))]
#[cfg(any(feature = "atmega168", feature = "atmega324pa", feature = "atmega328p", feature = "atmega328pb", feature = "atmega1284p"))]
avr_hal_generic::impl_usart_traditional! {
hal: crate::Atmega,
peripheral: crate::pac::USART0,
Expand All @@ -41,14 +41,14 @@ avr_hal_generic::impl_usart_traditional! {
tx: port::PB3,
}

#[cfg(any(feature = "atmega32u4", feature = "atmega1280", feature = "atmega2560", feature = "atmega1284p"))]
#[cfg(any(feature = "atmega32u4", feature = "atmega324pa", feature = "atmega1280", feature = "atmega2560", feature = "atmega1284p"))]
pub type Usart1<CLOCK> = Usart<
crate::pac::USART1,
port::Pin<port::mode::Input, port::PD2>,
port::Pin<port::mode::Output, port::PD3>,
CLOCK,
>;
#[cfg(any(feature = "atmega32u4", feature = "atmega1280", feature = "atmega2560", feature = "atmega1284p"))]
#[cfg(any(feature = "atmega32u4", feature = "atmega324pa", feature = "atmega1280", feature = "atmega2560", feature = "atmega1284p"))]
avr_hal_generic::impl_usart_traditional! {
hal: crate::Atmega,
peripheral: crate::pac::USART1,
Expand Down