Skip to content
Snippets Groups Projects
Commit 89285bf4 authored by August Svensson's avatar August Svensson
Browse files

..

parent b1880e13
No related branches found
No related tags found
No related merge requests found
......@@ -81,11 +81,22 @@ const APP: () = {
#[task(priority = 1, capacity = 4, resources = [ITM])]
fn trace_data(byte: u8) {
let stim = &mut resources.ITM.stim[0];
iprintln!(stim, "data {}", byte);
for _ in 0..10000 {
asm::nop();
// let stim = &mut resources.ITM.stim[0];
// iprintln!(stim, "data {}", byte);
// for _ in 0..10000 {
// asm::nop();
// }
}
#[task(priority = 1, spawn = [echo, trace_error])]
fn cmd_interpretor(byte: u8) {
let send: u8 = match byte as char {
'a' => byte + 1,
_ => byte,
};
let _ = spawn.echo(send);
}
#[task(priority = 1, resources = [ITM])]
......@@ -104,13 +115,13 @@ const APP: () = {
}
#[interrupt(priority = 3, resources = [RX], spawn = [trace_data, trace_error, echo])]
#[interrupt(priority = 3, resources = [RX], spawn = [trace_data, trace_error, cmd_interpretor])]
fn USART2() {
let rx = resources.RX;
match rx.read() {
Ok(byte) => {
let _ = spawn.echo(byte);
let _ = spawn.cmd_interpretor(byte);
if spawn.trace_data(byte).is_err() {
let _ = spawn.trace_error(Error::RingBufferOverflow);
}
......@@ -126,6 +137,7 @@ const APP: () = {
extern "C" {
fn EXTI0();
fn EXTI1();
fn EXTI2();
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment