Skip to content

Commit f7bda32

Browse files
committed
Update port.rs documentation for send replacements
1 parent 12aedb1 commit f7bda32

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/port.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,18 @@ impl SerialPort {
100100
}
101101

102102
/// Sends a byte on the serial port.
103+
/// 0x08 (backspace) and 0x7F (delete) get replaced with 0x08, 0x20, 0x08 and 0x0A (\n) gets replaced with \r\n.
104+
/// If this replacement is unwanted use [SerialPort::send_raw] instead.
103105
pub fn send(&mut self, data: u8) {
104106
match data {
105107
8 | 0x7F => {
106108
self.send_raw(8);
107109
self.send_raw(b' ');
108110
self.send_raw(8);
109111
}
110-
0x0a => {
111-
self.send_raw(0x0d);
112-
self.send_raw(0x0a);
112+
0x0A => {
113+
self.send_raw(0x0D);
114+
self.send_raw(0x0A);
113115
}
114116
data => {
115117
self.send_raw(data);

0 commit comments

Comments
 (0)