stm32l4x2_pac/i2c1/
icr.rs1#[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 `ALERTCF`"]
18pub enum ALERTCFW {
19 #[doc = "Clears the ALERT flag in ISR register"]
20 CLEAR,
21}
22impl ALERTCFW {
23 #[allow(missing_docs)]
24 #[doc(hidden)]
25 #[inline]
26 pub fn _bits(&self) -> bool {
27 match *self {
28 ALERTCFW::CLEAR => true,
29 }
30 }
31}
32#[doc = r" Proxy"]
33pub struct _ALERTCFW<'a> {
34 w: &'a mut W,
35}
36impl<'a> _ALERTCFW<'a> {
37 #[doc = r" Writes `variant` to the field"]
38 #[inline]
39 pub fn variant(self, variant: ALERTCFW) -> &'a mut W {
40 {
41 self.bit(variant._bits())
42 }
43 }
44 #[doc = "Clears the ALERT flag in ISR register"]
45 #[inline]
46 pub fn clear(self) -> &'a mut W {
47 self.variant(ALERTCFW::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 = 13;
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 `TIMOUTCF`"]
68pub enum TIMOUTCFW {
69 #[doc = "Clears the TIMOUT flag in ISR register"]
70 CLEAR,
71}
72impl TIMOUTCFW {
73 #[allow(missing_docs)]
74 #[doc(hidden)]
75 #[inline]
76 pub fn _bits(&self) -> bool {
77 match *self {
78 TIMOUTCFW::CLEAR => true,
79 }
80 }
81}
82#[doc = r" Proxy"]
83pub struct _TIMOUTCFW<'a> {
84 w: &'a mut W,
85}
86impl<'a> _TIMOUTCFW<'a> {
87 #[doc = r" Writes `variant` to the field"]
88 #[inline]
89 pub fn variant(self, variant: TIMOUTCFW) -> &'a mut W {
90 {
91 self.bit(variant._bits())
92 }
93 }
94 #[doc = "Clears the TIMOUT flag in ISR register"]
95 #[inline]
96 pub fn clear(self) -> &'a mut W {
97 self.variant(TIMOUTCFW::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 = 12;
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 `PECCF`"]
118pub enum PECCFW {
119 #[doc = "Clears the PEC flag in ISR register"]
120 CLEAR,
121}
122impl PECCFW {
123 #[allow(missing_docs)]
124 #[doc(hidden)]
125 #[inline]
126 pub fn _bits(&self) -> bool {
127 match *self {
128 PECCFW::CLEAR => true,
129 }
130 }
131}
132#[doc = r" Proxy"]
133pub struct _PECCFW<'a> {
134 w: &'a mut W,
135}
136impl<'a> _PECCFW<'a> {
137 #[doc = r" Writes `variant` to the field"]
138 #[inline]
139 pub fn variant(self, variant: PECCFW) -> &'a mut W {
140 {
141 self.bit(variant._bits())
142 }
143 }
144 #[doc = "Clears the PEC flag in ISR register"]
145 #[inline]
146 pub fn clear(self) -> &'a mut W {
147 self.variant(PECCFW::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 = 11;
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 `OVRCF`"]
168pub enum OVRCFW {
169 #[doc = "Clears the OVR flag in ISR register"]
170 CLEAR,
171}
172impl OVRCFW {
173 #[allow(missing_docs)]
174 #[doc(hidden)]
175 #[inline]
176 pub fn _bits(&self) -> bool {
177 match *self {
178 OVRCFW::CLEAR => true,
179 }
180 }
181}
182#[doc = r" Proxy"]
183pub struct _OVRCFW<'a> {
184 w: &'a mut W,
185}
186impl<'a> _OVRCFW<'a> {
187 #[doc = r" Writes `variant` to the field"]
188 #[inline]
189 pub fn variant(self, variant: OVRCFW) -> &'a mut W {
190 {
191 self.bit(variant._bits())
192 }
193 }
194 #[doc = "Clears the OVR flag in ISR register"]
195 #[inline]
196 pub fn clear(self) -> &'a mut W {
197 self.variant(OVRCFW::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 = 10;
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 `ARLOCF`"]
218pub enum ARLOCFW {
219 #[doc = "Clears the ARLO flag in ISR register"]
220 CLEAR,
221}
222impl ARLOCFW {
223 #[allow(missing_docs)]
224 #[doc(hidden)]
225 #[inline]
226 pub fn _bits(&self) -> bool {
227 match *self {
228 ARLOCFW::CLEAR => true,
229 }
230 }
231}
232#[doc = r" Proxy"]
233pub struct _ARLOCFW<'a> {
234 w: &'a mut W,
235}
236impl<'a> _ARLOCFW<'a> {
237 #[doc = r" Writes `variant` to the field"]
238 #[inline]
239 pub fn variant(self, variant: ARLOCFW) -> &'a mut W {
240 {
241 self.bit(variant._bits())
242 }
243 }
244 #[doc = "Clears the ARLO flag in ISR register"]
245 #[inline]
246 pub fn clear(self) -> &'a mut W {
247 self.variant(ARLOCFW::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 `BERRCF`"]
268pub enum BERRCFW {
269 #[doc = "Clears the BERR flag in ISR register"]
270 CLEAR,
271}
272impl BERRCFW {
273 #[allow(missing_docs)]
274 #[doc(hidden)]
275 #[inline]
276 pub fn _bits(&self) -> bool {
277 match *self {
278 BERRCFW::CLEAR => true,
279 }
280 }
281}
282#[doc = r" Proxy"]
283pub struct _BERRCFW<'a> {
284 w: &'a mut W,
285}
286impl<'a> _BERRCFW<'a> {
287 #[doc = r" Writes `variant` to the field"]
288 #[inline]
289 pub fn variant(self, variant: BERRCFW) -> &'a mut W {
290 {
291 self.bit(variant._bits())
292 }
293 }
294 #[doc = "Clears the BERR flag in ISR register"]
295 #[inline]
296 pub fn clear(self) -> &'a mut W {
297 self.variant(BERRCFW::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 `STOPCF`"]
318pub enum STOPCFW {
319 #[doc = "Clears the STOP flag in ISR register"]
320 CLEAR,
321}
322impl STOPCFW {
323 #[allow(missing_docs)]
324 #[doc(hidden)]
325 #[inline]
326 pub fn _bits(&self) -> bool {
327 match *self {
328 STOPCFW::CLEAR => true,
329 }
330 }
331}
332#[doc = r" Proxy"]
333pub struct _STOPCFW<'a> {
334 w: &'a mut W,
335}
336impl<'a> _STOPCFW<'a> {
337 #[doc = r" Writes `variant` to the field"]
338 #[inline]
339 pub fn variant(self, variant: STOPCFW) -> &'a mut W {
340 {
341 self.bit(variant._bits())
342 }
343 }
344 #[doc = "Clears the STOP flag in ISR register"]
345 #[inline]
346 pub fn clear(self) -> &'a mut W {
347 self.variant(STOPCFW::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 = 5;
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 `NACKCF`"]
368pub enum NACKCFW {
369 #[doc = "Clears the NACK flag in ISR register"]
370 CLEAR,
371}
372impl NACKCFW {
373 #[allow(missing_docs)]
374 #[doc(hidden)]
375 #[inline]
376 pub fn _bits(&self) -> bool {
377 match *self {
378 NACKCFW::CLEAR => true,
379 }
380 }
381}
382#[doc = r" Proxy"]
383pub struct _NACKCFW<'a> {
384 w: &'a mut W,
385}
386impl<'a> _NACKCFW<'a> {
387 #[doc = r" Writes `variant` to the field"]
388 #[inline]
389 pub fn variant(self, variant: NACKCFW) -> &'a mut W {
390 {
391 self.bit(variant._bits())
392 }
393 }
394 #[doc = "Clears the NACK flag in ISR register"]
395 #[inline]
396 pub fn clear(self) -> &'a mut W {
397 self.variant(NACKCFW::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 `ADDRCF`"]
418pub enum ADDRCFW {
419 #[doc = "Clears the ADDR flag in ISR register"]
420 CLEAR,
421}
422impl ADDRCFW {
423 #[allow(missing_docs)]
424 #[doc(hidden)]
425 #[inline]
426 pub fn _bits(&self) -> bool {
427 match *self {
428 ADDRCFW::CLEAR => true,
429 }
430 }
431}
432#[doc = r" Proxy"]
433pub struct _ADDRCFW<'a> {
434 w: &'a mut W,
435}
436impl<'a> _ADDRCFW<'a> {
437 #[doc = r" Writes `variant` to the field"]
438 #[inline]
439 pub fn variant(self, variant: ADDRCFW) -> &'a mut W {
440 {
441 self.bit(variant._bits())
442 }
443 }
444 #[doc = "Clears the ADDR flag in ISR register"]
445 #[inline]
446 pub fn clear(self) -> &'a mut W {
447 self.variant(ADDRCFW::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}
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 13 - Alert flag clear"]
480 #[inline]
481 pub fn alertcf(&mut self) -> _ALERTCFW {
482 _ALERTCFW { w: self }
483 }
484 #[doc = "Bit 12 - Timeout detection flag clear"]
485 #[inline]
486 pub fn timoutcf(&mut self) -> _TIMOUTCFW {
487 _TIMOUTCFW { w: self }
488 }
489 #[doc = "Bit 11 - PEC Error flag clear"]
490 #[inline]
491 pub fn peccf(&mut self) -> _PECCFW {
492 _PECCFW { w: self }
493 }
494 #[doc = "Bit 10 - Overrun/Underrun flag clear"]
495 #[inline]
496 pub fn ovrcf(&mut self) -> _OVRCFW {
497 _OVRCFW { w: self }
498 }
499 #[doc = "Bit 9 - Arbitration lost flag clear"]
500 #[inline]
501 pub fn arlocf(&mut self) -> _ARLOCFW {
502 _ARLOCFW { w: self }
503 }
504 #[doc = "Bit 8 - Bus error flag clear"]
505 #[inline]
506 pub fn berrcf(&mut self) -> _BERRCFW {
507 _BERRCFW { w: self }
508 }
509 #[doc = "Bit 5 - Stop detection flag clear"]
510 #[inline]
511 pub fn stopcf(&mut self) -> _STOPCFW {
512 _STOPCFW { w: self }
513 }
514 #[doc = "Bit 4 - Not Acknowledge flag clear"]
515 #[inline]
516 pub fn nackcf(&mut self) -> _NACKCFW {
517 _NACKCFW { w: self }
518 }
519 #[doc = "Bit 3 - Address Matched flag clear"]
520 #[inline]
521 pub fn addrcf(&mut self) -> _ADDRCFW {
522 _ADDRCFW { w: self }
523 }
524}