stm32f30x/i2c1/icr/
mod.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 _ALERTCFW<'a> {
19    w: &'a mut W,
20}
21impl<'a> _ALERTCFW<'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 = 13;
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 _TIMOUTCFW<'a> {
42    w: &'a mut W,
43}
44impl<'a> _TIMOUTCFW<'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 = 12;
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 _PECCFW<'a> {
65    w: &'a mut W,
66}
67impl<'a> _PECCFW<'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 = 11;
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 _OVRCFW<'a> {
88    w: &'a mut W,
89}
90impl<'a> _OVRCFW<'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 = 10;
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 _ARLOCFW<'a> {
111    w: &'a mut W,
112}
113impl<'a> _ARLOCFW<'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 = 9;
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 _BERRCFW<'a> {
134    w: &'a mut W,
135}
136impl<'a> _BERRCFW<'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 = 8;
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 _STOPCFW<'a> {
157    w: &'a mut W,
158}
159impl<'a> _STOPCFW<'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 = 5;
173        self.w.bits &= !((MASK as u32) << OFFSET);
174        self.w.bits |= ((value & MASK) as u32) << OFFSET;
175        self.w
176    }
177}
178#[doc = r" Proxy"]
179pub struct _NACKCFW<'a> {
180    w: &'a mut W,
181}
182impl<'a> _NACKCFW<'a> {
183    #[doc = r" Sets the field bit"]
184    pub fn set_bit(self) -> &'a mut W {
185        self.bit(true)
186    }
187    #[doc = r" Clears the field bit"]
188    pub fn clear_bit(self) -> &'a mut W {
189        self.bit(false)
190    }
191    #[doc = r" Writes raw bits to the field"]
192    #[inline]
193    pub fn bit(self, value: bool) -> &'a mut W {
194        const MASK: bool = true;
195        const OFFSET: u8 = 4;
196        self.w.bits &= !((MASK as u32) << OFFSET);
197        self.w.bits |= ((value & MASK) as u32) << OFFSET;
198        self.w
199    }
200}
201#[doc = r" Proxy"]
202pub struct _ADDRCFW<'a> {
203    w: &'a mut W,
204}
205impl<'a> _ADDRCFW<'a> {
206    #[doc = r" Sets the field bit"]
207    pub fn set_bit(self) -> &'a mut W {
208        self.bit(true)
209    }
210    #[doc = r" Clears the field bit"]
211    pub fn clear_bit(self) -> &'a mut W {
212        self.bit(false)
213    }
214    #[doc = r" Writes raw bits to the field"]
215    #[inline]
216    pub fn bit(self, value: bool) -> &'a mut W {
217        const MASK: bool = true;
218        const OFFSET: u8 = 3;
219        self.w.bits &= !((MASK as u32) << OFFSET);
220        self.w.bits |= ((value & MASK) as u32) << OFFSET;
221        self.w
222    }
223}
224impl W {
225    #[doc = r" Reset value of the register"]
226    #[inline]
227    pub fn reset_value() -> W {
228        W { bits: 0 }
229    }
230    #[doc = r" Writes raw bits to the register"]
231    #[inline]
232    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
233        self.bits = bits;
234        self
235    }
236    #[doc = "Bit 13 - Alert flag clear"]
237    #[inline]
238    pub fn alertcf(&mut self) -> _ALERTCFW {
239        _ALERTCFW { w: self }
240    }
241    #[doc = "Bit 12 - Timeout detection flag clear"]
242    #[inline]
243    pub fn timoutcf(&mut self) -> _TIMOUTCFW {
244        _TIMOUTCFW { w: self }
245    }
246    #[doc = "Bit 11 - PEC Error flag clear"]
247    #[inline]
248    pub fn peccf(&mut self) -> _PECCFW {
249        _PECCFW { w: self }
250    }
251    #[doc = "Bit 10 - Overrun/Underrun flag clear"]
252    #[inline]
253    pub fn ovrcf(&mut self) -> _OVRCFW {
254        _OVRCFW { w: self }
255    }
256    #[doc = "Bit 9 - Arbitration lost flag clear"]
257    #[inline]
258    pub fn arlocf(&mut self) -> _ARLOCFW {
259        _ARLOCFW { w: self }
260    }
261    #[doc = "Bit 8 - Bus error flag clear"]
262    #[inline]
263    pub fn berrcf(&mut self) -> _BERRCFW {
264        _BERRCFW { w: self }
265    }
266    #[doc = "Bit 5 - Stop detection flag clear"]
267    #[inline]
268    pub fn stopcf(&mut self) -> _STOPCFW {
269        _STOPCFW { w: self }
270    }
271    #[doc = "Bit 4 - Not Acknowledge flag clear"]
272    #[inline]
273    pub fn nackcf(&mut self) -> _NACKCFW {
274        _NACKCFW { w: self }
275    }
276    #[doc = "Bit 3 - Address Matched flag clear"]
277    #[inline]
278    pub fn addrcf(&mut self) -> _ADDRCFW {
279        _ADDRCFW { w: self }
280    }
281}