[−][src]Module nucleo_f042k6::timers
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; cortex_m::interrupt::free(|cs| { let mut p = stm32::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
Timer | Hardware timers |
Enums
Event | Interrupt events |