Improved docs on where the 12 MHz comes from in SysTick

This commit is contained in:
Emil Fresk 2021-12-26 11:42:14 +01:00
parent 3a1d42b614
commit 7bec234766
5 changed files with 6 additions and 2 deletions

View file

@ -25,7 +25,7 @@ mod app {
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let systick = cx.core.SYST; let systick = cx.core.SYST;
// Initialize the monotonic // Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000); let mono = Systick::new(systick, 12_000_000);
hprintln!("init").ok(); hprintln!("init").ok();

View file

@ -33,6 +33,8 @@ mod app {
#[init] #[init]
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let systick = cx.core.SYST; let systick = cx.core.SYST;
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000); let mono = Systick::new(systick, 12_000_000);
// Spawn the task `foo` directly after `init` finishes // Spawn the task `foo` directly after `init` finishes

View file

@ -25,6 +25,7 @@ mod app {
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let systick = cx.core.SYST; let systick = cx.core.SYST;
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000); let mono = Systick::new(systick, 12_000_000);
foo::spawn_after(1.secs()).unwrap(); foo::spawn_after(1.secs()).unwrap();

View file

@ -25,7 +25,7 @@ mod app {
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let systick = cx.core.SYST; let systick = cx.core.SYST;
// Initialize the monotonic // Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000); let mono = Systick::new(systick, 12_000_000);
hprintln!("init").ok(); hprintln!("init").ok();

View file

@ -25,6 +25,7 @@ mod app {
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let systick = cx.core.SYST; let systick = cx.core.SYST;
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000); let mono = Systick::new(systick, 12_000_000);
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator