Skip to content

Commit

Permalink
Removing duplicate take() impls
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharytomlinson committed Oct 17, 2024
1 parent df89644 commit 8fc5407
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions src/devices/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,8 @@ pub mod atmega164pa;
pub mod atmega168;

/// [ATmega16u2](https://www.microchip.com/wwwproducts/en/ATmega16u2)
pub mod atmega16u2;

#[cfg(feature = "atmega16u2")]
impl atmega16u2::Peripherals {
/// Returns all the peripherals *once*
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega16u2::Peripherals::steal() })
}
})
}
}
pub mod atmega16u2;

/// [ATmega2560](https://www.microchip.com/wwwproducts/en/ATmega2560)
#[cfg(feature = "atmega2560")]
Expand All @@ -74,22 +60,8 @@ pub mod atmega328pb;
pub mod atmega32a;

/// [ATmega32u2](https://www.microchip.com/wwwproducts/en/ATmega32u2)
pub mod atmega32u2;

#[cfg(feature = "atmega32u2")]
impl atmega32u2::Peripherals {
/// Returns all the peripherals *once*
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega32u2::Peripherals::steal() })
}
})
}
}
pub mod atmega32u2;

/// [ATmega32U4](https://www.microchip.com/wwwproducts/en/ATmega32U4)
#[cfg(feature = "atmega32u4")]
Expand Down

0 comments on commit 8fc5407

Please sign in to comment.