1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u8,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u8,
8}
9impl super::MODEM {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = "Possible values of the field `TXCTSE`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum TXCTSER {
48 #[doc = "CTS has no effect on the transmitter."]
49 _0,
50 #[doc = "Enables clear-to-send operation. The transmitter checks the state of CTS each time it is ready to send a character. If CTS is asserted, the character is sent. If CTS is deasserted, the signal TXD remains in the mark state and transmission is delayed until CTS is asserted. Changes in CTS as a character is being sent do not affect its transmission."]
51 _1,
52}
53impl TXCTSER {
54 #[doc = r" Returns `true` if the bit is clear (0)"]
55 #[inline]
56 pub fn bit_is_clear(&self) -> bool {
57 !self.bit()
58 }
59 #[doc = r" Returns `true` if the bit is set (1)"]
60 #[inline]
61 pub fn bit_is_set(&self) -> bool {
62 self.bit()
63 }
64 #[doc = r" Value of the field as raw bits"]
65 #[inline]
66 pub fn bit(&self) -> bool {
67 match *self {
68 TXCTSER::_0 => false,
69 TXCTSER::_1 => true,
70 }
71 }
72 #[allow(missing_docs)]
73 #[doc(hidden)]
74 #[inline]
75 pub fn _from(value: bool) -> TXCTSER {
76 match value {
77 false => TXCTSER::_0,
78 true => TXCTSER::_1,
79 }
80 }
81 #[doc = "Checks if the value of the field is `_0`"]
82 #[inline]
83 pub fn is_0(&self) -> bool {
84 *self == TXCTSER::_0
85 }
86 #[doc = "Checks if the value of the field is `_1`"]
87 #[inline]
88 pub fn is_1(&self) -> bool {
89 *self == TXCTSER::_1
90 }
91}
92#[doc = "Possible values of the field `TXRTSE`"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum TXRTSER {
95 #[doc = "The transmitter has no effect on RTS."]
96 _0,
97 #[doc = "When a character is placed into an empty transmitter data buffer(FIFO), RTS asserts one bit time before the start bit is transmitted. RTS deasserts one bit time after all characters in the transmitter data buffer(FIFO) and shift register are completely sent, including the last stop bit."]
98 _1,
99}
100impl TXRTSER {
101 #[doc = r" Returns `true` if the bit is clear (0)"]
102 #[inline]
103 pub fn bit_is_clear(&self) -> bool {
104 !self.bit()
105 }
106 #[doc = r" Returns `true` if the bit is set (1)"]
107 #[inline]
108 pub fn bit_is_set(&self) -> bool {
109 self.bit()
110 }
111 #[doc = r" Value of the field as raw bits"]
112 #[inline]
113 pub fn bit(&self) -> bool {
114 match *self {
115 TXRTSER::_0 => false,
116 TXRTSER::_1 => true,
117 }
118 }
119 #[allow(missing_docs)]
120 #[doc(hidden)]
121 #[inline]
122 pub fn _from(value: bool) -> TXRTSER {
123 match value {
124 false => TXRTSER::_0,
125 true => TXRTSER::_1,
126 }
127 }
128 #[doc = "Checks if the value of the field is `_0`"]
129 #[inline]
130 pub fn is_0(&self) -> bool {
131 *self == TXRTSER::_0
132 }
133 #[doc = "Checks if the value of the field is `_1`"]
134 #[inline]
135 pub fn is_1(&self) -> bool {
136 *self == TXRTSER::_1
137 }
138}
139#[doc = "Possible values of the field `TXRTSPOL`"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum TXRTSPOLR {
142 #[doc = "Transmitter RTS is active low."]
143 _0,
144 #[doc = "Transmitter RTS is active high."]
145 _1,
146}
147impl TXRTSPOLR {
148 #[doc = r" Returns `true` if the bit is clear (0)"]
149 #[inline]
150 pub fn bit_is_clear(&self) -> bool {
151 !self.bit()
152 }
153 #[doc = r" Returns `true` if the bit is set (1)"]
154 #[inline]
155 pub fn bit_is_set(&self) -> bool {
156 self.bit()
157 }
158 #[doc = r" Value of the field as raw bits"]
159 #[inline]
160 pub fn bit(&self) -> bool {
161 match *self {
162 TXRTSPOLR::_0 => false,
163 TXRTSPOLR::_1 => true,
164 }
165 }
166 #[allow(missing_docs)]
167 #[doc(hidden)]
168 #[inline]
169 pub fn _from(value: bool) -> TXRTSPOLR {
170 match value {
171 false => TXRTSPOLR::_0,
172 true => TXRTSPOLR::_1,
173 }
174 }
175 #[doc = "Checks if the value of the field is `_0`"]
176 #[inline]
177 pub fn is_0(&self) -> bool {
178 *self == TXRTSPOLR::_0
179 }
180 #[doc = "Checks if the value of the field is `_1`"]
181 #[inline]
182 pub fn is_1(&self) -> bool {
183 *self == TXRTSPOLR::_1
184 }
185}
186#[doc = "Possible values of the field `RXRTSE`"]
187#[derive(Clone, Copy, Debug, PartialEq)]
188pub enum RXRTSER {
189 #[doc = "The receiver has no effect on RTS."]
190 _0,
191 #[doc = "RTS is deasserted if the number of characters in the receiver data register (FIFO) is equal to or greater than RWFIFO[RXWATER]. RTS is asserted when the number of characters in the receiver data register (FIFO) is less than RWFIFO[RXWATER]."]
192 _1,
193}
194impl RXRTSER {
195 #[doc = r" Returns `true` if the bit is clear (0)"]
196 #[inline]
197 pub fn bit_is_clear(&self) -> bool {
198 !self.bit()
199 }
200 #[doc = r" Returns `true` if the bit is set (1)"]
201 #[inline]
202 pub fn bit_is_set(&self) -> bool {
203 self.bit()
204 }
205 #[doc = r" Value of the field as raw bits"]
206 #[inline]
207 pub fn bit(&self) -> bool {
208 match *self {
209 RXRTSER::_0 => false,
210 RXRTSER::_1 => true,
211 }
212 }
213 #[allow(missing_docs)]
214 #[doc(hidden)]
215 #[inline]
216 pub fn _from(value: bool) -> RXRTSER {
217 match value {
218 false => RXRTSER::_0,
219 true => RXRTSER::_1,
220 }
221 }
222 #[doc = "Checks if the value of the field is `_0`"]
223 #[inline]
224 pub fn is_0(&self) -> bool {
225 *self == RXRTSER::_0
226 }
227 #[doc = "Checks if the value of the field is `_1`"]
228 #[inline]
229 pub fn is_1(&self) -> bool {
230 *self == RXRTSER::_1
231 }
232}
233#[doc = "Values that can be written to the field `TXCTSE`"]
234pub enum TXCTSEW {
235 #[doc = "CTS has no effect on the transmitter."]
236 _0,
237 #[doc = "Enables clear-to-send operation. The transmitter checks the state of CTS each time it is ready to send a character. If CTS is asserted, the character is sent. If CTS is deasserted, the signal TXD remains in the mark state and transmission is delayed until CTS is asserted. Changes in CTS as a character is being sent do not affect its transmission."]
238 _1,
239}
240impl TXCTSEW {
241 #[allow(missing_docs)]
242 #[doc(hidden)]
243 #[inline]
244 pub fn _bits(&self) -> bool {
245 match *self {
246 TXCTSEW::_0 => false,
247 TXCTSEW::_1 => true,
248 }
249 }
250}
251#[doc = r" Proxy"]
252pub struct _TXCTSEW<'a> {
253 w: &'a mut W,
254}
255impl<'a> _TXCTSEW<'a> {
256 #[doc = r" Writes `variant` to the field"]
257 #[inline]
258 pub fn variant(self, variant: TXCTSEW) -> &'a mut W {
259 {
260 self.bit(variant._bits())
261 }
262 }
263 #[doc = "CTS has no effect on the transmitter."]
264 #[inline]
265 pub fn _0(self) -> &'a mut W {
266 self.variant(TXCTSEW::_0)
267 }
268 #[doc = "Enables clear-to-send operation. The transmitter checks the state of CTS each time it is ready to send a character. If CTS is asserted, the character is sent. If CTS is deasserted, the signal TXD remains in the mark state and transmission is delayed until CTS is asserted. Changes in CTS as a character is being sent do not affect its transmission."]
269 #[inline]
270 pub fn _1(self) -> &'a mut W {
271 self.variant(TXCTSEW::_1)
272 }
273 #[doc = r" Sets the field bit"]
274 pub fn set_bit(self) -> &'a mut W {
275 self.bit(true)
276 }
277 #[doc = r" Clears the field bit"]
278 pub fn clear_bit(self) -> &'a mut W {
279 self.bit(false)
280 }
281 #[doc = r" Writes raw bits to the field"]
282 #[inline]
283 pub fn bit(self, value: bool) -> &'a mut W {
284 const MASK: bool = true;
285 const OFFSET: u8 = 0;
286 self.w.bits &= !((MASK as u8) << OFFSET);
287 self.w.bits |= ((value & MASK) as u8) << OFFSET;
288 self.w
289 }
290}
291#[doc = "Values that can be written to the field `TXRTSE`"]
292pub enum TXRTSEW {
293 #[doc = "The transmitter has no effect on RTS."]
294 _0,
295 #[doc = "When a character is placed into an empty transmitter data buffer(FIFO), RTS asserts one bit time before the start bit is transmitted. RTS deasserts one bit time after all characters in the transmitter data buffer(FIFO) and shift register are completely sent, including the last stop bit."]
296 _1,
297}
298impl TXRTSEW {
299 #[allow(missing_docs)]
300 #[doc(hidden)]
301 #[inline]
302 pub fn _bits(&self) -> bool {
303 match *self {
304 TXRTSEW::_0 => false,
305 TXRTSEW::_1 => true,
306 }
307 }
308}
309#[doc = r" Proxy"]
310pub struct _TXRTSEW<'a> {
311 w: &'a mut W,
312}
313impl<'a> _TXRTSEW<'a> {
314 #[doc = r" Writes `variant` to the field"]
315 #[inline]
316 pub fn variant(self, variant: TXRTSEW) -> &'a mut W {
317 {
318 self.bit(variant._bits())
319 }
320 }
321 #[doc = "The transmitter has no effect on RTS."]
322 #[inline]
323 pub fn _0(self) -> &'a mut W {
324 self.variant(TXRTSEW::_0)
325 }
326 #[doc = "When a character is placed into an empty transmitter data buffer(FIFO), RTS asserts one bit time before the start bit is transmitted. RTS deasserts one bit time after all characters in the transmitter data buffer(FIFO) and shift register are completely sent, including the last stop bit."]
327 #[inline]
328 pub fn _1(self) -> &'a mut W {
329 self.variant(TXRTSEW::_1)
330 }
331 #[doc = r" Sets the field bit"]
332 pub fn set_bit(self) -> &'a mut W {
333 self.bit(true)
334 }
335 #[doc = r" Clears the field bit"]
336 pub fn clear_bit(self) -> &'a mut W {
337 self.bit(false)
338 }
339 #[doc = r" Writes raw bits to the field"]
340 #[inline]
341 pub fn bit(self, value: bool) -> &'a mut W {
342 const MASK: bool = true;
343 const OFFSET: u8 = 1;
344 self.w.bits &= !((MASK as u8) << OFFSET);
345 self.w.bits |= ((value & MASK) as u8) << OFFSET;
346 self.w
347 }
348}
349#[doc = "Values that can be written to the field `TXRTSPOL`"]
350pub enum TXRTSPOLW {
351 #[doc = "Transmitter RTS is active low."]
352 _0,
353 #[doc = "Transmitter RTS is active high."]
354 _1,
355}
356impl TXRTSPOLW {
357 #[allow(missing_docs)]
358 #[doc(hidden)]
359 #[inline]
360 pub fn _bits(&self) -> bool {
361 match *self {
362 TXRTSPOLW::_0 => false,
363 TXRTSPOLW::_1 => true,
364 }
365 }
366}
367#[doc = r" Proxy"]
368pub struct _TXRTSPOLW<'a> {
369 w: &'a mut W,
370}
371impl<'a> _TXRTSPOLW<'a> {
372 #[doc = r" Writes `variant` to the field"]
373 #[inline]
374 pub fn variant(self, variant: TXRTSPOLW) -> &'a mut W {
375 {
376 self.bit(variant._bits())
377 }
378 }
379 #[doc = "Transmitter RTS is active low."]
380 #[inline]
381 pub fn _0(self) -> &'a mut W {
382 self.variant(TXRTSPOLW::_0)
383 }
384 #[doc = "Transmitter RTS is active high."]
385 #[inline]
386 pub fn _1(self) -> &'a mut W {
387 self.variant(TXRTSPOLW::_1)
388 }
389 #[doc = r" Sets the field bit"]
390 pub fn set_bit(self) -> &'a mut W {
391 self.bit(true)
392 }
393 #[doc = r" Clears the field bit"]
394 pub fn clear_bit(self) -> &'a mut W {
395 self.bit(false)
396 }
397 #[doc = r" Writes raw bits to the field"]
398 #[inline]
399 pub fn bit(self, value: bool) -> &'a mut W {
400 const MASK: bool = true;
401 const OFFSET: u8 = 2;
402 self.w.bits &= !((MASK as u8) << OFFSET);
403 self.w.bits |= ((value & MASK) as u8) << OFFSET;
404 self.w
405 }
406}
407#[doc = "Values that can be written to the field `RXRTSE`"]
408pub enum RXRTSEW {
409 #[doc = "The receiver has no effect on RTS."]
410 _0,
411 #[doc = "RTS is deasserted if the number of characters in the receiver data register (FIFO) is equal to or greater than RWFIFO[RXWATER]. RTS is asserted when the number of characters in the receiver data register (FIFO) is less than RWFIFO[RXWATER]."]
412 _1,
413}
414impl RXRTSEW {
415 #[allow(missing_docs)]
416 #[doc(hidden)]
417 #[inline]
418 pub fn _bits(&self) -> bool {
419 match *self {
420 RXRTSEW::_0 => false,
421 RXRTSEW::_1 => true,
422 }
423 }
424}
425#[doc = r" Proxy"]
426pub struct _RXRTSEW<'a> {
427 w: &'a mut W,
428}
429impl<'a> _RXRTSEW<'a> {
430 #[doc = r" Writes `variant` to the field"]
431 #[inline]
432 pub fn variant(self, variant: RXRTSEW) -> &'a mut W {
433 {
434 self.bit(variant._bits())
435 }
436 }
437 #[doc = "The receiver has no effect on RTS."]
438 #[inline]
439 pub fn _0(self) -> &'a mut W {
440 self.variant(RXRTSEW::_0)
441 }
442 #[doc = "RTS is deasserted if the number of characters in the receiver data register (FIFO) is equal to or greater than RWFIFO[RXWATER]. RTS is asserted when the number of characters in the receiver data register (FIFO) is less than RWFIFO[RXWATER]."]
443 #[inline]
444 pub fn _1(self) -> &'a mut W {
445 self.variant(RXRTSEW::_1)
446 }
447 #[doc = r" Sets the field bit"]
448 pub fn set_bit(self) -> &'a mut W {
449 self.bit(true)
450 }
451 #[doc = r" Clears the field bit"]
452 pub fn clear_bit(self) -> &'a mut W {
453 self.bit(false)
454 }
455 #[doc = r" Writes raw bits to the field"]
456 #[inline]
457 pub fn bit(self, value: bool) -> &'a mut W {
458 const MASK: bool = true;
459 const OFFSET: u8 = 3;
460 self.w.bits &= !((MASK as u8) << OFFSET);
461 self.w.bits |= ((value & MASK) as u8) << OFFSET;
462 self.w
463 }
464}
465impl R {
466 #[doc = r" Value of the register as raw bits"]
467 #[inline]
468 pub fn bits(&self) -> u8 {
469 self.bits
470 }
471 #[doc = "Bit 0 - Transmitter clear-to-send enable"]
472 #[inline]
473 pub fn txctse(&self) -> TXCTSER {
474 TXCTSER::_from({
475 const MASK: bool = true;
476 const OFFSET: u8 = 0;
477 ((self.bits >> OFFSET) & MASK as u8) != 0
478 })
479 }
480 #[doc = "Bit 1 - Transmitter request-to-send enable"]
481 #[inline]
482 pub fn txrtse(&self) -> TXRTSER {
483 TXRTSER::_from({
484 const MASK: bool = true;
485 const OFFSET: u8 = 1;
486 ((self.bits >> OFFSET) & MASK as u8) != 0
487 })
488 }
489 #[doc = "Bit 2 - Transmitter request-to-send polarity"]
490 #[inline]
491 pub fn txrtspol(&self) -> TXRTSPOLR {
492 TXRTSPOLR::_from({
493 const MASK: bool = true;
494 const OFFSET: u8 = 2;
495 ((self.bits >> OFFSET) & MASK as u8) != 0
496 })
497 }
498 #[doc = "Bit 3 - Receiver request-to-send enable"]
499 #[inline]
500 pub fn rxrtse(&self) -> RXRTSER {
501 RXRTSER::_from({
502 const MASK: bool = true;
503 const OFFSET: u8 = 3;
504 ((self.bits >> OFFSET) & MASK as u8) != 0
505 })
506 }
507}
508impl W {
509 #[doc = r" Reset value of the register"]
510 #[inline]
511 pub fn reset_value() -> W {
512 W { bits: 0 }
513 }
514 #[doc = r" Writes raw bits to the register"]
515 #[inline]
516 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
517 self.bits = bits;
518 self
519 }
520 #[doc = "Bit 0 - Transmitter clear-to-send enable"]
521 #[inline]
522 pub fn txctse(&mut self) -> _TXCTSEW {
523 _TXCTSEW { w: self }
524 }
525 #[doc = "Bit 1 - Transmitter request-to-send enable"]
526 #[inline]
527 pub fn txrtse(&mut self) -> _TXRTSEW {
528 _TXRTSEW { w: self }
529 }
530 #[doc = "Bit 2 - Transmitter request-to-send polarity"]
531 #[inline]
532 pub fn txrtspol(&mut self) -> _TXRTSPOLW {
533 _TXRTSPOLW { w: self }
534 }
535 #[doc = "Bit 3 - Receiver request-to-send enable"]
536 #[inline]
537 pub fn rxrtse(&mut self) -> _RXRTSEW {
538 _RXRTSEW { w: self }
539 }
540}