mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
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.
This commit is contained in:
parent
8a4f9c6b8a
commit
8e636f0d12
15 changed files with 65 additions and 22 deletions
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue