stm32l4x2_pac/lpuart1/
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 `CTSCF`"]
118pub enum CTSCFW {
119    #[doc = "Clears the CTSIF flag in the ISR register"]
120    CLEAR,
121}
122impl CTSCFW {
123    #[allow(missing_docs)]
124    #[doc(hidden)]
125    #[inline]
126    pub fn _bits(&self) -> bool {
127        match *self {
128            CTSCFW::CLEAR => true,
129        }
130    }
131}
132#[doc = r" Proxy"]
133pub struct _CTSCFW<'a> {
134    w: &'a mut W,
135}
136impl<'a> _CTSCFW<'a> {
137    #[doc = r" Writes `variant` to the field"]
138    #[inline]
139    pub fn variant(self, variant: CTSCFW) -> &'a mut W {
140        {
141            self.bit(variant._bits())
142        }
143    }
144    #[doc = "Clears the CTSIF flag in the ISR register"]
145    #[inline]
146    pub fn clear(self) -> &'a mut W {
147        self.variant(CTSCFW::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 = 9;
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 `TCCF`"]
168pub enum TCCFW {
169    #[doc = "Clears the TC flag in the ISR register"]
170    CLEAR,
171}
172impl TCCFW {
173    #[allow(missing_docs)]
174    #[doc(hidden)]
175    #[inline]
176    pub fn _bits(&self) -> bool {
177        match *self {
178            TCCFW::CLEAR => true,
179        }
180    }
181}
182#[doc = r" Proxy"]
183pub struct _TCCFW<'a> {
184    w: &'a mut W,
185}
186impl<'a> _TCCFW<'a> {
187    #[doc = r" Writes `variant` to the field"]
188    #[inline]
189    pub fn variant(self, variant: TCCFW) -> &'a mut W {
190        {
191            self.bit(variant._bits())
192        }
193    }
194    #[doc = "Clears the TC flag in the ISR register"]
195    #[inline]
196    pub fn clear(self) -> &'a mut W {
197        self.variant(TCCFW::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 = 6;
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 `IDLECF`"]
218pub enum IDLECFW {
219    #[doc = "Clears the IDLE flag in the ISR register"]
220    CLEAR,
221}
222impl IDLECFW {
223    #[allow(missing_docs)]
224    #[doc(hidden)]
225    #[inline]
226    pub fn _bits(&self) -> bool {
227        match *self {
228            IDLECFW::CLEAR => true,
229        }
230    }
231}
232#[doc = r" Proxy"]
233pub struct _IDLECFW<'a> {
234    w: &'a mut W,
235}
236impl<'a> _IDLECFW<'a> {
237    #[doc = r" Writes `variant` to the field"]
238    #[inline]
239    pub fn variant(self, variant: IDLECFW) -> &'a mut W {
240        {
241            self.bit(variant._bits())
242        }
243    }
244    #[doc = "Clears the IDLE flag in the ISR register"]
245    #[inline]
246    pub fn clear(self) -> &'a mut W {
247        self.variant(IDLECFW::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 = 4;
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 `ORECF`"]
268pub enum ORECFW {
269    #[doc = "Clears the ORE flag in the ISR register"]
270    CLEAR,
271}
272impl ORECFW {
273    #[allow(missing_docs)]
274    #[doc(hidden)]
275    #[inline]
276    pub fn _bits(&self) -> bool {
277        match *self {
278            ORECFW::CLEAR => true,
279        }
280    }
281}
282#[doc = r" Proxy"]
283pub struct _ORECFW<'a> {
284    w: &'a mut W,
285}
286impl<'a> _ORECFW<'a> {
287    #[doc = r" Writes `variant` to the field"]
288    #[inline]
289    pub fn variant(self, variant: ORECFW) -> &'a mut W {
290        {
291            self.bit(variant._bits())
292        }
293    }
294    #[doc = "Clears the ORE flag in the ISR register"]
295    #[inline]
296    pub fn clear(self) -> &'a mut W {
297        self.variant(ORECFW::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 = 3;
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 `NCF`"]
318pub enum NCFW {
319    #[doc = "Clears the NF flag in the ISR register"]
320    CLEAR,
321}
322impl NCFW {
323    #[allow(missing_docs)]
324    #[doc(hidden)]
325    #[inline]
326    pub fn _bits(&self) -> bool {
327        match *self {
328            NCFW::CLEAR => true,
329        }
330    }
331}
332#[doc = r" Proxy"]
333pub struct _NCFW<'a> {
334    w: &'a mut W,
335}
336impl<'a> _NCFW<'a> {
337    #[doc = r" Writes `variant` to the field"]
338    #[inline]
339    pub fn variant(self, variant: NCFW) -> &'a mut W {
340        {
341            self.bit(variant._bits())
342        }
343    }
344    #[doc = "Clears the NF flag in the ISR register"]
345    #[inline]
346    pub fn clear(self) -> &'a mut W {
347        self.variant(NCFW::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 = 2;
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 `FECF`"]
368pub enum FECFW {
369    #[doc = "Clears the FE flag in the ISR register"]
370    CLEAR,
371}
372impl FECFW {
373    #[allow(missing_docs)]
374    #[doc(hidden)]
375    #[inline]
376    pub fn _bits(&self) -> bool {
377        match *self {
378            FECFW::CLEAR => true,
379        }
380    }
381}
382#[doc = r" Proxy"]
383pub struct _FECFW<'a> {
384    w: &'a mut W,
385}
386impl<'a> _FECFW<'a> {
387    #[doc = r" Writes `variant` to the field"]
388    #[inline]
389    pub fn variant(self, variant: FECFW) -> &'a mut W {
390        {
391            self.bit(variant._bits())
392        }
393    }
394    #[doc = "Clears the FE flag in the ISR register"]
395    #[inline]
396    pub fn clear(self) -> &'a mut W {
397        self.variant(FECFW::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 = 1;
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 `PECF`"]
418pub enum PECFW {
419    #[doc = "Clears the PE flag in the ISR register"]
420    CLEAR,
421}
422impl PECFW {
423    #[allow(missing_docs)]
424    #[doc(hidden)]
425    #[inline]
426    pub fn _bits(&self) -> bool {
427        match *self {
428            PECFW::CLEAR => true,
429        }
430    }
431}
432#[doc = r" Proxy"]
433pub struct _PECFW<'a> {
434    w: &'a mut W,
435}
436impl<'a> _PECFW<'a> {
437    #[doc = r" Writes `variant` to the field"]
438    #[inline]
439    pub fn variant(self, variant: PECFW) -> &'a mut W {
440        {
441            self.bit(variant._bits())
442        }
443    }
444    #[doc = "Clears the PE flag in the ISR register"]
445    #[inline]
446    pub fn clear(self) -> &'a mut W {
447        self.variant(PECFW::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 = 0;
462        self.w.bits &= !((MASK as u32) << OFFSET);
463        self.w.bits |= ((value & MASK) as u32) << OFFSET;
464        self.w
465    }
466}
467impl W {
468    #[doc = r" Reset value of the register"]
469    #[inline]
470    pub fn reset_value() -> W {
471        W { bits: 0 }
472    }
473    #[doc = r" Writes raw bits to the register"]
474    #[inline]
475    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
476        self.bits = bits;
477        self
478    }
479    #[doc = "Bit 20 - Wakeup from Stop mode clear flag"]
480    #[inline]
481    pub fn wucf(&mut self) -> _WUCFW {
482        _WUCFW { w: self }
483    }
484    #[doc = "Bit 17 - Character match clear flag"]
485    #[inline]
486    pub fn cmcf(&mut self) -> _CMCFW {
487        _CMCFW { w: self }
488    }
489    #[doc = "Bit 9 - CTS clear flag"]
490    #[inline]
491    pub fn ctscf(&mut self) -> _CTSCFW {
492        _CTSCFW { w: self }
493    }
494    #[doc = "Bit 6 - Transmission complete clear flag"]
495    #[inline]
496    pub fn tccf(&mut self) -> _TCCFW {
497        _TCCFW { w: self }
498    }
499    #[doc = "Bit 4 - Idle line detected clear flag"]
500    #[inline]
501    pub fn idlecf(&mut self) -> _IDLECFW {
502        _IDLECFW { w: self }
503    }
504    #[doc = "Bit 3 - Overrun error clear flag"]
505    #[inline]
506    pub fn orecf(&mut self) -> _ORECFW {
507        _ORECFW { w: self }
508    }
509    #[doc = "Bit 2 - Noise detected clear flag"]
510    #[inline]
511    pub fn ncf(&mut self) -> _NCFW {
512        _NCFW { w: self }
513    }
514    #[doc = "Bit 1 - Framing error clear flag"]
515    #[inline]
516    pub fn fecf(&mut self) -> _FECFW {
517        _FECFW { w: self }
518    }
519    #[doc = "Bit 0 - Parity error clear flag"]
520    #[inline]
521    pub fn pecf(&mut self) -> _PECFW {
522        _PECFW { w: self }
523    }
524}