Expand description
Monotonic
implementations for STM32 chips.
Not all timers are available on all parts. Ensure that only available
timers are exposed by having the correct stm32*
feature enabled for rtic-monotonics
.
§Example
use rtic_monotonics::stm32::prelude::*;
// Define the monotonic and set it to 1MHz tick rate
stm32_tim2_monotonic!(Mono, 1_000_000);
fn init() {
// If using `embassy-stm32` HAL, timer clock can be read out like this:
let timer_clock_hz = embassy_stm32::peripherals::TIM2::frequency();
// Or define it manually if you are using other HAL or know correct frequency:
let timer_clock_hz = 64_000_000;
// Start the monotonic
Mono::start(timer_clock_hz);
}
async fn usage() {
loop {
// Use the monotonic
let timestamp = Mono::now();
Mono::delay(100.millis()).await;
}
}
Modules§
- Common definitions and traits for using the STM32 monotonics
Structs§
- Monotonic timer backend implementation.
- Monotonic timer backend implementation.
- Monotonic timer backend implementation.
- Monotonic timer backend implementation.
- Monotonic timer backend implementation.