@@ -61,6 +61,8 @@ pub struct LowPowerConfig {
6161 pub ( crate ) parity : Parity ,
6262 pub ( crate ) stopbits : StopBits ,
6363 pub ( crate ) swap : bool ,
64+ pub ( crate ) tx_invert : bool ,
65+ pub ( crate ) rx_invert : bool ,
6466 pub ( crate ) fifo_enable : bool ,
6567 pub ( crate ) tx_fifo_threshold : FifoThreshold ,
6668 pub ( crate ) rx_fifo_threshold : FifoThreshold ,
@@ -75,6 +77,8 @@ pub struct FullConfig {
7577 pub ( crate ) parity : Parity ,
7678 pub ( crate ) stopbits : StopBits ,
7779 pub ( crate ) swap : bool ,
80+ pub ( crate ) tx_invert : bool ,
81+ pub ( crate ) rx_invert : bool ,
7882 pub ( crate ) fifo_enable : bool ,
7983 pub ( crate ) tx_fifo_threshold : FifoThreshold ,
8084 pub ( crate ) rx_fifo_threshold : FifoThreshold ,
@@ -128,6 +132,24 @@ impl LowPowerConfig {
128132 self
129133 }
130134
135+ /// Invert the polarity of the Tx pin
136+ ///
137+ /// The peripheral will treat VDD as a "low" (mark) line value and Gnd as a "high" (idle)
138+ /// value for the Tx pin.
139+ pub fn tx_invert ( mut self ) -> Self {
140+ self . tx_invert = true ;
141+ self
142+ }
143+
144+ /// Invert the polarity of the Rx pin
145+ ///
146+ /// The peripheral will treat VDD as a "low" (mark) line value and Gnd as a "high" (idle)
147+ /// value for the Rx pin.
148+ pub fn rx_invert ( mut self ) -> Self {
149+ self . rx_invert = true ;
150+ self
151+ }
152+
131153 pub fn fifo_enable ( mut self ) -> Self {
132154 self . fifo_enable = true ;
133155 self
@@ -198,6 +220,24 @@ impl FullConfig {
198220 self
199221 }
200222
223+ /// Invert the polarity of the Tx pin
224+ ///
225+ /// The peripheral will treat VDD as a "low" (mark) line value and Gnd as a "high" (idle)
226+ /// value for the Tx pin.
227+ pub fn tx_invert ( mut self ) -> Self {
228+ self . tx_invert = true ;
229+ self
230+ }
231+
232+ /// Invert the polarity of the Rx pin
233+ ///
234+ /// The peripheral will treat VDD as a "low" (mark) line value and Gnd as a "high" (idle)
235+ /// value for the Rx pin.
236+ pub fn rx_invert ( mut self ) -> Self {
237+ self . rx_invert = true ;
238+ self
239+ }
240+
201241 pub fn fifo_enable ( mut self ) -> Self {
202242 self . fifo_enable = true ;
203243 self
@@ -243,6 +283,8 @@ impl Default for LowPowerConfig {
243283 parity : Parity :: ParityNone ,
244284 stopbits : StopBits :: STOP1 ,
245285 swap : false ,
286+ tx_invert : false ,
287+ rx_invert : false ,
246288 fifo_enable : false ,
247289 tx_fifo_threshold : FifoThreshold :: FIFO_8_BYTES ,
248290 rx_fifo_threshold : FifoThreshold :: FIFO_8_BYTES ,
@@ -261,6 +303,8 @@ impl Default for FullConfig {
261303 parity : Parity :: ParityNone ,
262304 stopbits : StopBits :: STOP1 ,
263305 swap : false ,
306+ tx_invert : false ,
307+ rx_invert : false ,
264308 fifo_enable : false ,
265309 tx_fifo_threshold : FifoThreshold :: FIFO_8_BYTES ,
266310 rx_fifo_threshold : FifoThreshold :: FIFO_8_BYTES ,
0 commit comments