61
61
use core:: {
62
62
fmt:: { Result , Write } ,
63
63
ops:: Deref ,
64
+ convert:: Infallible ,
64
65
} ;
65
66
66
67
use embedded_hal:: prelude:: * ;
@@ -451,7 +452,7 @@ impl<USART> embedded_hal::serial::Write<u8> for Tx<USART>
451
452
where
452
453
USART : Deref < Target = SerialRegisterBlock > ,
453
454
{
454
- type Error = void :: Void ;
455
+ type Error = Infallible ;
455
456
456
457
/// Ensures that none of the previously written words are still buffered
457
458
fn flush ( & mut self ) -> nb:: Result < ( ) , Self :: Error > {
@@ -470,7 +471,7 @@ where
470
471
USART : Deref < Target = SerialRegisterBlock > ,
471
472
TXPIN : TxPin < USART > ,
472
473
{
473
- type Error = void :: Void ;
474
+ type Error = Infallible ;
474
475
475
476
/// Ensures that none of the previously written words are still buffered
476
477
fn flush ( & mut self ) -> nb:: Result < ( ) , Self :: Error > {
@@ -538,7 +539,7 @@ where
538
539
}
539
540
540
541
/// Ensures that none of the previously written words are still buffered
541
- fn flush ( usart : * const SerialRegisterBlock ) -> nb:: Result < ( ) , void :: Void > {
542
+ fn flush ( usart : * const SerialRegisterBlock ) -> nb:: Result < ( ) , Infallible > {
542
543
// NOTE(unsafe) atomic read with no side effects
543
544
let isr = unsafe { ( * usart) . isr . read ( ) } ;
544
545
@@ -550,8 +551,8 @@ fn flush(usart: *const SerialRegisterBlock) -> nb::Result<(), void::Void> {
550
551
}
551
552
552
553
/// Tries to write a byte to the UART
553
- /// Fails if the transmit buffer is full
554
- fn write ( usart : * const SerialRegisterBlock , byte : u8 ) -> nb:: Result < ( ) , void :: Void > {
554
+ /// Returns `Err(WouldBlock)` if the transmit buffer is full
555
+ fn write ( usart : * const SerialRegisterBlock , byte : u8 ) -> nb:: Result < ( ) , Infallible > {
555
556
// NOTE(unsafe) atomic read with no side effects
556
557
let isr = unsafe { ( * usart) . isr . read ( ) } ;
557
558
0 commit comments