Skip to content

Commit 7beb08b

Browse files
authored
Merge pull request #21 from olivercalder/master
Added send_raw() function to allow sending arbitrary binary data using the serial port.
2 parents 2508703 + e52e06e commit 7beb08b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ name: Build
22

33
on:
44
push:
5-
branches:
6-
- 'master'
7-
tags:
8-
- '*'
5+
pull_request:
96
schedule:
107
- cron: '40 4 * * *' # every day at 4:40
11-
pull_request:
128

139
jobs:
1410
test:

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)