@@ -55,12 +55,17 @@ impl FifoThreshold {
55
55
}
56
56
}
57
57
#[ derive( PartialEq , PartialOrd , Clone , Copy ) ]
58
- pub struct BasicConfig {
58
+ pub struct LowPowerConfig {
59
59
pub ( crate ) baudrate : Bps ,
60
60
pub ( crate ) wordlength : WordLength ,
61
61
pub ( crate ) parity : Parity ,
62
62
pub ( crate ) stopbits : StopBits ,
63
63
pub ( crate ) swap : bool ,
64
+ pub ( crate ) fifo_enable : bool ,
65
+ pub ( crate ) tx_fifo_threshold : FifoThreshold ,
66
+ pub ( crate ) rx_fifo_threshold : FifoThreshold ,
67
+ pub ( crate ) tx_fifo_interrupt : bool ,
68
+ pub ( crate ) rx_fifo_interrupt : bool ,
64
69
}
65
70
66
71
#[ derive( PartialEq , PartialOrd , Clone , Copy ) ]
@@ -79,7 +84,7 @@ pub struct FullConfig {
79
84
pub ( crate ) receiver_timeout : Option < u32 > ,
80
85
}
81
86
82
- impl BasicConfig {
87
+ impl LowPowerConfig {
83
88
pub fn baudrate ( mut self , baudrate : Bps ) -> Self {
84
89
self . baudrate = baudrate;
85
90
self
@@ -122,6 +127,31 @@ impl BasicConfig {
122
127
self . swap = true ;
123
128
self
124
129
}
130
+
131
+ pub fn fifo_enable ( mut self ) -> Self {
132
+ self . fifo_enable = true ;
133
+ self
134
+ }
135
+
136
+ pub fn tx_fifo_threshold ( mut self , threshold : FifoThreshold ) -> Self {
137
+ self . tx_fifo_threshold = threshold;
138
+ self
139
+ }
140
+
141
+ pub fn rx_fifo_threshold ( mut self , threshold : FifoThreshold ) -> Self {
142
+ self . rx_fifo_threshold = threshold;
143
+ self
144
+ }
145
+
146
+ pub fn tx_fifo_enable_interrupt ( mut self ) -> Self {
147
+ self . tx_fifo_interrupt = true ;
148
+ self
149
+ }
150
+
151
+ pub fn rx_fifo_enable_interrupt ( mut self ) -> Self {
152
+ self . rx_fifo_interrupt = true ;
153
+ self
154
+ }
125
155
}
126
156
127
157
impl FullConfig {
@@ -204,15 +234,20 @@ impl FullConfig {
204
234
#[ derive( Debug ) ]
205
235
pub struct InvalidConfig ;
206
236
207
- impl Default for BasicConfig {
208
- fn default ( ) -> BasicConfig {
237
+ impl Default for LowPowerConfig {
238
+ fn default ( ) -> LowPowerConfig {
209
239
let baudrate = 19_200 . bps ( ) ;
210
- BasicConfig {
240
+ LowPowerConfig {
211
241
baudrate,
212
242
wordlength : WordLength :: DataBits8 ,
213
243
parity : Parity :: ParityNone ,
214
244
stopbits : StopBits :: STOP1 ,
215
245
swap : false ,
246
+ fifo_enable : false ,
247
+ tx_fifo_threshold : FifoThreshold :: FIFO_8_BYTES ,
248
+ rx_fifo_threshold : FifoThreshold :: FIFO_8_BYTES ,
249
+ tx_fifo_interrupt : false ,
250
+ rx_fifo_interrupt : false ,
216
251
}
217
252
}
218
253
}
0 commit comments