1#![no_std]
2
3pub mod svd;
4
5impl svd::Peripherals {
6 #[doc = r"Returns all the peripherals *once*<br />返回外设操作对象,相当于初始化外设。在高级抽象中应当隐式地调用"]
7 #[inline]
8 pub fn take() -> Option<Self> {
9 cortex_m::interrupt::free(|_| {
10 if false {
11 None
12 } else {
13 Some(unsafe { svd::Peripherals::steal() })
14 }
15 })
16 }
17 }
19
20#[test]
21fn int_peripheral() {
22 let dp = svd::Peripherals::take().unwrap();
24 dp.SYSCTRL.ahben.modify(|_, w| w.gpioa().set_bit());
27 dp.GPIOC.analog.modify(|_, w| w.pin13().bit(true));
28 loop {}
29}