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:
Danilo Bargen 2020-06-26 23:46:09 +02:00
parent 8a4f9c6b8a
commit 8e636f0d12
15 changed files with 65 additions and 22 deletions

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};

View file

@ -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();
}
};