impl Send for serial Rx and Tx abstractions

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
This commit is contained in:
Daniel Egger 2018-12-22 15:45:34 +01:00
parent b56040d28e
commit 1ed311cd62
1 changed files with 6 additions and 0 deletions

View File

@ -149,12 +149,18 @@ pub struct Rx<USART> {
usart: *const USART,
}
// NOTE(unsafe) Required to allow protected shared access in handlers
unsafe impl<USART> Send for Rx<USART> {}
/// Serial transmitter
pub struct Tx<USART> {
// This is ok, because the USART types only contains PhantomData
usart: *const USART,
}
// NOTE(unsafe) Required to allow protected shared access in handlers
unsafe impl<USART> Send for Tx<USART> {}
macro_rules! usart {
($($USART:ident: ($usart:ident, $usartXen:ident, $apbenr:ident),)+) => {
$(