Skip to content

Commit

Permalink
Added send_raw() function to allow sending arbitrary binary data usin…
Browse files Browse the repository at this point in the history
…g the serial port.
  • Loading branch information
olivercalder committed Dec 7, 2021
1 parent 2508703 commit ece84da
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ impl SerialPort {
}
}

/// Sends a raw byte on the serial port, intended for binary data.
pub fn send_raw(&mut self, data: u8) {
unsafe {
wait_for!(self.line_sts().contains(LineStsFlags::OUTPUT_EMPTY));
self.data.write(data);
}
}

/// Receives a byte on the serial port.
pub fn receive(&mut self) -> u8 {
unsafe {
Expand Down

0 comments on commit ece84da

Please sign in to comment.