From 8e636f0d1286cf905518022d42adf9624bed44df Mon Sep 17 00:00:00 2001 From: Danilo Bargen Date: Fri, 26 Jun 2020 23:46:09 +0200 Subject: [PATCH] Examples: Clarify extern section Some beginners are confused about the "extern" section, so I added an explanation comment to all examples. Furthermore, using the UARTx interrupts when UART is actually being used in the same example may be confusing, so I changed them all to SSI0/QEI0. --- examples/baseline.rs | 5 ++++- examples/capacity.rs | 6 ++++-- examples/cfg.rs | 7 +++++-- examples/message.rs | 5 ++++- examples/not-send.rs | 7 +++++-- examples/not-sync.rs | 5 ++++- examples/periodic.rs | 5 ++++- examples/pool.rs | 7 +++++-- examples/schedule.rs | 5 ++++- examples/t-cfg.rs | 7 +++++-- examples/t-schedule.rs | 5 ++++- examples/t-spawn.rs | 5 ++++- examples/t-stask-main.rs | 5 ++++- examples/task.rs | 8 +++++--- examples/types.rs | 5 ++++- 15 files changed, 65 insertions(+), 22 deletions(-) diff --git a/examples/baseline.rs b/examples/baseline.rs index 4be8cd398d..f46b273d4b 100644 --- a/examples/baseline.rs +++ b/examples/baseline.rs @@ -45,7 +45,10 @@ const APP: () = { cx.spawn.foo().unwrap(); } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART1(); + fn SSI0(); } }; diff --git a/examples/capacity.rs b/examples/capacity.rs index e50f929456..00cec34459 100644 --- a/examples/capacity.rs +++ b/examples/capacity.rs @@ -38,8 +38,10 @@ const APP: () = { debug::exit(debug::EXIT_SUCCESS); } - // Interrupt handlers used to dispatch software tasks + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART1(); + fn SSI0(); } }; diff --git a/examples/cfg.rs b/examples/cfg.rs index 534c3f800d..02b39e349b 100644 --- a/examples/cfg.rs +++ b/examples/cfg.rs @@ -57,8 +57,11 @@ const APP: () = { .ok(); } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); - fn UART1(); + fn SSI0(); + fn QEI0(); } }; diff --git a/examples/message.rs b/examples/message.rs index 3fb2812141..596f244904 100644 --- a/examples/message.rs +++ b/examples/message.rs @@ -43,7 +43,10 @@ const APP: () = { c.spawn.foo().unwrap(); } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); + fn SSI0(); } }; diff --git a/examples/not-send.rs b/examples/not-send.rs index fc2196c23a..16a874dc0f 100644 --- a/examples/not-send.rs +++ b/examples/not-send.rs @@ -53,8 +53,11 @@ const APP: () = { debug::exit(debug::EXIT_SUCCESS); } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); - fn UART1(); + fn SSI0(); + fn QEI0(); } }; diff --git a/examples/not-sync.rs b/examples/not-sync.rs index 57b18d7547..a7eaac8e7f 100644 --- a/examples/not-sync.rs +++ b/examples/not-sync.rs @@ -36,7 +36,10 @@ const APP: () = { let _: &NotSync = c.resources.shared; } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); + fn SSI0(); } }; diff --git a/examples/periodic.rs b/examples/periodic.rs index f84744a291..405346e390 100644 --- a/examples/periodic.rs +++ b/examples/periodic.rs @@ -29,7 +29,10 @@ const APP: () = { cx.schedule.foo(cx.scheduled + PERIOD.cycles()).unwrap(); } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); + fn SSI0(); } }; diff --git a/examples/pool.rs b/examples/pool.rs index 38d2b6e19a..824d5bd86b 100644 --- a/examples/pool.rs +++ b/examples/pool.rs @@ -59,8 +59,11 @@ const APP: () = { // drop(x); } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); - fn UART1(); + fn SSI0(); + fn QEI0(); } }; diff --git a/examples/schedule.rs b/examples/schedule.rs index 44a569397f..70a7a5e328 100644 --- a/examples/schedule.rs +++ b/examples/schedule.rs @@ -44,7 +44,10 @@ const APP: () = { hprintln!("bar @ {:?}", Instant::now()).unwrap(); } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); + fn SSI0(); } }; diff --git a/examples/t-cfg.rs b/examples/t-cfg.rs index feb7114488..52e6d1c9d3 100644 --- a/examples/t-cfg.rs +++ b/examples/t-cfg.rs @@ -43,8 +43,11 @@ const APP: () = { #[task] fn quux(_: quux::Context) {} + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); - fn UART1(); + fn SSI0(); + fn QEI0(); } }; diff --git a/examples/t-schedule.rs b/examples/t-schedule.rs index 67fcb749ea..4a23182273 100644 --- a/examples/t-schedule.rs +++ b/examples/t-schedule.rs @@ -53,7 +53,10 @@ const APP: () = { #[task] fn baz(_: baz::Context, _x: u32, _y: u32) {} + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART1(); + fn SSI0(); } }; diff --git a/examples/t-spawn.rs b/examples/t-spawn.rs index 4fc1f4e3f0..2d941b1567 100644 --- a/examples/t-spawn.rs +++ b/examples/t-spawn.rs @@ -52,7 +52,10 @@ const APP: () = { #[task] fn baz(_: baz::Context, _x: u32, _y: u32) {} + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART1(); + fn SSI0(); } }; diff --git a/examples/t-stask-main.rs b/examples/t-stask-main.rs index 4245ef22f6..f270940454 100644 --- a/examples/t-stask-main.rs +++ b/examples/t-stask-main.rs @@ -18,7 +18,10 @@ const APP: () = { debug::exit(debug::EXIT_SUCCESS); } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); + fn SSI0(); } }; diff --git a/examples/task.rs b/examples/task.rs index 10a4dc73bd..12c4ac8355 100644 --- a/examples/task.rs +++ b/examples/task.rs @@ -45,9 +45,11 @@ const APP: () = { hprintln!("baz").unwrap(); } - // Interrupt handlers used to dispatch software tasks + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); - fn UART1(); + fn SSI0(); + fn QEI0(); } }; diff --git a/examples/types.rs b/examples/types.rs index 29dedaffa8..e14ab0c811 100644 --- a/examples/types.rs +++ b/examples/types.rs @@ -52,7 +52,10 @@ const APP: () = { let _: foo::Spawn = cx.spawn; } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART1(); + fn SSI0(); } };