~ruther/avr-device

ref: 769efac469de3d05f8d8848737aac7e39d9def6e avr-device/src/lib.rs -rw-r--r-- 451 bytes
769efac4 — Rahix Initial 6 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#![no_std]

#[allow(non_camel_case_types)]
mod devices;

#[cfg(feature = "attiny85")]
pub use crate::devices::attiny85::*;
#[cfg(feature = "atmega32u4")]
pub use crate::devices::atmega32u4::*;

impl Peripherals {
    /// Returns all the peripherals *once*
    #[inline]
    pub fn take() -> Option<Self> {
        if unsafe { DEVICE_PERIPHERALS } {
            None
        } else {
            Some(unsafe { Peripherals::steal() })
        }
    }
}
Do not follow this link