stm32wb_pac/flash/
c2cr.rs1#[doc = "Reader of register C2CR"]
2pub type R = crate::R<u32, super::C2CR>;
3#[doc = "Writer for register C2CR"]
4pub type W = crate::W<u32, super::C2CR>;
5#[doc = "Register C2CR `reset()`'s with value 0"]
6impl crate::ResetValue for super::C2CR {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `PG`"]
14pub type PG_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `PG`"]
16pub struct PG_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> PG_W<'a> {
20 #[doc = r"Sets the field bit"]
21 #[inline(always)]
22 pub fn set_bit(self) -> &'a mut W {
23 self.bit(true)
24 }
25 #[doc = r"Clears the field bit"]
26 #[inline(always)]
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(always)]
32 pub fn bit(self, value: bool) -> &'a mut W {
33 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
34 self.w
35 }
36}
37#[doc = "Reader of field `PER`"]
38pub type PER_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `PER`"]
40pub struct PER_W<'a> {
41 w: &'a mut W,
42}
43impl<'a> PER_W<'a> {
44 #[doc = r"Sets the field bit"]
45 #[inline(always)]
46 pub fn set_bit(self) -> &'a mut W {
47 self.bit(true)
48 }
49 #[doc = r"Clears the field bit"]
50 #[inline(always)]
51 pub fn clear_bit(self) -> &'a mut W {
52 self.bit(false)
53 }
54 #[doc = r"Writes raw bits to the field"]
55 #[inline(always)]
56 pub fn bit(self, value: bool) -> &'a mut W {
57 self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
58 self.w
59 }
60}
61#[doc = "Reader of field `MER`"]
62pub type MER_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `MER`"]
64pub struct MER_W<'a> {
65 w: &'a mut W,
66}
67impl<'a> MER_W<'a> {
68 #[doc = r"Sets the field bit"]
69 #[inline(always)]
70 pub fn set_bit(self) -> &'a mut W {
71 self.bit(true)
72 }
73 #[doc = r"Clears the field bit"]
74 #[inline(always)]
75 pub fn clear_bit(self) -> &'a mut W {
76 self.bit(false)
77 }
78 #[doc = r"Writes raw bits to the field"]
79 #[inline(always)]
80 pub fn bit(self, value: bool) -> &'a mut W {
81 self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
82 self.w
83 }
84}
85#[doc = "Reader of field `PNB`"]
86pub type PNB_R = crate::R<u8, u8>;
87#[doc = "Write proxy for field `PNB`"]
88pub struct PNB_W<'a> {
89 w: &'a mut W,
90}
91impl<'a> PNB_W<'a> {
92 #[doc = r"Writes raw bits to the field"]
93 #[inline(always)]
94 pub unsafe fn bits(self, value: u8) -> &'a mut W {
95 self.w.bits = (self.w.bits & !(0xff << 3)) | (((value as u32) & 0xff) << 3);
96 self.w
97 }
98}
99#[doc = "Reader of field `STRT`"]
100pub type STRT_R = crate::R<bool, bool>;
101#[doc = "Write proxy for field `STRT`"]
102pub struct STRT_W<'a> {
103 w: &'a mut W,
104}
105impl<'a> STRT_W<'a> {
106 #[doc = r"Sets the field bit"]
107 #[inline(always)]
108 pub fn set_bit(self) -> &'a mut W {
109 self.bit(true)
110 }
111 #[doc = r"Clears the field bit"]
112 #[inline(always)]
113 pub fn clear_bit(self) -> &'a mut W {
114 self.bit(false)
115 }
116 #[doc = r"Writes raw bits to the field"]
117 #[inline(always)]
118 pub fn bit(self, value: bool) -> &'a mut W {
119 self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
120 self.w
121 }
122}
123#[doc = "Reader of field `FSTPG`"]
124pub type FSTPG_R = crate::R<bool, bool>;
125#[doc = "Write proxy for field `FSTPG`"]
126pub struct FSTPG_W<'a> {
127 w: &'a mut W,
128}
129impl<'a> FSTPG_W<'a> {
130 #[doc = r"Sets the field bit"]
131 #[inline(always)]
132 pub fn set_bit(self) -> &'a mut W {
133 self.bit(true)
134 }
135 #[doc = r"Clears the field bit"]
136 #[inline(always)]
137 pub fn clear_bit(self) -> &'a mut W {
138 self.bit(false)
139 }
140 #[doc = r"Writes raw bits to the field"]
141 #[inline(always)]
142 pub fn bit(self, value: bool) -> &'a mut W {
143 self.w.bits = (self.w.bits & !(0x01 << 18)) | (((value as u32) & 0x01) << 18);
144 self.w
145 }
146}
147#[doc = "Reader of field `EOPIE`"]
148pub type EOPIE_R = crate::R<bool, bool>;
149#[doc = "Write proxy for field `EOPIE`"]
150pub struct EOPIE_W<'a> {
151 w: &'a mut W,
152}
153impl<'a> EOPIE_W<'a> {
154 #[doc = r"Sets the field bit"]
155 #[inline(always)]
156 pub fn set_bit(self) -> &'a mut W {
157 self.bit(true)
158 }
159 #[doc = r"Clears the field bit"]
160 #[inline(always)]
161 pub fn clear_bit(self) -> &'a mut W {
162 self.bit(false)
163 }
164 #[doc = r"Writes raw bits to the field"]
165 #[inline(always)]
166 pub fn bit(self, value: bool) -> &'a mut W {
167 self.w.bits = (self.w.bits & !(0x01 << 24)) | (((value as u32) & 0x01) << 24);
168 self.w
169 }
170}
171#[doc = "Reader of field `ERRIE`"]
172pub type ERRIE_R = crate::R<bool, bool>;
173#[doc = "Write proxy for field `ERRIE`"]
174pub struct ERRIE_W<'a> {
175 w: &'a mut W,
176}
177impl<'a> ERRIE_W<'a> {
178 #[doc = r"Sets the field bit"]
179 #[inline(always)]
180 pub fn set_bit(self) -> &'a mut W {
181 self.bit(true)
182 }
183 #[doc = r"Clears the field bit"]
184 #[inline(always)]
185 pub fn clear_bit(self) -> &'a mut W {
186 self.bit(false)
187 }
188 #[doc = r"Writes raw bits to the field"]
189 #[inline(always)]
190 pub fn bit(self, value: bool) -> &'a mut W {
191 self.w.bits = (self.w.bits & !(0x01 << 25)) | (((value as u32) & 0x01) << 25);
192 self.w
193 }
194}
195#[doc = "Reader of field `RDERRIE`"]
196pub type RDERRIE_R = crate::R<bool, bool>;
197#[doc = "Write proxy for field `RDERRIE`"]
198pub struct RDERRIE_W<'a> {
199 w: &'a mut W,
200}
201impl<'a> RDERRIE_W<'a> {
202 #[doc = r"Sets the field bit"]
203 #[inline(always)]
204 pub fn set_bit(self) -> &'a mut W {
205 self.bit(true)
206 }
207 #[doc = r"Clears the field bit"]
208 #[inline(always)]
209 pub fn clear_bit(self) -> &'a mut W {
210 self.bit(false)
211 }
212 #[doc = r"Writes raw bits to the field"]
213 #[inline(always)]
214 pub fn bit(self, value: bool) -> &'a mut W {
215 self.w.bits = (self.w.bits & !(0x01 << 26)) | (((value as u32) & 0x01) << 26);
216 self.w
217 }
218}
219impl R {
220 #[doc = "Bit 0 - Programming"]
221 #[inline(always)]
222 pub fn pg(&self) -> PG_R {
223 PG_R::new((self.bits & 0x01) != 0)
224 }
225 #[doc = "Bit 1 - Page erase"]
226 #[inline(always)]
227 pub fn per(&self) -> PER_R {
228 PER_R::new(((self.bits >> 1) & 0x01) != 0)
229 }
230 #[doc = "Bit 2 - Masse erase"]
231 #[inline(always)]
232 pub fn mer(&self) -> MER_R {
233 MER_R::new(((self.bits >> 2) & 0x01) != 0)
234 }
235 #[doc = "Bits 3:10 - Page Number selection"]
236 #[inline(always)]
237 pub fn pnb(&self) -> PNB_R {
238 PNB_R::new(((self.bits >> 3) & 0xff) as u8)
239 }
240 #[doc = "Bit 16 - Start"]
241 #[inline(always)]
242 pub fn strt(&self) -> STRT_R {
243 STRT_R::new(((self.bits >> 16) & 0x01) != 0)
244 }
245 #[doc = "Bit 18 - Fast programming"]
246 #[inline(always)]
247 pub fn fstpg(&self) -> FSTPG_R {
248 FSTPG_R::new(((self.bits >> 18) & 0x01) != 0)
249 }
250 #[doc = "Bit 24 - End of operation interrupt enable"]
251 #[inline(always)]
252 pub fn eopie(&self) -> EOPIE_R {
253 EOPIE_R::new(((self.bits >> 24) & 0x01) != 0)
254 }
255 #[doc = "Bit 25 - Error interrupt enable"]
256 #[inline(always)]
257 pub fn errie(&self) -> ERRIE_R {
258 ERRIE_R::new(((self.bits >> 25) & 0x01) != 0)
259 }
260 #[doc = "Bit 26 - PCROP read error interrupt enable"]
261 #[inline(always)]
262 pub fn rderrie(&self) -> RDERRIE_R {
263 RDERRIE_R::new(((self.bits >> 26) & 0x01) != 0)
264 }
265}
266impl W {
267 #[doc = "Bit 0 - Programming"]
268 #[inline(always)]
269 pub fn pg(&mut self) -> PG_W {
270 PG_W { w: self }
271 }
272 #[doc = "Bit 1 - Page erase"]
273 #[inline(always)]
274 pub fn per(&mut self) -> PER_W {
275 PER_W { w: self }
276 }
277 #[doc = "Bit 2 - Masse erase"]
278 #[inline(always)]
279 pub fn mer(&mut self) -> MER_W {
280 MER_W { w: self }
281 }
282 #[doc = "Bits 3:10 - Page Number selection"]
283 #[inline(always)]
284 pub fn pnb(&mut self) -> PNB_W {
285 PNB_W { w: self }
286 }
287 #[doc = "Bit 16 - Start"]
288 #[inline(always)]
289 pub fn strt(&mut self) -> STRT_W {
290 STRT_W { w: self }
291 }
292 #[doc = "Bit 18 - Fast programming"]
293 #[inline(always)]
294 pub fn fstpg(&mut self) -> FSTPG_W {
295 FSTPG_W { w: self }
296 }
297 #[doc = "Bit 24 - End of operation interrupt enable"]
298 #[inline(always)]
299 pub fn eopie(&mut self) -> EOPIE_W {
300 EOPIE_W { w: self }
301 }
302 #[doc = "Bit 25 - Error interrupt enable"]
303 #[inline(always)]
304 pub fn errie(&mut self) -> ERRIE_W {
305 ERRIE_W { w: self }
306 }
307 #[doc = "Bit 26 - PCROP read error interrupt enable"]
308 #[inline(always)]
309 pub fn rderrie(&mut self) -> RDERRIE_W {
310 RDERRIE_W { w: self }
311 }
312}