Skip to content

Commit

Permalink
IO: update board io demo code
Browse files Browse the repository at this point in the history
  • Loading branch information
surban committed Feb 20, 2024
1 parent d8bf7b5 commit 2f44baf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions openemc-firmware/src/boards/stm_nucleo_f103rb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,16 @@ impl Board for BoardImpl {
}

fn io_read(&mut self) -> Vec<u8, IO_BUFFER_SIZE> {
let data = mem::take(&mut self.io_data_buf);
let data = self.io_data_buf.clone();
defmt::info!("Sent {} bytes IO board data", data.len());
io_write_available();

if self.io_data_buf.is_empty() {
io_write_available();
} else {
self.io_data_buf.truncate(self.io_data_buf.len() - 1);
io_read_available();
}

data
}
}

0 comments on commit 2f44baf

Please sign in to comment.