Skip to content

Commit ece84da

Browse files
committed
Added send_raw() function to allow sending arbitrary binary data using the serial port.
1 parent 2508703 commit ece84da

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/port.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ impl SerialPort {
8686
}
8787
}
8888

89+
/// Sends a raw byte on the serial port, intended for binary data.
90+
pub fn send_raw(&mut self, data: u8) {
91+
unsafe {
92+
wait_for!(self.line_sts().contains(LineStsFlags::OUTPUT_EMPTY));
93+
self.data.write(data);
94+
}
95+
}
96+
8997
/// Receives a byte on the serial port.
9098
pub fn receive(&mut self) -> u8 {
9199
unsafe {

0 commit comments

Comments
 (0)