#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
pub(crate) static mut DEVICE_PERIPHERALS: bool = false;
#[cfg(feature = "atmega1280")]
pub mod atmega1280;
#[cfg(feature = "atmega1280")]
impl atmega1280::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega1280::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "atmega168")]
pub mod atmega168;
#[cfg(feature = "atmega168")]
impl atmega168::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega168::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "atmega2560")]
pub mod atmega2560;
#[cfg(feature = "atmega2560")]
impl atmega2560::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega2560::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "atmega328p")]
pub mod atmega328p;
#[cfg(feature = "atmega328p")]
impl atmega328p::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega328p::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "atmega328pb")]
pub mod atmega328pb;
#[cfg(feature = "atmega328pb")]
impl atmega328pb::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega328pb::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "atmega32u4")]
pub mod atmega32u4;
#[cfg(feature = "atmega32u4")]
impl atmega32u4::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega32u4::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "atmega48p")]
pub mod atmega48p;
#[cfg(feature = "atmega48p")]
impl atmega48p::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega48p::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "atmega8")]
pub mod atmega8;
#[cfg(feature = "atmega8")]
impl atmega8::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega8::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "atmega64")]
pub mod atmega64;
#[cfg(feature = "atmega64")]
impl atmega64::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega64::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "atmega644")]
pub mod atmega644;
#[cfg(feature = "atmega644")]
impl atmega644::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { atmega644::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "attiny84")]
pub mod attiny84;
#[cfg(feature = "attiny84")]
impl attiny84::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { attiny84::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "attiny85")]
pub mod attiny85;
#[cfg(feature = "attiny85")]
impl attiny85::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { attiny85::Peripherals::steal() })
}
})
}
}
#[cfg(feature = "attiny88")]
pub mod attiny88;
#[cfg(feature = "attiny88")]
impl attiny88::Peripherals {
#[inline]
pub fn take() -> Option<Self> {
crate::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { attiny88::Peripherals::steal() })
}
})
}
}