@@ -76,21 +76,12 @@ pub enum Event {
7676pub mod config {
7777 use crate :: time:: Hertz ;
7878
79- /// The number of bits in a serial data word
80- ///
81- /// Note that the length includes the data bits and any parity bits, but not start or stop bits.
82- #[ derive( Copy , Clone , PartialEq ) ]
83- pub enum WordLength {
84- DataBits8 ,
85- DataBits9 ,
86- }
8779 /// The parity bits appended to each serial data word
8880 ///
8981 /// When enabled parity bits will be automatically added by hardware on transmit, and automatically checked by
9082 /// hardware on receive. For example, `read()` would return [`Error::Parity`](super::Error::Parity).
9183 ///
92- /// Note that parity bits are included in the serial word length, so if parity is used word length should be set to
93- /// [`WordLength::DataBits9`].
84+ /// Note that parity bits are included in the serial word length, so if parity is used word length will be set to 9.
9485 #[ derive( Copy , Clone , PartialEq ) ]
9586 pub enum Parity {
9687 ParityNone ,
@@ -135,7 +126,6 @@ pub mod config {
135126 #[ derive( Copy , Clone ) ]
136127 pub struct Config {
137128 pub baudrate : Hertz ,
138- pub wordlength : WordLength ,
139129 pub parity : Parity ,
140130 pub stopbits : StopBits ,
141131 pub bitorder : BitOrder ,
@@ -152,7 +142,6 @@ pub mod config {
152142 pub fn new < T : Into < Hertz > > ( frequency : T ) -> Self {
153143 Config {
154144 baudrate : frequency. into ( ) ,
155- wordlength : WordLength :: DataBits8 ,
156145 parity : Parity :: ParityNone ,
157146 stopbits : StopBits :: STOP1 ,
158147 bitorder : BitOrder :: LsbFirst ,
@@ -174,36 +163,22 @@ pub mod config {
174163
175164 /// Enables Even Parity
176165 ///
177- /// Note that parity bits are included in the serial word length, so if parity is used word length should be set
178- /// to [`WordLength::DataBits9`] .
166+ /// Note that parity bits are included in the serial word length, so if parity is used word length will be set
167+ /// to 9 .
179168 pub fn parity_even ( mut self ) -> Self {
180169 self . parity = Parity :: ParityEven ;
181170 self
182171 }
183172
184173 /// Enables Odd Parity
185174 ///
186- /// Note that parity bits are included in the serial word length, so if parity is used word length should be set
187- /// to [`WordLength::DataBits9`] .
175+ /// Note that parity bits are included in the serial word length, so if parity is used word length will be set
176+ /// to 9 .
188177 pub fn parity_odd ( mut self ) -> Self {
189178 self . parity = Parity :: ParityOdd ;
190179 self
191180 }
192181
193- pub fn wordlength_8 ( mut self ) -> Self {
194- self . wordlength = WordLength :: DataBits8 ;
195- self
196- }
197-
198- /// Set the serial word length to 9
199- ///
200- /// Note that the HAL currently only supports transmitting 8-bit serial data, so the 9th bit will always be zero
201- /// except when it is a parity bit.
202- pub fn wordlength_9 ( mut self ) -> Self {
203- self . wordlength = WordLength :: DataBits9 ;
204- self
205- }
206-
207182 /// Specify the number of stop bits
208183 pub fn stopbits ( mut self , stopbits : StopBits ) -> Self {
209184 self . stopbits = stopbits;
@@ -617,9 +592,9 @@ macro_rules! usart {
617592 . m1( )
618593 . clear_bit( )
619594 . m0( )
620- . variant( match config. wordlength {
621- WordLength :: DataBits8 => M0 :: BIT8 ,
622- WordLength :: DataBits9 => M0 :: BIT9 ,
595+ . variant( match config. parity {
596+ Parity :: ParityNone => M0 :: BIT8 ,
597+ _ => M0 :: BIT9 ,
623598 } ) . pce( )
624599 . variant( match config. parity {
625600 Parity :: ParityNone => PCE :: DISABLED ,
0 commit comments