Skip to main content

RCC

Struct RCC 

Source
pub struct RCC {
Show 13 fields pub hsi32m: bool, pub osc32m: bool, pub lsi32k: bool, pub osc32k: bool, pub freq_monitor: FreqMonitor, pub ahb_div: u8, pub apb_m_div: u8, pub apb_p_div: u8, pub hsi32m_calibration_value: u8, pub lsi32k_calibration_value: u8, pub rtcclk: RtcClkMux, pub rtccpuclk: CpuRtcClkMux, pub clocks: Clocks,
}

Fields§

§hsi32m: bool§osc32m: bool§lsi32k: bool§osc32k: bool§freq_monitor: FreqMonitor§ahb_div: u8§apb_m_div: u8§apb_p_div: u8§hsi32m_calibration_value: u8§lsi32k_calibration_value: u8§rtcclk: RtcClkMux§rtccpuclk: CpuRtcClkMux§clocks: Clocks

Implementations§

Source§

impl RCC

Source

pub fn init(config: &RCC)

Examples found in repository?
examples/serial.rs (line 19)
15pub extern "C" fn main() -> ! {
16    let peripherals = Peripherals::take().unwrap();
17
18    let rcc_config = RCC::default();
19    RCC::init(&rcc_config);
20
21    peripherals
22        .pm
23        .clk_apb_m_set()
24        .modify(|_, w| w.pad_config().enable().pm().enable());
25
26    let rx = Pin08::new().into_serial_port();
27    let tx = Pin09::new().into_serial_port();
28
29    let serial = Serial::new(peripherals.usart_1, (tx, rx), Config::default()).unwrap();
30    let (mut tx, _rx) = serial.split();
31
32    loop {
33        let _ = writeln!(tx, "Hello from MIK32 USART1");
34        delay(MESSAGE_DELAY_SPINS);
35    }
36}
More examples
Hide additional examples
examples/gpio.rs (line 18)
14pub extern "C" fn main() -> ! {
15    let p = Peripherals::take().unwrap();
16
17    let rcc_config = RCC::default();
18    RCC::init(&rcc_config);
19
20    p.pm.clk_apb_p_set().modify(|_, w| w.gpio_0().enable());
21    p.pm.clk_apb_m_set()
22        .modify(|_, w| w.pad_config().enable().pm().enable());
23
24    let mut led_pin = Pin09::new().into_output();
25    let mut button_pin = Pin10::new().into_pull_down_input();
26
27    loop {
28        if button_pin.is_high().unwrap() {
29            let _ = led_pin.set_high();
30        } else {
31            let _ = led_pin.set_low();
32        }
33
34        for _ in 0..1000 {
35            core::hint::spin_loop();
36        }
37    }
38}
examples/tsense.rs (line 19)
15pub extern "C" fn main() -> ! {
16    let peripherals = Peripherals::take().unwrap();
17
18    let rcc_config = RCC::default();
19    RCC::init(&rcc_config);
20
21    let sensor_config = Config::default()
22        .clock_from_source(ClockSource::HSI32M)
23        .with_frequency(SENSOR_CLOCK_HZ);
24
25    let mut sensor = TSENS::new(peripherals.tsens, &rcc_config.clocks, sensor_config).unwrap();
26
27    let mut current_temperature_c = sensor.single_measurement(Some(STARTUP_TIMEOUT)).unwrap();
28    let mut min_temperature_c = current_temperature_c;
29    let mut max_temperature_c = current_temperature_c;
30
31    sensor.start_continuous();
32
33    loop {
34        current_temperature_c = sensor.get_temperature();
35
36        if current_temperature_c < min_temperature_c {
37            min_temperature_c = current_temperature_c;
38        }
39
40        if current_temperature_c > max_temperature_c {
41            max_temperature_c = current_temperature_c;
42        }
43
44        let _temperature_snapshot = (current_temperature_c, min_temperature_c, max_temperature_c);
45
46        delay(SAMPLE_DELAY_SPINS);
47    }
48}

Trait Implementations§

Source§

impl Default for RCC

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for RCC

§

impl RefUnwindSafe for RCC

§

impl Send for RCC

§

impl Sync for RCC

§

impl Unpin for RCC

§

impl UnsafeUnpin for RCC

§

impl UnwindSafe for RCC

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.