1#[doc = "Reader of register CR"]
2pub type R = crate::R<u32, super::CR>;
3#[doc = "Writer for register CR"]
4pub type W = crate::W<u32, super::CR>;
5#[doc = "Register CR `reset()`'s with value 0xc000_0000"]
6impl crate::ResetValue for super::CR {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0xc000_0000
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 `OPTSTRT`"]
124pub type OPTSTRT_R = crate::R<bool, bool>;
125#[doc = "Write proxy for field `OPTSTRT`"]
126pub struct OPTSTRT_W<'a> {
127 w: &'a mut W,
128}
129impl<'a> OPTSTRT_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 << 17)) | (((value as u32) & 0x01) << 17);
144 self.w
145 }
146}
147#[doc = "Reader of field `FSTPG`"]
148pub type FSTPG_R = crate::R<bool, bool>;
149#[doc = "Write proxy for field `FSTPG`"]
150pub struct FSTPG_W<'a> {
151 w: &'a mut W,
152}
153impl<'a> FSTPG_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 << 18)) | (((value as u32) & 0x01) << 18);
168 self.w
169 }
170}
171#[doc = "Reader of field `EOPIE`"]
172pub type EOPIE_R = crate::R<bool, bool>;
173#[doc = "Write proxy for field `EOPIE`"]
174pub struct EOPIE_W<'a> {
175 w: &'a mut W,
176}
177impl<'a> EOPIE_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 << 24)) | (((value as u32) & 0x01) << 24);
192 self.w
193 }
194}
195#[doc = "Reader of field `ERRIE`"]
196pub type ERRIE_R = crate::R<bool, bool>;
197#[doc = "Write proxy for field `ERRIE`"]
198pub struct ERRIE_W<'a> {
199 w: &'a mut W,
200}
201impl<'a> ERRIE_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 << 25)) | (((value as u32) & 0x01) << 25);
216 self.w
217 }
218}
219#[doc = "Reader of field `RDERRIE`"]
220pub type RDERRIE_R = crate::R<bool, bool>;
221#[doc = "Write proxy for field `RDERRIE`"]
222pub struct RDERRIE_W<'a> {
223 w: &'a mut W,
224}
225impl<'a> RDERRIE_W<'a> {
226 #[doc = r"Sets the field bit"]
227 #[inline(always)]
228 pub fn set_bit(self) -> &'a mut W {
229 self.bit(true)
230 }
231 #[doc = r"Clears the field bit"]
232 #[inline(always)]
233 pub fn clear_bit(self) -> &'a mut W {
234 self.bit(false)
235 }
236 #[doc = r"Writes raw bits to the field"]
237 #[inline(always)]
238 pub fn bit(self, value: bool) -> &'a mut W {
239 self.w.bits = (self.w.bits & !(0x01 << 26)) | (((value as u32) & 0x01) << 26);
240 self.w
241 }
242}
243#[doc = "Reader of field `OBL_LAUNCH`"]
244pub type OBL_LAUNCH_R = crate::R<bool, bool>;
245#[doc = "Write proxy for field `OBL_LAUNCH`"]
246pub struct OBL_LAUNCH_W<'a> {
247 w: &'a mut W,
248}
249impl<'a> OBL_LAUNCH_W<'a> {
250 #[doc = r"Sets the field bit"]
251 #[inline(always)]
252 pub fn set_bit(self) -> &'a mut W {
253 self.bit(true)
254 }
255 #[doc = r"Clears the field bit"]
256 #[inline(always)]
257 pub fn clear_bit(self) -> &'a mut W {
258 self.bit(false)
259 }
260 #[doc = r"Writes raw bits to the field"]
261 #[inline(always)]
262 pub fn bit(self, value: bool) -> &'a mut W {
263 self.w.bits = (self.w.bits & !(0x01 << 27)) | (((value as u32) & 0x01) << 27);
264 self.w
265 }
266}
267#[doc = "Reader of field `OPTLOCK`"]
268pub type OPTLOCK_R = crate::R<bool, bool>;
269#[doc = "Write proxy for field `OPTLOCK`"]
270pub struct OPTLOCK_W<'a> {
271 w: &'a mut W,
272}
273impl<'a> OPTLOCK_W<'a> {
274 #[doc = r"Sets the field bit"]
275 #[inline(always)]
276 pub fn set_bit(self) -> &'a mut W {
277 self.bit(true)
278 }
279 #[doc = r"Clears the field bit"]
280 #[inline(always)]
281 pub fn clear_bit(self) -> &'a mut W {
282 self.bit(false)
283 }
284 #[doc = r"Writes raw bits to the field"]
285 #[inline(always)]
286 pub fn bit(self, value: bool) -> &'a mut W {
287 self.w.bits = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
288 self.w
289 }
290}
291#[doc = "Reader of field `LOCK`"]
292pub type LOCK_R = crate::R<bool, bool>;
293#[doc = "Write proxy for field `LOCK`"]
294pub struct LOCK_W<'a> {
295 w: &'a mut W,
296}
297impl<'a> LOCK_W<'a> {
298 #[doc = r"Sets the field bit"]
299 #[inline(always)]
300 pub fn set_bit(self) -> &'a mut W {
301 self.bit(true)
302 }
303 #[doc = r"Clears the field bit"]
304 #[inline(always)]
305 pub fn clear_bit(self) -> &'a mut W {
306 self.bit(false)
307 }
308 #[doc = r"Writes raw bits to the field"]
309 #[inline(always)]
310 pub fn bit(self, value: bool) -> &'a mut W {
311 self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
312 self.w
313 }
314}
315impl R {
316 #[doc = "Bit 0 - Programming"]
317 #[inline(always)]
318 pub fn pg(&self) -> PG_R {
319 PG_R::new((self.bits & 0x01) != 0)
320 }
321 #[doc = "Bit 1 - Page erase"]
322 #[inline(always)]
323 pub fn per(&self) -> PER_R {
324 PER_R::new(((self.bits >> 1) & 0x01) != 0)
325 }
326 #[doc = "Bit 2 - This bit triggers the mass erase (all user pages) when set"]
327 #[inline(always)]
328 pub fn mer(&self) -> MER_R {
329 MER_R::new(((self.bits >> 2) & 0x01) != 0)
330 }
331 #[doc = "Bits 3:10 - Page number selection"]
332 #[inline(always)]
333 pub fn pnb(&self) -> PNB_R {
334 PNB_R::new(((self.bits >> 3) & 0xff) as u8)
335 }
336 #[doc = "Bit 16 - Start"]
337 #[inline(always)]
338 pub fn strt(&self) -> STRT_R {
339 STRT_R::new(((self.bits >> 16) & 0x01) != 0)
340 }
341 #[doc = "Bit 17 - Options modification start"]
342 #[inline(always)]
343 pub fn optstrt(&self) -> OPTSTRT_R {
344 OPTSTRT_R::new(((self.bits >> 17) & 0x01) != 0)
345 }
346 #[doc = "Bit 18 - Fast programming"]
347 #[inline(always)]
348 pub fn fstpg(&self) -> FSTPG_R {
349 FSTPG_R::new(((self.bits >> 18) & 0x01) != 0)
350 }
351 #[doc = "Bit 24 - End of operation interrupt enable"]
352 #[inline(always)]
353 pub fn eopie(&self) -> EOPIE_R {
354 EOPIE_R::new(((self.bits >> 24) & 0x01) != 0)
355 }
356 #[doc = "Bit 25 - Error interrupt enable"]
357 #[inline(always)]
358 pub fn errie(&self) -> ERRIE_R {
359 ERRIE_R::new(((self.bits >> 25) & 0x01) != 0)
360 }
361 #[doc = "Bit 26 - PCROP read error interrupt enable"]
362 #[inline(always)]
363 pub fn rderrie(&self) -> RDERRIE_R {
364 RDERRIE_R::new(((self.bits >> 26) & 0x01) != 0)
365 }
366 #[doc = "Bit 27 - Force the option byte loading"]
367 #[inline(always)]
368 pub fn obl_launch(&self) -> OBL_LAUNCH_R {
369 OBL_LAUNCH_R::new(((self.bits >> 27) & 0x01) != 0)
370 }
371 #[doc = "Bit 30 - Options Lock"]
372 #[inline(always)]
373 pub fn optlock(&self) -> OPTLOCK_R {
374 OPTLOCK_R::new(((self.bits >> 30) & 0x01) != 0)
375 }
376 #[doc = "Bit 31 - FLASH_CR Lock"]
377 #[inline(always)]
378 pub fn lock(&self) -> LOCK_R {
379 LOCK_R::new(((self.bits >> 31) & 0x01) != 0)
380 }
381}
382impl W {
383 #[doc = "Bit 0 - Programming"]
384 #[inline(always)]
385 pub fn pg(&mut self) -> PG_W {
386 PG_W { w: self }
387 }
388 #[doc = "Bit 1 - Page erase"]
389 #[inline(always)]
390 pub fn per(&mut self) -> PER_W {
391 PER_W { w: self }
392 }
393 #[doc = "Bit 2 - This bit triggers the mass erase (all user pages) when set"]
394 #[inline(always)]
395 pub fn mer(&mut self) -> MER_W {
396 MER_W { w: self }
397 }
398 #[doc = "Bits 3:10 - Page number selection"]
399 #[inline(always)]
400 pub fn pnb(&mut self) -> PNB_W {
401 PNB_W { w: self }
402 }
403 #[doc = "Bit 16 - Start"]
404 #[inline(always)]
405 pub fn strt(&mut self) -> STRT_W {
406 STRT_W { w: self }
407 }
408 #[doc = "Bit 17 - Options modification start"]
409 #[inline(always)]
410 pub fn optstrt(&mut self) -> OPTSTRT_W {
411 OPTSTRT_W { w: self }
412 }
413 #[doc = "Bit 18 - Fast programming"]
414 #[inline(always)]
415 pub fn fstpg(&mut self) -> FSTPG_W {
416 FSTPG_W { w: self }
417 }
418 #[doc = "Bit 24 - End of operation interrupt enable"]
419 #[inline(always)]
420 pub fn eopie(&mut self) -> EOPIE_W {
421 EOPIE_W { w: self }
422 }
423 #[doc = "Bit 25 - Error interrupt enable"]
424 #[inline(always)]
425 pub fn errie(&mut self) -> ERRIE_W {
426 ERRIE_W { w: self }
427 }
428 #[doc = "Bit 26 - PCROP read error interrupt enable"]
429 #[inline(always)]
430 pub fn rderrie(&mut self) -> RDERRIE_W {
431 RDERRIE_W { w: self }
432 }
433 #[doc = "Bit 27 - Force the option byte loading"]
434 #[inline(always)]
435 pub fn obl_launch(&mut self) -> OBL_LAUNCH_W {
436 OBL_LAUNCH_W { w: self }
437 }
438 #[doc = "Bit 30 - Options Lock"]
439 #[inline(always)]
440 pub fn optlock(&mut self) -> OPTLOCK_W {
441 OPTLOCK_W { w: self }
442 }
443 #[doc = "Bit 31 - FLASH_CR Lock"]
444 #[inline(always)]
445 pub fn lock(&mut self) -> LOCK_W {
446 LOCK_W { w: self }
447 }
448}