Module stm32f0xx_hal::timers [−][src]
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::pac;
use crate::hal::prelude::*;
use crate::hal::time::*;
use crate::hal::timers::*;
use nb::block;
cortex_m::interrupt::free(|cs| {
let mut p = pac::Peripherals::take().unwrap();
let mut rcc = p.RCC.configure().freeze(&mut p.FLASH);
let gpioa = p.GPIOA.split(&mut rcc);
let mut led = gpioa.pa1.into_push_pull_pull_output(cs);
let mut timer = Timer::tim1(p.TIM1, Hertz(1), &mut rcc);
loop {
led.toggle();
block!(timer.wait()).ok();
}
});
Structs
Hardware timers
Enums
Interrupt events