Skip to content

Commit 1ed311c

Browse files
committed
impl Send for serial Rx and Tx abstractions
Signed-off-by: Daniel Egger <[email protected]>
1 parent b56040d commit 1ed311c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/serial.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,18 @@ pub struct Rx<USART> {
149149
usart: *const USART,
150150
}
151151

152+
// NOTE(unsafe) Required to allow protected shared access in handlers
153+
unsafe impl<USART> Send for Rx<USART> {}
154+
152155
/// Serial transmitter
153156
pub struct Tx<USART> {
154157
// This is ok, because the USART types only contains PhantomData
155158
usart: *const USART,
156159
}
157160

161+
// NOTE(unsafe) Required to allow protected shared access in handlers
162+
unsafe impl<USART> Send for Tx<USART> {}
163+
158164
macro_rules! usart {
159165
($($USART:ident: ($usart:ident, $usartXen:ident, $apbenr:ident),)+) => {
160166
$(

0 commit comments

Comments
 (0)