k66/uart3/
sfifo.rs

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::SFIFO {
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 `RXUF`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum RXUFR {
48    #[doc = "No receive buffer underflow has occurred since the last time the flag was cleared."]
49    _0,
50    #[doc = "At least one receive buffer underflow has occurred since the last time the flag was cleared."]
51    _1,
52}
53impl RXUFR {
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            RXUFR::_0 => false,
69            RXUFR::_1 => true,
70        }
71    }
72    #[allow(missing_docs)]
73    #[doc(hidden)]
74    #[inline]
75    pub fn _from(value: bool) -> RXUFR {
76        match value {
77            false => RXUFR::_0,
78            true => RXUFR::_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 == RXUFR::_0
85    }
86    #[doc = "Checks if the value of the field is `_1`"]
87    #[inline]
88    pub fn is_1(&self) -> bool {
89        *self == RXUFR::_1
90    }
91}
92#[doc = "Possible values of the field `TXOF`"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum TXOFR {
95    #[doc = "No transmit buffer overflow has occurred since the last time the flag was cleared."]
96    _0,
97    #[doc = "At least one transmit buffer overflow has occurred since the last time the flag was cleared."]
98    _1,
99}
100impl TXOFR {
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            TXOFR::_0 => false,
116            TXOFR::_1 => true,
117        }
118    }
119    #[allow(missing_docs)]
120    #[doc(hidden)]
121    #[inline]
122    pub fn _from(value: bool) -> TXOFR {
123        match value {
124            false => TXOFR::_0,
125            true => TXOFR::_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 == TXOFR::_0
132    }
133    #[doc = "Checks if the value of the field is `_1`"]
134    #[inline]
135    pub fn is_1(&self) -> bool {
136        *self == TXOFR::_1
137    }
138}
139#[doc = "Possible values of the field `RXOF`"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum RXOFR {
142    #[doc = "No receive buffer overflow has occurred since the last time the flag was cleared."]
143    _0,
144    #[doc = "At least one receive buffer overflow has occurred since the last time the flag was cleared."]
145    _1,
146}
147impl RXOFR {
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            RXOFR::_0 => false,
163            RXOFR::_1 => true,
164        }
165    }
166    #[allow(missing_docs)]
167    #[doc(hidden)]
168    #[inline]
169    pub fn _from(value: bool) -> RXOFR {
170        match value {
171            false => RXOFR::_0,
172            true => RXOFR::_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 == RXOFR::_0
179    }
180    #[doc = "Checks if the value of the field is `_1`"]
181    #[inline]
182    pub fn is_1(&self) -> bool {
183        *self == RXOFR::_1
184    }
185}
186#[doc = "Possible values of the field `RXEMPT`"]
187#[derive(Clone, Copy, Debug, PartialEq)]
188pub enum RXEMPTR {
189    #[doc = "Receive buffer is not empty."]
190    _0,
191    #[doc = "Receive buffer is empty."]
192    _1,
193}
194impl RXEMPTR {
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            RXEMPTR::_0 => false,
210            RXEMPTR::_1 => true,
211        }
212    }
213    #[allow(missing_docs)]
214    #[doc(hidden)]
215    #[inline]
216    pub fn _from(value: bool) -> RXEMPTR {
217        match value {
218            false => RXEMPTR::_0,
219            true => RXEMPTR::_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 == RXEMPTR::_0
226    }
227    #[doc = "Checks if the value of the field is `_1`"]
228    #[inline]
229    pub fn is_1(&self) -> bool {
230        *self == RXEMPTR::_1
231    }
232}
233#[doc = "Possible values of the field `TXEMPT`"]
234#[derive(Clone, Copy, Debug, PartialEq)]
235pub enum TXEMPTR {
236    #[doc = "Transmit buffer is not empty."]
237    _0,
238    #[doc = "Transmit buffer is empty."]
239    _1,
240}
241impl TXEMPTR {
242    #[doc = r" Returns `true` if the bit is clear (0)"]
243    #[inline]
244    pub fn bit_is_clear(&self) -> bool {
245        !self.bit()
246    }
247    #[doc = r" Returns `true` if the bit is set (1)"]
248    #[inline]
249    pub fn bit_is_set(&self) -> bool {
250        self.bit()
251    }
252    #[doc = r" Value of the field as raw bits"]
253    #[inline]
254    pub fn bit(&self) -> bool {
255        match *self {
256            TXEMPTR::_0 => false,
257            TXEMPTR::_1 => true,
258        }
259    }
260    #[allow(missing_docs)]
261    #[doc(hidden)]
262    #[inline]
263    pub fn _from(value: bool) -> TXEMPTR {
264        match value {
265            false => TXEMPTR::_0,
266            true => TXEMPTR::_1,
267        }
268    }
269    #[doc = "Checks if the value of the field is `_0`"]
270    #[inline]
271    pub fn is_0(&self) -> bool {
272        *self == TXEMPTR::_0
273    }
274    #[doc = "Checks if the value of the field is `_1`"]
275    #[inline]
276    pub fn is_1(&self) -> bool {
277        *self == TXEMPTR::_1
278    }
279}
280#[doc = "Values that can be written to the field `RXUF`"]
281pub enum RXUFW {
282    #[doc = "No receive buffer underflow has occurred since the last time the flag was cleared."]
283    _0,
284    #[doc = "At least one receive buffer underflow has occurred since the last time the flag was cleared."]
285    _1,
286}
287impl RXUFW {
288    #[allow(missing_docs)]
289    #[doc(hidden)]
290    #[inline]
291    pub fn _bits(&self) -> bool {
292        match *self {
293            RXUFW::_0 => false,
294            RXUFW::_1 => true,
295        }
296    }
297}
298#[doc = r" Proxy"]
299pub struct _RXUFW<'a> {
300    w: &'a mut W,
301}
302impl<'a> _RXUFW<'a> {
303    #[doc = r" Writes `variant` to the field"]
304    #[inline]
305    pub fn variant(self, variant: RXUFW) -> &'a mut W {
306        {
307            self.bit(variant._bits())
308        }
309    }
310    #[doc = "No receive buffer underflow has occurred since the last time the flag was cleared."]
311    #[inline]
312    pub fn _0(self) -> &'a mut W {
313        self.variant(RXUFW::_0)
314    }
315    #[doc = "At least one receive buffer underflow has occurred since the last time the flag was cleared."]
316    #[inline]
317    pub fn _1(self) -> &'a mut W {
318        self.variant(RXUFW::_1)
319    }
320    #[doc = r" Sets the field bit"]
321    pub fn set_bit(self) -> &'a mut W {
322        self.bit(true)
323    }
324    #[doc = r" Clears the field bit"]
325    pub fn clear_bit(self) -> &'a mut W {
326        self.bit(false)
327    }
328    #[doc = r" Writes raw bits to the field"]
329    #[inline]
330    pub fn bit(self, value: bool) -> &'a mut W {
331        const MASK: bool = true;
332        const OFFSET: u8 = 0;
333        self.w.bits &= !((MASK as u8) << OFFSET);
334        self.w.bits |= ((value & MASK) as u8) << OFFSET;
335        self.w
336    }
337}
338#[doc = "Values that can be written to the field `TXOF`"]
339pub enum TXOFW {
340    #[doc = "No transmit buffer overflow has occurred since the last time the flag was cleared."]
341    _0,
342    #[doc = "At least one transmit buffer overflow has occurred since the last time the flag was cleared."]
343    _1,
344}
345impl TXOFW {
346    #[allow(missing_docs)]
347    #[doc(hidden)]
348    #[inline]
349    pub fn _bits(&self) -> bool {
350        match *self {
351            TXOFW::_0 => false,
352            TXOFW::_1 => true,
353        }
354    }
355}
356#[doc = r" Proxy"]
357pub struct _TXOFW<'a> {
358    w: &'a mut W,
359}
360impl<'a> _TXOFW<'a> {
361    #[doc = r" Writes `variant` to the field"]
362    #[inline]
363    pub fn variant(self, variant: TXOFW) -> &'a mut W {
364        {
365            self.bit(variant._bits())
366        }
367    }
368    #[doc = "No transmit buffer overflow has occurred since the last time the flag was cleared."]
369    #[inline]
370    pub fn _0(self) -> &'a mut W {
371        self.variant(TXOFW::_0)
372    }
373    #[doc = "At least one transmit buffer overflow has occurred since the last time the flag was cleared."]
374    #[inline]
375    pub fn _1(self) -> &'a mut W {
376        self.variant(TXOFW::_1)
377    }
378    #[doc = r" Sets the field bit"]
379    pub fn set_bit(self) -> &'a mut W {
380        self.bit(true)
381    }
382    #[doc = r" Clears the field bit"]
383    pub fn clear_bit(self) -> &'a mut W {
384        self.bit(false)
385    }
386    #[doc = r" Writes raw bits to the field"]
387    #[inline]
388    pub fn bit(self, value: bool) -> &'a mut W {
389        const MASK: bool = true;
390        const OFFSET: u8 = 1;
391        self.w.bits &= !((MASK as u8) << OFFSET);
392        self.w.bits |= ((value & MASK) as u8) << OFFSET;
393        self.w
394    }
395}
396#[doc = "Values that can be written to the field `RXOF`"]
397pub enum RXOFW {
398    #[doc = "No receive buffer overflow has occurred since the last time the flag was cleared."]
399    _0,
400    #[doc = "At least one receive buffer overflow has occurred since the last time the flag was cleared."]
401    _1,
402}
403impl RXOFW {
404    #[allow(missing_docs)]
405    #[doc(hidden)]
406    #[inline]
407    pub fn _bits(&self) -> bool {
408        match *self {
409            RXOFW::_0 => false,
410            RXOFW::_1 => true,
411        }
412    }
413}
414#[doc = r" Proxy"]
415pub struct _RXOFW<'a> {
416    w: &'a mut W,
417}
418impl<'a> _RXOFW<'a> {
419    #[doc = r" Writes `variant` to the field"]
420    #[inline]
421    pub fn variant(self, variant: RXOFW) -> &'a mut W {
422        {
423            self.bit(variant._bits())
424        }
425    }
426    #[doc = "No receive buffer overflow has occurred since the last time the flag was cleared."]
427    #[inline]
428    pub fn _0(self) -> &'a mut W {
429        self.variant(RXOFW::_0)
430    }
431    #[doc = "At least one receive buffer overflow has occurred since the last time the flag was cleared."]
432    #[inline]
433    pub fn _1(self) -> &'a mut W {
434        self.variant(RXOFW::_1)
435    }
436    #[doc = r" Sets the field bit"]
437    pub fn set_bit(self) -> &'a mut W {
438        self.bit(true)
439    }
440    #[doc = r" Clears the field bit"]
441    pub fn clear_bit(self) -> &'a mut W {
442        self.bit(false)
443    }
444    #[doc = r" Writes raw bits to the field"]
445    #[inline]
446    pub fn bit(self, value: bool) -> &'a mut W {
447        const MASK: bool = true;
448        const OFFSET: u8 = 2;
449        self.w.bits &= !((MASK as u8) << OFFSET);
450        self.w.bits |= ((value & MASK) as u8) << OFFSET;
451        self.w
452    }
453}
454impl R {
455    #[doc = r" Value of the register as raw bits"]
456    #[inline]
457    pub fn bits(&self) -> u8 {
458        self.bits
459    }
460    #[doc = "Bit 0 - Receiver Buffer Underflow Flag"]
461    #[inline]
462    pub fn rxuf(&self) -> RXUFR {
463        RXUFR::_from({
464            const MASK: bool = true;
465            const OFFSET: u8 = 0;
466            ((self.bits >> OFFSET) & MASK as u8) != 0
467        })
468    }
469    #[doc = "Bit 1 - Transmitter Buffer Overflow Flag"]
470    #[inline]
471    pub fn txof(&self) -> TXOFR {
472        TXOFR::_from({
473            const MASK: bool = true;
474            const OFFSET: u8 = 1;
475            ((self.bits >> OFFSET) & MASK as u8) != 0
476        })
477    }
478    #[doc = "Bit 2 - Receiver Buffer Overflow Flag"]
479    #[inline]
480    pub fn rxof(&self) -> RXOFR {
481        RXOFR::_from({
482            const MASK: bool = true;
483            const OFFSET: u8 = 2;
484            ((self.bits >> OFFSET) & MASK as u8) != 0
485        })
486    }
487    #[doc = "Bit 6 - Receive Buffer/FIFO Empty"]
488    #[inline]
489    pub fn rxempt(&self) -> RXEMPTR {
490        RXEMPTR::_from({
491            const MASK: bool = true;
492            const OFFSET: u8 = 6;
493            ((self.bits >> OFFSET) & MASK as u8) != 0
494        })
495    }
496    #[doc = "Bit 7 - Transmit Buffer/FIFO Empty"]
497    #[inline]
498    pub fn txempt(&self) -> TXEMPTR {
499        TXEMPTR::_from({
500            const MASK: bool = true;
501            const OFFSET: u8 = 7;
502            ((self.bits >> OFFSET) & MASK as u8) != 0
503        })
504    }
505}
506impl W {
507    #[doc = r" Reset value of the register"]
508    #[inline]
509    pub fn reset_value() -> W {
510        W { bits: 192 }
511    }
512    #[doc = r" Writes raw bits to the register"]
513    #[inline]
514    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
515        self.bits = bits;
516        self
517    }
518    #[doc = "Bit 0 - Receiver Buffer Underflow Flag"]
519    #[inline]
520    pub fn rxuf(&mut self) -> _RXUFW {
521        _RXUFW { w: self }
522    }
523    #[doc = "Bit 1 - Transmitter Buffer Overflow Flag"]
524    #[inline]
525    pub fn txof(&mut self) -> _TXOFW {
526        _TXOFW { w: self }
527    }
528    #[doc = "Bit 2 - Receiver Buffer Overflow Flag"]
529    #[inline]
530    pub fn rxof(&mut self) -> _RXOFW {
531        _RXOFW { w: self }
532    }
533}