stm32l4x2_pac/usart3/
icr.rs

1#[doc = r" Value to write to the register"]
2pub struct W {
3    bits: u32,
4}
5impl super::ICR {
6    #[doc = r" Writes to the register"]
7    #[inline]
8    pub fn write<F>(&self, f: F)
9    where
10        F: FnOnce(&mut W) -> &mut W,
11    {
12        let mut w = W::reset_value();
13        f(&mut w);
14        self.register.set(w.bits);
15    }
16}
17#[doc = "Values that can be written to the field `WUCF`"]
18pub enum WUCFW {
19    #[doc = "Clears the WUF flag in the ISR register"]
20    CLEAR,
21}
22impl WUCFW {
23    #[allow(missing_docs)]
24    #[doc(hidden)]
25    #[inline]
26    pub fn _bits(&self) -> bool {
27        match *self {
28            WUCFW::CLEAR => true,
29        }
30    }
31}
32#[doc = r" Proxy"]
33pub struct _WUCFW<'a> {
34    w: &'a mut W,
35}
36impl<'a> _WUCFW<'a> {
37    #[doc = r" Writes `variant` to the field"]
38    #[inline]
39    pub fn variant(self, variant: WUCFW) -> &'a mut W {
40        {
41            self.bit(variant._bits())
42        }
43    }
44    #[doc = "Clears the WUF flag in the ISR register"]
45    #[inline]
46    pub fn clear(self) -> &'a mut W {
47        self.variant(WUCFW::CLEAR)
48    }
49    #[doc = r" Sets the field bit"]
50    pub fn set_bit(self) -> &'a mut W {
51        self.bit(true)
52    }
53    #[doc = r" Clears the field bit"]
54    pub fn clear_bit(self) -> &'a mut W {
55        self.bit(false)
56    }
57    #[doc = r" Writes raw bits to the field"]
58    #[inline]
59    pub fn bit(self, value: bool) -> &'a mut W {
60        const MASK: bool = true;
61        const OFFSET: u8 = 20;
62        self.w.bits &= !((MASK as u32) << OFFSET);
63        self.w.bits |= ((value & MASK) as u32) << OFFSET;
64        self.w
65    }
66}
67#[doc = "Values that can be written to the field `CMCF`"]
68pub enum CMCFW {
69    #[doc = "Clears the CMF flag in the ISR register"]
70    CLEAR,
71}
72impl CMCFW {
73    #[allow(missing_docs)]
74    #[doc(hidden)]
75    #[inline]
76    pub fn _bits(&self) -> bool {
77        match *self {
78            CMCFW::CLEAR => true,
79        }
80    }
81}
82#[doc = r" Proxy"]
83pub struct _CMCFW<'a> {
84    w: &'a mut W,
85}
86impl<'a> _CMCFW<'a> {
87    #[doc = r" Writes `variant` to the field"]
88    #[inline]
89    pub fn variant(self, variant: CMCFW) -> &'a mut W {
90        {
91            self.bit(variant._bits())
92        }
93    }
94    #[doc = "Clears the CMF flag in the ISR register"]
95    #[inline]
96    pub fn clear(self) -> &'a mut W {
97        self.variant(CMCFW::CLEAR)
98    }
99    #[doc = r" Sets the field bit"]
100    pub fn set_bit(self) -> &'a mut W {
101        self.bit(true)
102    }
103    #[doc = r" Clears the field bit"]
104    pub fn clear_bit(self) -> &'a mut W {
105        self.bit(false)
106    }
107    #[doc = r" Writes raw bits to the field"]
108    #[inline]
109    pub fn bit(self, value: bool) -> &'a mut W {
110        const MASK: bool = true;
111        const OFFSET: u8 = 17;
112        self.w.bits &= !((MASK as u32) << OFFSET);
113        self.w.bits |= ((value & MASK) as u32) << OFFSET;
114        self.w
115    }
116}
117#[doc = "Values that can be written to the field `EOBCF`"]
118pub enum EOBCFW {
119    #[doc = "Clears the EOBF flag in the ISR register"]
120    CLEAR,
121}
122impl EOBCFW {
123    #[allow(missing_docs)]
124    #[doc(hidden)]
125    #[inline]
126    pub fn _bits(&self) -> bool {
127        match *self {
128            EOBCFW::CLEAR => true,
129        }
130    }
131}
132#[doc = r" Proxy"]
133pub struct _EOBCFW<'a> {
134    w: &'a mut W,
135}
136impl<'a> _EOBCFW<'a> {
137    #[doc = r" Writes `variant` to the field"]
138    #[inline]
139    pub fn variant(self, variant: EOBCFW) -> &'a mut W {
140        {
141            self.bit(variant._bits())
142        }
143    }
144    #[doc = "Clears the EOBF flag in the ISR register"]
145    #[inline]
146    pub fn clear(self) -> &'a mut W {
147        self.variant(EOBCFW::CLEAR)
148    }
149    #[doc = r" Sets the field bit"]
150    pub fn set_bit(self) -> &'a mut W {
151        self.bit(true)
152    }
153    #[doc = r" Clears the field bit"]
154    pub fn clear_bit(self) -> &'a mut W {
155        self.bit(false)
156    }
157    #[doc = r" Writes raw bits to the field"]
158    #[inline]
159    pub fn bit(self, value: bool) -> &'a mut W {
160        const MASK: bool = true;
161        const OFFSET: u8 = 12;
162        self.w.bits &= !((MASK as u32) << OFFSET);
163        self.w.bits |= ((value & MASK) as u32) << OFFSET;
164        self.w
165    }
166}
167#[doc = "Values that can be written to the field `RTOCF`"]
168pub enum RTOCFW {
169    #[doc = "Clears the RTOF flag in the ISR register"]
170    CLEAR,
171}
172impl RTOCFW {
173    #[allow(missing_docs)]
174    #[doc(hidden)]
175    #[inline]
176    pub fn _bits(&self) -> bool {
177        match *self {
178            RTOCFW::CLEAR => true,
179        }
180    }
181}
182#[doc = r" Proxy"]
183pub struct _RTOCFW<'a> {
184    w: &'a mut W,
185}
186impl<'a> _RTOCFW<'a> {
187    #[doc = r" Writes `variant` to the field"]
188    #[inline]
189    pub fn variant(self, variant: RTOCFW) -> &'a mut W {
190        {
191            self.bit(variant._bits())
192        }
193    }
194    #[doc = "Clears the RTOF flag in the ISR register"]
195    #[inline]
196    pub fn clear(self) -> &'a mut W {
197        self.variant(RTOCFW::CLEAR)
198    }
199    #[doc = r" Sets the field bit"]
200    pub fn set_bit(self) -> &'a mut W {
201        self.bit(true)
202    }
203    #[doc = r" Clears the field bit"]
204    pub fn clear_bit(self) -> &'a mut W {
205        self.bit(false)
206    }
207    #[doc = r" Writes raw bits to the field"]
208    #[inline]
209    pub fn bit(self, value: bool) -> &'a mut W {
210        const MASK: bool = true;
211        const OFFSET: u8 = 11;
212        self.w.bits &= !((MASK as u32) << OFFSET);
213        self.w.bits |= ((value & MASK) as u32) << OFFSET;
214        self.w
215    }
216}
217#[doc = "Values that can be written to the field `CTSCF`"]
218pub enum CTSCFW {
219    #[doc = "Clears the CTSIF flag in the ISR register"]
220    CLEAR,
221}
222impl CTSCFW {
223    #[allow(missing_docs)]
224    #[doc(hidden)]
225    #[inline]
226    pub fn _bits(&self) -> bool {
227        match *self {
228            CTSCFW::CLEAR => true,
229        }
230    }
231}
232#[doc = r" Proxy"]
233pub struct _CTSCFW<'a> {
234    w: &'a mut W,
235}
236impl<'a> _CTSCFW<'a> {
237    #[doc = r" Writes `variant` to the field"]
238    #[inline]
239    pub fn variant(self, variant: CTSCFW) -> &'a mut W {
240        {
241            self.bit(variant._bits())
242        }
243    }
244    #[doc = "Clears the CTSIF flag in the ISR register"]
245    #[inline]
246    pub fn clear(self) -> &'a mut W {
247        self.variant(CTSCFW::CLEAR)
248    }
249    #[doc = r" Sets the field bit"]
250    pub fn set_bit(self) -> &'a mut W {
251        self.bit(true)
252    }
253    #[doc = r" Clears the field bit"]
254    pub fn clear_bit(self) -> &'a mut W {
255        self.bit(false)
256    }
257    #[doc = r" Writes raw bits to the field"]
258    #[inline]
259    pub fn bit(self, value: bool) -> &'a mut W {
260        const MASK: bool = true;
261        const OFFSET: u8 = 9;
262        self.w.bits &= !((MASK as u32) << OFFSET);
263        self.w.bits |= ((value & MASK) as u32) << OFFSET;
264        self.w
265    }
266}
267#[doc = "Values that can be written to the field `LBDCF`"]
268pub enum LBDCFW {
269    #[doc = "Clears the LBDF flag in the ISR register"]
270    CLEAR,
271}
272impl LBDCFW {
273    #[allow(missing_docs)]
274    #[doc(hidden)]
275    #[inline]
276    pub fn _bits(&self) -> bool {
277        match *self {
278            LBDCFW::CLEAR => true,
279        }
280    }
281}
282#[doc = r" Proxy"]
283pub struct _LBDCFW<'a> {
284    w: &'a mut W,
285}
286impl<'a> _LBDCFW<'a> {
287    #[doc = r" Writes `variant` to the field"]
288    #[inline]
289    pub fn variant(self, variant: LBDCFW) -> &'a mut W {
290        {
291            self.bit(variant._bits())
292        }
293    }
294    #[doc = "Clears the LBDF flag in the ISR register"]
295    #[inline]
296    pub fn clear(self) -> &'a mut W {
297        self.variant(LBDCFW::CLEAR)
298    }
299    #[doc = r" Sets the field bit"]
300    pub fn set_bit(self) -> &'a mut W {
301        self.bit(true)
302    }
303    #[doc = r" Clears the field bit"]
304    pub fn clear_bit(self) -> &'a mut W {
305        self.bit(false)
306    }
307    #[doc = r" Writes raw bits to the field"]
308    #[inline]
309    pub fn bit(self, value: bool) -> &'a mut W {
310        const MASK: bool = true;
311        const OFFSET: u8 = 8;
312        self.w.bits &= !((MASK as u32) << OFFSET);
313        self.w.bits |= ((value & MASK) as u32) << OFFSET;
314        self.w
315    }
316}
317#[doc = "Values that can be written to the field `TCCF`"]
318pub enum TCCFW {
319    #[doc = "Clears the TC flag in the ISR register"]
320    CLEAR,
321}
322impl TCCFW {
323    #[allow(missing_docs)]
324    #[doc(hidden)]
325    #[inline]
326    pub fn _bits(&self) -> bool {
327        match *self {
328            TCCFW::CLEAR => true,
329        }
330    }
331}
332#[doc = r" Proxy"]
333pub struct _TCCFW<'a> {
334    w: &'a mut W,
335}
336impl<'a> _TCCFW<'a> {
337    #[doc = r" Writes `variant` to the field"]
338    #[inline]
339    pub fn variant(self, variant: TCCFW) -> &'a mut W {
340        {
341            self.bit(variant._bits())
342        }
343    }
344    #[doc = "Clears the TC flag in the ISR register"]
345    #[inline]
346    pub fn clear(self) -> &'a mut W {
347        self.variant(TCCFW::CLEAR)
348    }
349    #[doc = r" Sets the field bit"]
350    pub fn set_bit(self) -> &'a mut W {
351        self.bit(true)
352    }
353    #[doc = r" Clears the field bit"]
354    pub fn clear_bit(self) -> &'a mut W {
355        self.bit(false)
356    }
357    #[doc = r" Writes raw bits to the field"]
358    #[inline]
359    pub fn bit(self, value: bool) -> &'a mut W {
360        const MASK: bool = true;
361        const OFFSET: u8 = 6;
362        self.w.bits &= !((MASK as u32) << OFFSET);
363        self.w.bits |= ((value & MASK) as u32) << OFFSET;
364        self.w
365    }
366}
367#[doc = "Values that can be written to the field `IDLECF`"]
368pub enum IDLECFW {
369    #[doc = "Clears the IDLE flag in the ISR register"]
370    CLEAR,
371}
372impl IDLECFW {
373    #[allow(missing_docs)]
374    #[doc(hidden)]
375    #[inline]
376    pub fn _bits(&self) -> bool {
377        match *self {
378            IDLECFW::CLEAR => true,
379        }
380    }
381}
382#[doc = r" Proxy"]
383pub struct _IDLECFW<'a> {
384    w: &'a mut W,
385}
386impl<'a> _IDLECFW<'a> {
387    #[doc = r" Writes `variant` to the field"]
388    #[inline]
389    pub fn variant(self, variant: IDLECFW) -> &'a mut W {
390        {
391            self.bit(variant._bits())
392        }
393    }
394    #[doc = "Clears the IDLE flag in the ISR register"]
395    #[inline]
396    pub fn clear(self) -> &'a mut W {
397        self.variant(IDLECFW::CLEAR)
398    }
399    #[doc = r" Sets the field bit"]
400    pub fn set_bit(self) -> &'a mut W {
401        self.bit(true)
402    }
403    #[doc = r" Clears the field bit"]
404    pub fn clear_bit(self) -> &'a mut W {
405        self.bit(false)
406    }
407    #[doc = r" Writes raw bits to the field"]
408    #[inline]
409    pub fn bit(self, value: bool) -> &'a mut W {
410        const MASK: bool = true;
411        const OFFSET: u8 = 4;
412        self.w.bits &= !((MASK as u32) << OFFSET);
413        self.w.bits |= ((value & MASK) as u32) << OFFSET;
414        self.w
415    }
416}
417#[doc = "Values that can be written to the field `ORECF`"]
418pub enum ORECFW {
419    #[doc = "Clears the ORE flag in the ISR register"]
420    CLEAR,
421}
422impl ORECFW {
423    #[allow(missing_docs)]
424    #[doc(hidden)]
425    #[inline]
426    pub fn _bits(&self) -> bool {
427        match *self {
428            ORECFW::CLEAR => true,
429        }
430    }
431}
432#[doc = r" Proxy"]
433pub struct _ORECFW<'a> {
434    w: &'a mut W,
435}
436impl<'a> _ORECFW<'a> {
437    #[doc = r" Writes `variant` to the field"]
438    #[inline]
439    pub fn variant(self, variant: ORECFW) -> &'a mut W {
440        {
441            self.bit(variant._bits())
442        }
443    }
444    #[doc = "Clears the ORE flag in the ISR register"]
445    #[inline]
446    pub fn clear(self) -> &'a mut W {
447        self.variant(ORECFW::CLEAR)
448    }
449    #[doc = r" Sets the field bit"]
450    pub fn set_bit(self) -> &'a mut W {
451        self.bit(true)
452    }
453    #[doc = r" Clears the field bit"]
454    pub fn clear_bit(self) -> &'a mut W {
455        self.bit(false)
456    }
457    #[doc = r" Writes raw bits to the field"]
458    #[inline]
459    pub fn bit(self, value: bool) -> &'a mut W {
460        const MASK: bool = true;
461        const OFFSET: u8 = 3;
462        self.w.bits &= !((MASK as u32) << OFFSET);
463        self.w.bits |= ((value & MASK) as u32) << OFFSET;
464        self.w
465    }
466}
467#[doc = "Values that can be written to the field `NCF`"]
468pub enum NCFW {
469    #[doc = "Clears the NF flag in the ISR register"]
470    CLEAR,
471}
472impl NCFW {
473    #[allow(missing_docs)]
474    #[doc(hidden)]
475    #[inline]
476    pub fn _bits(&self) -> bool {
477        match *self {
478            NCFW::CLEAR => true,
479        }
480    }
481}
482#[doc = r" Proxy"]
483pub struct _NCFW<'a> {
484    w: &'a mut W,
485}
486impl<'a> _NCFW<'a> {
487    #[doc = r" Writes `variant` to the field"]
488    #[inline]
489    pub fn variant(self, variant: NCFW) -> &'a mut W {
490        {
491            self.bit(variant._bits())
492        }
493    }
494    #[doc = "Clears the NF flag in the ISR register"]
495    #[inline]
496    pub fn clear(self) -> &'a mut W {
497        self.variant(NCFW::CLEAR)
498    }
499    #[doc = r" Sets the field bit"]
500    pub fn set_bit(self) -> &'a mut W {
501        self.bit(true)
502    }
503    #[doc = r" Clears the field bit"]
504    pub fn clear_bit(self) -> &'a mut W {
505        self.bit(false)
506    }
507    #[doc = r" Writes raw bits to the field"]
508    #[inline]
509    pub fn bit(self, value: bool) -> &'a mut W {
510        const MASK: bool = true;
511        const OFFSET: u8 = 2;
512        self.w.bits &= !((MASK as u32) << OFFSET);
513        self.w.bits |= ((value & MASK) as u32) << OFFSET;
514        self.w
515    }
516}
517#[doc = "Values that can be written to the field `FECF`"]
518pub enum FECFW {
519    #[doc = "Clears the FE flag in the ISR register"]
520    CLEAR,
521}
522impl FECFW {
523    #[allow(missing_docs)]
524    #[doc(hidden)]
525    #[inline]
526    pub fn _bits(&self) -> bool {
527        match *self {
528            FECFW::CLEAR => true,
529        }
530    }
531}
532#[doc = r" Proxy"]
533pub struct _FECFW<'a> {
534    w: &'a mut W,
535}
536impl<'a> _FECFW<'a> {
537    #[doc = r" Writes `variant` to the field"]
538    #[inline]
539    pub fn variant(self, variant: FECFW) -> &'a mut W {
540        {
541            self.bit(variant._bits())
542        }
543    }
544    #[doc = "Clears the FE flag in the ISR register"]
545    #[inline]
546    pub fn clear(self) -> &'a mut W {
547        self.variant(FECFW::CLEAR)
548    }
549    #[doc = r" Sets the field bit"]
550    pub fn set_bit(self) -> &'a mut W {
551        self.bit(true)
552    }
553    #[doc = r" Clears the field bit"]
554    pub fn clear_bit(self) -> &'a mut W {
555        self.bit(false)
556    }
557    #[doc = r" Writes raw bits to the field"]
558    #[inline]
559    pub fn bit(self, value: bool) -> &'a mut W {
560        const MASK: bool = true;
561        const OFFSET: u8 = 1;
562        self.w.bits &= !((MASK as u32) << OFFSET);
563        self.w.bits |= ((value & MASK) as u32) << OFFSET;
564        self.w
565    }
566}
567#[doc = "Values that can be written to the field `PECF`"]
568pub enum PECFW {
569    #[doc = "Clears the PE flag in the ISR register"]
570    CLEAR,
571}
572impl PECFW {
573    #[allow(missing_docs)]
574    #[doc(hidden)]
575    #[inline]
576    pub fn _bits(&self) -> bool {
577        match *self {
578            PECFW::CLEAR => true,
579        }
580    }
581}
582#[doc = r" Proxy"]
583pub struct _PECFW<'a> {
584    w: &'a mut W,
585}
586impl<'a> _PECFW<'a> {
587    #[doc = r" Writes `variant` to the field"]
588    #[inline]
589    pub fn variant(self, variant: PECFW) -> &'a mut W {
590        {
591            self.bit(variant._bits())
592        }
593    }
594    #[doc = "Clears the PE flag in the ISR register"]
595    #[inline]
596    pub fn clear(self) -> &'a mut W {
597        self.variant(PECFW::CLEAR)
598    }
599    #[doc = r" Sets the field bit"]
600    pub fn set_bit(self) -> &'a mut W {
601        self.bit(true)
602    }
603    #[doc = r" Clears the field bit"]
604    pub fn clear_bit(self) -> &'a mut W {
605        self.bit(false)
606    }
607    #[doc = r" Writes raw bits to the field"]
608    #[inline]
609    pub fn bit(self, value: bool) -> &'a mut W {
610        const MASK: bool = true;
611        const OFFSET: u8 = 0;
612        self.w.bits &= !((MASK as u32) << OFFSET);
613        self.w.bits |= ((value & MASK) as u32) << OFFSET;
614        self.w
615    }
616}
617impl W {
618    #[doc = r" Reset value of the register"]
619    #[inline]
620    pub fn reset_value() -> W {
621        W { bits: 0 }
622    }
623    #[doc = r" Writes raw bits to the register"]
624    #[inline]
625    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
626        self.bits = bits;
627        self
628    }
629    #[doc = "Bit 20 - Wakeup from Stop mode clear flag"]
630    #[inline]
631    pub fn wucf(&mut self) -> _WUCFW {
632        _WUCFW { w: self }
633    }
634    #[doc = "Bit 17 - Character match clear flag"]
635    #[inline]
636    pub fn cmcf(&mut self) -> _CMCFW {
637        _CMCFW { w: self }
638    }
639    #[doc = "Bit 12 - End of block clear flag"]
640    #[inline]
641    pub fn eobcf(&mut self) -> _EOBCFW {
642        _EOBCFW { w: self }
643    }
644    #[doc = "Bit 11 - Receiver timeout clear flag"]
645    #[inline]
646    pub fn rtocf(&mut self) -> _RTOCFW {
647        _RTOCFW { w: self }
648    }
649    #[doc = "Bit 9 - CTS clear flag"]
650    #[inline]
651    pub fn ctscf(&mut self) -> _CTSCFW {
652        _CTSCFW { w: self }
653    }
654    #[doc = "Bit 8 - LIN break detection clear flag"]
655    #[inline]
656    pub fn lbdcf(&mut self) -> _LBDCFW {
657        _LBDCFW { w: self }
658    }
659    #[doc = "Bit 6 - Transmission complete clear flag"]
660    #[inline]
661    pub fn tccf(&mut self) -> _TCCFW {
662        _TCCFW { w: self }
663    }
664    #[doc = "Bit 4 - Idle line detected clear flag"]
665    #[inline]
666    pub fn idlecf(&mut self) -> _IDLECFW {
667        _IDLECFW { w: self }
668    }
669    #[doc = "Bit 3 - Overrun error clear flag"]
670    #[inline]
671    pub fn orecf(&mut self) -> _ORECFW {
672        _ORECFW { w: self }
673    }
674    #[doc = "Bit 2 - Noise detected clear flag"]
675    #[inline]
676    pub fn ncf(&mut self) -> _NCFW {
677        _NCFW { w: self }
678    }
679    #[doc = "Bit 1 - Framing error clear flag"]
680    #[inline]
681    pub fn fecf(&mut self) -> _FECFW {
682        _FECFW { w: self }
683    }
684    #[doc = "Bit 0 - Parity error clear flag"]
685    #[inline]
686    pub fn pecf(&mut self) -> _PECFW {
687        _PECFW { w: self }
688    }
689}