stm32wb_pac/i2c1/
icr.rs

1#[doc = "Writer for register ICR"]
2pub type W = crate::W<u32, super::ICR>;
3#[doc = "Register ICR `reset()`'s with value 0"]
4impl crate::ResetValue for super::ICR {
5    type Type = u32;
6    #[inline(always)]
7    fn reset_value() -> Self::Type {
8        0
9    }
10}
11#[doc = "Write proxy for field `ALERTCF`"]
12pub struct ALERTCF_W<'a> {
13    w: &'a mut W,
14}
15impl<'a> ALERTCF_W<'a> {
16    #[doc = r"Sets the field bit"]
17    #[inline(always)]
18    pub fn set_bit(self) -> &'a mut W {
19        self.bit(true)
20    }
21    #[doc = r"Clears the field bit"]
22    #[inline(always)]
23    pub fn clear_bit(self) -> &'a mut W {
24        self.bit(false)
25    }
26    #[doc = r"Writes raw bits to the field"]
27    #[inline(always)]
28    pub fn bit(self, value: bool) -> &'a mut W {
29        self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13);
30        self.w
31    }
32}
33#[doc = "Write proxy for field `TIMOUTCF`"]
34pub struct TIMOUTCF_W<'a> {
35    w: &'a mut W,
36}
37impl<'a> TIMOUTCF_W<'a> {
38    #[doc = r"Sets the field bit"]
39    #[inline(always)]
40    pub fn set_bit(self) -> &'a mut W {
41        self.bit(true)
42    }
43    #[doc = r"Clears the field bit"]
44    #[inline(always)]
45    pub fn clear_bit(self) -> &'a mut W {
46        self.bit(false)
47    }
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub fn bit(self, value: bool) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
52        self.w
53    }
54}
55#[doc = "Write proxy for field `PECCF`"]
56pub struct PECCF_W<'a> {
57    w: &'a mut W,
58}
59impl<'a> PECCF_W<'a> {
60    #[doc = r"Sets the field bit"]
61    #[inline(always)]
62    pub fn set_bit(self) -> &'a mut W {
63        self.bit(true)
64    }
65    #[doc = r"Clears the field bit"]
66    #[inline(always)]
67    pub fn clear_bit(self) -> &'a mut W {
68        self.bit(false)
69    }
70    #[doc = r"Writes raw bits to the field"]
71    #[inline(always)]
72    pub fn bit(self, value: bool) -> &'a mut W {
73        self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
74        self.w
75    }
76}
77#[doc = "Write proxy for field `OVRCF`"]
78pub struct OVRCF_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> OVRCF_W<'a> {
82    #[doc = r"Sets the field bit"]
83    #[inline(always)]
84    pub fn set_bit(self) -> &'a mut W {
85        self.bit(true)
86    }
87    #[doc = r"Clears the field bit"]
88    #[inline(always)]
89    pub fn clear_bit(self) -> &'a mut W {
90        self.bit(false)
91    }
92    #[doc = r"Writes raw bits to the field"]
93    #[inline(always)]
94    pub fn bit(self, value: bool) -> &'a mut W {
95        self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
96        self.w
97    }
98}
99#[doc = "Write proxy for field `ARLOCF`"]
100pub struct ARLOCF_W<'a> {
101    w: &'a mut W,
102}
103impl<'a> ARLOCF_W<'a> {
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W {
107        self.bit(true)
108    }
109    #[doc = r"Clears the field bit"]
110    #[inline(always)]
111    pub fn clear_bit(self) -> &'a mut W {
112        self.bit(false)
113    }
114    #[doc = r"Writes raw bits to the field"]
115    #[inline(always)]
116    pub fn bit(self, value: bool) -> &'a mut W {
117        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
118        self.w
119    }
120}
121#[doc = "Write proxy for field `BERRCF`"]
122pub struct BERRCF_W<'a> {
123    w: &'a mut W,
124}
125impl<'a> BERRCF_W<'a> {
126    #[doc = r"Sets the field bit"]
127    #[inline(always)]
128    pub fn set_bit(self) -> &'a mut W {
129        self.bit(true)
130    }
131    #[doc = r"Clears the field bit"]
132    #[inline(always)]
133    pub fn clear_bit(self) -> &'a mut W {
134        self.bit(false)
135    }
136    #[doc = r"Writes raw bits to the field"]
137    #[inline(always)]
138    pub fn bit(self, value: bool) -> &'a mut W {
139        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
140        self.w
141    }
142}
143#[doc = "Write proxy for field `STOPCF`"]
144pub struct STOPCF_W<'a> {
145    w: &'a mut W,
146}
147impl<'a> STOPCF_W<'a> {
148    #[doc = r"Sets the field bit"]
149    #[inline(always)]
150    pub fn set_bit(self) -> &'a mut W {
151        self.bit(true)
152    }
153    #[doc = r"Clears the field bit"]
154    #[inline(always)]
155    pub fn clear_bit(self) -> &'a mut W {
156        self.bit(false)
157    }
158    #[doc = r"Writes raw bits to the field"]
159    #[inline(always)]
160    pub fn bit(self, value: bool) -> &'a mut W {
161        self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
162        self.w
163    }
164}
165#[doc = "Write proxy for field `NACKCF`"]
166pub struct NACKCF_W<'a> {
167    w: &'a mut W,
168}
169impl<'a> NACKCF_W<'a> {
170    #[doc = r"Sets the field bit"]
171    #[inline(always)]
172    pub fn set_bit(self) -> &'a mut W {
173        self.bit(true)
174    }
175    #[doc = r"Clears the field bit"]
176    #[inline(always)]
177    pub fn clear_bit(self) -> &'a mut W {
178        self.bit(false)
179    }
180    #[doc = r"Writes raw bits to the field"]
181    #[inline(always)]
182    pub fn bit(self, value: bool) -> &'a mut W {
183        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
184        self.w
185    }
186}
187#[doc = "Write proxy for field `ADDRCF`"]
188pub struct ADDRCF_W<'a> {
189    w: &'a mut W,
190}
191impl<'a> ADDRCF_W<'a> {
192    #[doc = r"Sets the field bit"]
193    #[inline(always)]
194    pub fn set_bit(self) -> &'a mut W {
195        self.bit(true)
196    }
197    #[doc = r"Clears the field bit"]
198    #[inline(always)]
199    pub fn clear_bit(self) -> &'a mut W {
200        self.bit(false)
201    }
202    #[doc = r"Writes raw bits to the field"]
203    #[inline(always)]
204    pub fn bit(self, value: bool) -> &'a mut W {
205        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
206        self.w
207    }
208}
209impl W {
210    #[doc = "Bit 13 - Alert flag clear"]
211    #[inline(always)]
212    pub fn alertcf(&mut self) -> ALERTCF_W {
213        ALERTCF_W { w: self }
214    }
215    #[doc = "Bit 12 - Timeout detection flag clear"]
216    #[inline(always)]
217    pub fn timoutcf(&mut self) -> TIMOUTCF_W {
218        TIMOUTCF_W { w: self }
219    }
220    #[doc = "Bit 11 - PEC Error flag clear"]
221    #[inline(always)]
222    pub fn peccf(&mut self) -> PECCF_W {
223        PECCF_W { w: self }
224    }
225    #[doc = "Bit 10 - Overrun/Underrun flag clear"]
226    #[inline(always)]
227    pub fn ovrcf(&mut self) -> OVRCF_W {
228        OVRCF_W { w: self }
229    }
230    #[doc = "Bit 9 - Arbitration lost flag clear"]
231    #[inline(always)]
232    pub fn arlocf(&mut self) -> ARLOCF_W {
233        ARLOCF_W { w: self }
234    }
235    #[doc = "Bit 8 - Bus error flag clear"]
236    #[inline(always)]
237    pub fn berrcf(&mut self) -> BERRCF_W {
238        BERRCF_W { w: self }
239    }
240    #[doc = "Bit 5 - Stop detection flag clear"]
241    #[inline(always)]
242    pub fn stopcf(&mut self) -> STOPCF_W {
243        STOPCF_W { w: self }
244    }
245    #[doc = "Bit 4 - Not Acknowledge flag clear"]
246    #[inline(always)]
247    pub fn nackcf(&mut self) -> NACKCF_W {
248        NACKCF_W { w: self }
249    }
250    #[doc = "Bit 3 - Address Matched flag clear"]
251    #[inline(always)]
252    pub fn addrcf(&mut self) -> ADDRCF_W {
253        ADDRCF_W { w: self }
254    }
255}