File tree 3 files changed +32
-21
lines changed 3 files changed +32
-21
lines changed Original file line number Diff line number Diff line change 571
571
extern crate nb;
572
572
573
573
pub mod prelude;
574
+ pub mod serial;
574
575
575
576
/// Input capture
576
577
///
@@ -738,26 +739,6 @@ pub enum Direction {
738
739
Upcounting ,
739
740
}
740
741
741
- /// Serial interface
742
- ///
743
- /// Some serial interfaces support different data sizes (8 bits, 9 bits, etc.);
744
- /// This can be encoded in this trait via the `Word` type parameter.
745
- pub trait Serial < Word > {
746
- /// Serial interface error
747
- ///
748
- /// Possible errors
749
- ///
750
- /// - *overrun*, the previous received data was overwritten because it was
751
- /// not read in a timely manner
752
- type Error ;
753
-
754
- /// Reads a single word from the serial interface
755
- fn read ( & self ) -> nb:: Result < Word , Self :: Error > ;
756
-
757
- /// Writes a single word to the serial interface
758
- fn write ( & self , word : Word ) -> nb:: Result < ( ) , Self :: Error > ;
759
- }
760
-
761
742
/// Serial Peripheral Interface (full duplex master mode)
762
743
///
763
744
/// # Notes
Original file line number Diff line number Diff line change 6
6
pub use :: Capture as _embedded_hal_Capture;
7
7
pub use :: Pwm as _embedded_hal_Pwm;
8
8
pub use :: Qei as _embedded_hal_Qei;
9
- pub use :: Serial as _embedded_hal_Serial;
9
+ pub use :: serial:: Read as _embedded_hal_serial_Read;
10
+ pub use :: serial:: Write as _embedded_hal_serial_Write;
10
11
pub use :: Spi as _embedded_hal_Spi;
11
12
pub use :: Timer as _embedded_hal_Timer;
Original file line number Diff line number Diff line change
1
+ //! Serial interface
2
+
3
+ use nb;
4
+
5
+ /// Read half of a serial interface
6
+ ///
7
+ /// Some serial interfaces support different data sizes (8 bits, 9 bits, etc.);
8
+ /// This can be encoded in this trait via the `Word` type parameter.
9
+ pub trait Read < Word > {
10
+ /// Read error
11
+ ///
12
+ /// Possible errors
13
+ ///
14
+ /// - *overrun*, the previous received data was overwritten because it was
15
+ /// not read in a timely manner
16
+ type Error ;
17
+
18
+ /// Reads a single word from the serial interface
19
+ fn read ( & self ) -> nb:: Result < Word , Self :: Error > ;
20
+ }
21
+
22
+ /// Write half of a serial interface
23
+ pub trait Write < Word > {
24
+ /// Write error
25
+ type Error ;
26
+
27
+ /// Writes a single word to the serial interface
28
+ fn write ( & self , word : Word ) -> nb:: Result < ( ) , Self :: Error > ;
29
+ }
You can’t perform that action at this time.
0 commit comments