stm32l4x2_pac/swpmi1/
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 = r" Proxy"]
18pub struct _CRXBFFW<'a> {
19    w: &'a mut W,
20}
21impl<'a> _CRXBFFW<'a> {
22    #[doc = r" Sets the field bit"]
23    pub fn set_bit(self) -> &'a mut W {
24        self.bit(true)
25    }
26    #[doc = r" Clears the field bit"]
27    pub fn clear_bit(self) -> &'a mut W {
28        self.bit(false)
29    }
30    #[doc = r" Writes raw bits to the field"]
31    #[inline]
32    pub fn bit(self, value: bool) -> &'a mut W {
33        const MASK: bool = true;
34        const OFFSET: u8 = 0;
35        self.w.bits &= !((MASK as u32) << OFFSET);
36        self.w.bits |= ((value & MASK) as u32) << OFFSET;
37        self.w
38    }
39}
40#[doc = r" Proxy"]
41pub struct _CTXBEFW<'a> {
42    w: &'a mut W,
43}
44impl<'a> _CTXBEFW<'a> {
45    #[doc = r" Sets the field bit"]
46    pub fn set_bit(self) -> &'a mut W {
47        self.bit(true)
48    }
49    #[doc = r" Clears the field bit"]
50    pub fn clear_bit(self) -> &'a mut W {
51        self.bit(false)
52    }
53    #[doc = r" Writes raw bits to the field"]
54    #[inline]
55    pub fn bit(self, value: bool) -> &'a mut W {
56        const MASK: bool = true;
57        const OFFSET: u8 = 1;
58        self.w.bits &= !((MASK as u32) << OFFSET);
59        self.w.bits |= ((value & MASK) as u32) << OFFSET;
60        self.w
61    }
62}
63#[doc = r" Proxy"]
64pub struct _CRXBERFW<'a> {
65    w: &'a mut W,
66}
67impl<'a> _CRXBERFW<'a> {
68    #[doc = r" Sets the field bit"]
69    pub fn set_bit(self) -> &'a mut W {
70        self.bit(true)
71    }
72    #[doc = r" Clears the field bit"]
73    pub fn clear_bit(self) -> &'a mut W {
74        self.bit(false)
75    }
76    #[doc = r" Writes raw bits to the field"]
77    #[inline]
78    pub fn bit(self, value: bool) -> &'a mut W {
79        const MASK: bool = true;
80        const OFFSET: u8 = 2;
81        self.w.bits &= !((MASK as u32) << OFFSET);
82        self.w.bits |= ((value & MASK) as u32) << OFFSET;
83        self.w
84    }
85}
86#[doc = r" Proxy"]
87pub struct _CRXOVRFW<'a> {
88    w: &'a mut W,
89}
90impl<'a> _CRXOVRFW<'a> {
91    #[doc = r" Sets the field bit"]
92    pub fn set_bit(self) -> &'a mut W {
93        self.bit(true)
94    }
95    #[doc = r" Clears the field bit"]
96    pub fn clear_bit(self) -> &'a mut W {
97        self.bit(false)
98    }
99    #[doc = r" Writes raw bits to the field"]
100    #[inline]
101    pub fn bit(self, value: bool) -> &'a mut W {
102        const MASK: bool = true;
103        const OFFSET: u8 = 3;
104        self.w.bits &= !((MASK as u32) << OFFSET);
105        self.w.bits |= ((value & MASK) as u32) << OFFSET;
106        self.w
107    }
108}
109#[doc = r" Proxy"]
110pub struct _CTXUNRFW<'a> {
111    w: &'a mut W,
112}
113impl<'a> _CTXUNRFW<'a> {
114    #[doc = r" Sets the field bit"]
115    pub fn set_bit(self) -> &'a mut W {
116        self.bit(true)
117    }
118    #[doc = r" Clears the field bit"]
119    pub fn clear_bit(self) -> &'a mut W {
120        self.bit(false)
121    }
122    #[doc = r" Writes raw bits to the field"]
123    #[inline]
124    pub fn bit(self, value: bool) -> &'a mut W {
125        const MASK: bool = true;
126        const OFFSET: u8 = 4;
127        self.w.bits &= !((MASK as u32) << OFFSET);
128        self.w.bits |= ((value & MASK) as u32) << OFFSET;
129        self.w
130    }
131}
132#[doc = r" Proxy"]
133pub struct _CTCFW<'a> {
134    w: &'a mut W,
135}
136impl<'a> _CTCFW<'a> {
137    #[doc = r" Sets the field bit"]
138    pub fn set_bit(self) -> &'a mut W {
139        self.bit(true)
140    }
141    #[doc = r" Clears the field bit"]
142    pub fn clear_bit(self) -> &'a mut W {
143        self.bit(false)
144    }
145    #[doc = r" Writes raw bits to the field"]
146    #[inline]
147    pub fn bit(self, value: bool) -> &'a mut W {
148        const MASK: bool = true;
149        const OFFSET: u8 = 7;
150        self.w.bits &= !((MASK as u32) << OFFSET);
151        self.w.bits |= ((value & MASK) as u32) << OFFSET;
152        self.w
153    }
154}
155#[doc = r" Proxy"]
156pub struct _CSRFW<'a> {
157    w: &'a mut W,
158}
159impl<'a> _CSRFW<'a> {
160    #[doc = r" Sets the field bit"]
161    pub fn set_bit(self) -> &'a mut W {
162        self.bit(true)
163    }
164    #[doc = r" Clears the field bit"]
165    pub fn clear_bit(self) -> &'a mut W {
166        self.bit(false)
167    }
168    #[doc = r" Writes raw bits to the field"]
169    #[inline]
170    pub fn bit(self, value: bool) -> &'a mut W {
171        const MASK: bool = true;
172        const OFFSET: u8 = 8;
173        self.w.bits &= !((MASK as u32) << OFFSET);
174        self.w.bits |= ((value & MASK) as u32) << OFFSET;
175        self.w
176    }
177}
178impl W {
179    #[doc = r" Reset value of the register"]
180    #[inline]
181    pub fn reset_value() -> W {
182        W { bits: 0 }
183    }
184    #[doc = r" Writes raw bits to the register"]
185    #[inline]
186    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
187        self.bits = bits;
188        self
189    }
190    #[doc = "Bit 0 - Clear receive buffer full flag"]
191    #[inline]
192    pub fn crxbff(&mut self) -> _CRXBFFW {
193        _CRXBFFW { w: self }
194    }
195    #[doc = "Bit 1 - Clear transmit buffer empty flag"]
196    #[inline]
197    pub fn ctxbef(&mut self) -> _CTXBEFW {
198        _CTXBEFW { w: self }
199    }
200    #[doc = "Bit 2 - Clear receive CRC error flag"]
201    #[inline]
202    pub fn crxberf(&mut self) -> _CRXBERFW {
203        _CRXBERFW { w: self }
204    }
205    #[doc = "Bit 3 - Clear receive overrun error flag"]
206    #[inline]
207    pub fn crxovrf(&mut self) -> _CRXOVRFW {
208        _CRXOVRFW { w: self }
209    }
210    #[doc = "Bit 4 - Clear transmit underrun error flag"]
211    #[inline]
212    pub fn ctxunrf(&mut self) -> _CTXUNRFW {
213        _CTXUNRFW { w: self }
214    }
215    #[doc = "Bit 7 - Clear transfer complete flag"]
216    #[inline]
217    pub fn ctcf(&mut self) -> _CTCFW {
218        _CTCFW { w: self }
219    }
220    #[doc = "Bit 8 - Clear slave resume flag"]
221    #[inline]
222    pub fn csrf(&mut self) -> _CSRFW {
223        _CSRFW { w: self }
224    }
225}