From ece84dafcfc9937c7f8dd954e51c63e2720dec20 Mon Sep 17 00:00:00 2001 From: Oliver Calder Date: Tue, 7 Dec 2021 12:20:32 -0600 Subject: [PATCH] Added send_raw() function to allow sending arbitrary binary data using the serial port. --- src/port.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/port.rs b/src/port.rs index e389283..2228a19 100644 --- a/src/port.rs +++ b/src/port.rs @@ -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 {