Module stm32f0xx_hal::timers

source ·
Expand description

API for the integrated timers

This only implements basic functions, a lot of things are missing

Example

Blink the led with 1Hz

use stm32f0xx_hal as hal;

use crate::hal::stm32;
use crate::hal::prelude::*;
use crate::hal::time::*;
use crate::hal::timers::*;
use nb::block;

let mut p = stm32::Peripherals::take().unwrap();

let mut led = gpioa.pa1.into_push_pull_pull_output();
let rcc = p.RCC.constrain().cfgr.freeze();
let mut timer = Timer::tim1(p.TIM1, Hertz(1), clocks);
loop {
    led.toggle();
    block!(timer.wait()).ok();
}

Structs

Hardware timers

Enums

Interrupt events