piezo-ddr-controller/src/bsp.rs

33 lines
738 B
Rust

//! Initialization code
pub use f3::hal::stm32f30x::{adc1, gpioa, gpioc, rcc};
use f3::hal::stm32f30x::{self, ADC1, ADC1_2, ITM, GPIOA, GPIOD, GPIOE, RCC};
pub struct Peripherals {
pub gpioa: GPIOA,
pub gpiod: GPIOD,
pub gpioe: GPIOE,
pub rcc: RCC,
pub adc1: ADC1,
pub adc1_2: ADC1_2,
pub itm: ITM,
}
pub fn init() -> Peripherals {
// restrict access to the other peripherals
let per = stm32f30x::Peripherals::take().unwrap();
let core_per = stm32f30x::CorePeripherals::take().unwrap();
Peripherals {
gpioa: per.GPIOA,
gpiod: per.GPIOD,
gpioe: per.GPIOE,
rcc: per.RCC,
adc1: per.ADC1,
adc1_2: per.ADC1_2,
itm: core_per.ITM,
}
}