Skip to content

Commit

Permalink
atmega-hal: Drop redundant atmega8 macro invocation
Browse files Browse the repository at this point in the history
Consolidate the macro invocation for ATmega8 SPI into the existing
invocation with the same parameters.

Co-developed-by: Ghislain MARY <ghislain.mary@neutralite.org>
  • Loading branch information
Rahix committed Feb 11, 2024
1 parent fbb8495 commit b2be3f9
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions mcu/atmega-hal/src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
use crate::port;
pub use avr_hal_generic::spi::*;

#[cfg(any(feature = "atmega128a", feature = "atmega1280", feature = "atmega2560", feature = "atmega32u4"))]
#[cfg(any(
feature = "atmega128a",
feature = "atmega1280",
feature = "atmega2560",
feature = "atmega32u4"
))]
pub type Spi = avr_hal_generic::spi::Spi<
crate::Atmega,
crate::pac::SPI,
Expand All @@ -11,7 +16,12 @@ pub type Spi = avr_hal_generic::spi::Spi<
port::PB3,
port::PB0,
>;
#[cfg(any(feature = "atmega128a", feature = "atmega1280", feature = "atmega2560", feature = "atmega32u4"))]
#[cfg(any(
feature = "atmega128a",
feature = "atmega1280",
feature = "atmega2560",
feature = "atmega32u4"
))]
avr_hal_generic::impl_spi! {
hal: crate::Atmega,
peripheral: crate::pac::SPI,
Expand All @@ -21,7 +31,12 @@ avr_hal_generic::impl_spi! {
cs: port::PB0,
}

#[cfg(any(feature = "atmega168", feature = "atmega328p", feature = "atmega48p",))]
#[cfg(any(
feature = "atmega168",
feature = "atmega328p",
feature = "atmega48p",
feature = "atmega8"
))]
pub type Spi = avr_hal_generic::spi::Spi<
crate::Atmega,
crate::pac::SPI,
Expand All @@ -30,7 +45,12 @@ pub type Spi = avr_hal_generic::spi::Spi<
port::PB4,
port::PB2,
>;
#[cfg(any(feature = "atmega168", feature = "atmega328p", feature = "atmega48p",))]
#[cfg(any(
feature = "atmega168",
feature = "atmega328p",
feature = "atmega48p",
feature = "atmega8"
))]
avr_hal_generic::impl_spi! {
hal: crate::Atmega,
peripheral: crate::pac::SPI,
Expand Down Expand Up @@ -95,13 +115,3 @@ avr_hal_generic::impl_spi! {
miso: port::PB6,
cs: port::PB4,
}

#[cfg(any(feature = "atmega8"))]
avr_hal_generic::impl_spi! {
hal: crate::Atmega,
peripheral: crate::pac::SPI,
sclk: port::PB5,
mosi: port::PB3,
miso: port::PB4,
cs: port::PB2,
}

0 comments on commit b2be3f9

Please sign in to comment.