xmc4700/flash0/
procon1.rs

1#[doc = "Register `PROCON1` reader"]
2pub type R = crate::R<PROCON1_SPEC>;
3#[doc = "Sector 0 Locked for Write Protection by User 1\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub enum S0L_A {
6    #[doc = "0: No write protection is configured for sector n."]
7    VALUE1 = 0,
8    #[doc = "1: Write protection is configured for sector n."]
9    VALUE2 = 1,
10}
11impl From<S0L_A> for bool {
12    #[inline(always)]
13    fn from(variant: S0L_A) -> Self {
14        variant as u8 != 0
15    }
16}
17#[doc = "Field `S0L` reader - Sector 0 Locked for Write Protection by User 1"]
18pub type S0L_R = crate::BitReader<S0L_A>;
19impl S0L_R {
20    #[doc = "Get enumerated values variant"]
21    #[inline(always)]
22    pub const fn variant(&self) -> S0L_A {
23        match self.bits {
24            false => S0L_A::VALUE1,
25            true => S0L_A::VALUE2,
26        }
27    }
28    #[doc = "No write protection is configured for sector n."]
29    #[inline(always)]
30    pub fn is_value1(&self) -> bool {
31        *self == S0L_A::VALUE1
32    }
33    #[doc = "Write protection is configured for sector n."]
34    #[inline(always)]
35    pub fn is_value2(&self) -> bool {
36        *self == S0L_A::VALUE2
37    }
38}
39#[doc = "Sector 1 Locked for Write Protection by User 1\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum S1L_A {
42    #[doc = "0: No write protection is configured for sector n."]
43    VALUE1 = 0,
44    #[doc = "1: Write protection is configured for sector n."]
45    VALUE2 = 1,
46}
47impl From<S1L_A> for bool {
48    #[inline(always)]
49    fn from(variant: S1L_A) -> Self {
50        variant as u8 != 0
51    }
52}
53#[doc = "Field `S1L` reader - Sector 1 Locked for Write Protection by User 1"]
54pub type S1L_R = crate::BitReader<S1L_A>;
55impl S1L_R {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub const fn variant(&self) -> S1L_A {
59        match self.bits {
60            false => S1L_A::VALUE1,
61            true => S1L_A::VALUE2,
62        }
63    }
64    #[doc = "No write protection is configured for sector n."]
65    #[inline(always)]
66    pub fn is_value1(&self) -> bool {
67        *self == S1L_A::VALUE1
68    }
69    #[doc = "Write protection is configured for sector n."]
70    #[inline(always)]
71    pub fn is_value2(&self) -> bool {
72        *self == S1L_A::VALUE2
73    }
74}
75#[doc = "Sector 2 Locked for Write Protection by User 1\n\nValue on reset: 0"]
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77pub enum S2L_A {
78    #[doc = "0: No write protection is configured for sector n."]
79    VALUE1 = 0,
80    #[doc = "1: Write protection is configured for sector n."]
81    VALUE2 = 1,
82}
83impl From<S2L_A> for bool {
84    #[inline(always)]
85    fn from(variant: S2L_A) -> Self {
86        variant as u8 != 0
87    }
88}
89#[doc = "Field `S2L` reader - Sector 2 Locked for Write Protection by User 1"]
90pub type S2L_R = crate::BitReader<S2L_A>;
91impl S2L_R {
92    #[doc = "Get enumerated values variant"]
93    #[inline(always)]
94    pub const fn variant(&self) -> S2L_A {
95        match self.bits {
96            false => S2L_A::VALUE1,
97            true => S2L_A::VALUE2,
98        }
99    }
100    #[doc = "No write protection is configured for sector n."]
101    #[inline(always)]
102    pub fn is_value1(&self) -> bool {
103        *self == S2L_A::VALUE1
104    }
105    #[doc = "Write protection is configured for sector n."]
106    #[inline(always)]
107    pub fn is_value2(&self) -> bool {
108        *self == S2L_A::VALUE2
109    }
110}
111#[doc = "Sector 3 Locked for Write Protection by User 1\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum S3L_A {
114    #[doc = "0: No write protection is configured for sector n."]
115    VALUE1 = 0,
116    #[doc = "1: Write protection is configured for sector n."]
117    VALUE2 = 1,
118}
119impl From<S3L_A> for bool {
120    #[inline(always)]
121    fn from(variant: S3L_A) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `S3L` reader - Sector 3 Locked for Write Protection by User 1"]
126pub type S3L_R = crate::BitReader<S3L_A>;
127impl S3L_R {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> S3L_A {
131        match self.bits {
132            false => S3L_A::VALUE1,
133            true => S3L_A::VALUE2,
134        }
135    }
136    #[doc = "No write protection is configured for sector n."]
137    #[inline(always)]
138    pub fn is_value1(&self) -> bool {
139        *self == S3L_A::VALUE1
140    }
141    #[doc = "Write protection is configured for sector n."]
142    #[inline(always)]
143    pub fn is_value2(&self) -> bool {
144        *self == S3L_A::VALUE2
145    }
146}
147#[doc = "Sector 4 Locked for Write Protection by User 1\n\nValue on reset: 0"]
148#[derive(Clone, Copy, Debug, PartialEq, Eq)]
149pub enum S4L_A {
150    #[doc = "0: No write protection is configured for sector n."]
151    VALUE1 = 0,
152    #[doc = "1: Write protection is configured for sector n."]
153    VALUE2 = 1,
154}
155impl From<S4L_A> for bool {
156    #[inline(always)]
157    fn from(variant: S4L_A) -> Self {
158        variant as u8 != 0
159    }
160}
161#[doc = "Field `S4L` reader - Sector 4 Locked for Write Protection by User 1"]
162pub type S4L_R = crate::BitReader<S4L_A>;
163impl S4L_R {
164    #[doc = "Get enumerated values variant"]
165    #[inline(always)]
166    pub const fn variant(&self) -> S4L_A {
167        match self.bits {
168            false => S4L_A::VALUE1,
169            true => S4L_A::VALUE2,
170        }
171    }
172    #[doc = "No write protection is configured for sector n."]
173    #[inline(always)]
174    pub fn is_value1(&self) -> bool {
175        *self == S4L_A::VALUE1
176    }
177    #[doc = "Write protection is configured for sector n."]
178    #[inline(always)]
179    pub fn is_value2(&self) -> bool {
180        *self == S4L_A::VALUE2
181    }
182}
183#[doc = "Sector 5 Locked for Write Protection by User 1\n\nValue on reset: 0"]
184#[derive(Clone, Copy, Debug, PartialEq, Eq)]
185pub enum S5L_A {
186    #[doc = "0: No write protection is configured for sector n."]
187    VALUE1 = 0,
188    #[doc = "1: Write protection is configured for sector n."]
189    VALUE2 = 1,
190}
191impl From<S5L_A> for bool {
192    #[inline(always)]
193    fn from(variant: S5L_A) -> Self {
194        variant as u8 != 0
195    }
196}
197#[doc = "Field `S5L` reader - Sector 5 Locked for Write Protection by User 1"]
198pub type S5L_R = crate::BitReader<S5L_A>;
199impl S5L_R {
200    #[doc = "Get enumerated values variant"]
201    #[inline(always)]
202    pub const fn variant(&self) -> S5L_A {
203        match self.bits {
204            false => S5L_A::VALUE1,
205            true => S5L_A::VALUE2,
206        }
207    }
208    #[doc = "No write protection is configured for sector n."]
209    #[inline(always)]
210    pub fn is_value1(&self) -> bool {
211        *self == S5L_A::VALUE1
212    }
213    #[doc = "Write protection is configured for sector n."]
214    #[inline(always)]
215    pub fn is_value2(&self) -> bool {
216        *self == S5L_A::VALUE2
217    }
218}
219#[doc = "Sector 6 Locked for Write Protection by User 1\n\nValue on reset: 0"]
220#[derive(Clone, Copy, Debug, PartialEq, Eq)]
221pub enum S6L_A {
222    #[doc = "0: No write protection is configured for sector n."]
223    VALUE1 = 0,
224    #[doc = "1: Write protection is configured for sector n."]
225    VALUE2 = 1,
226}
227impl From<S6L_A> for bool {
228    #[inline(always)]
229    fn from(variant: S6L_A) -> Self {
230        variant as u8 != 0
231    }
232}
233#[doc = "Field `S6L` reader - Sector 6 Locked for Write Protection by User 1"]
234pub type S6L_R = crate::BitReader<S6L_A>;
235impl S6L_R {
236    #[doc = "Get enumerated values variant"]
237    #[inline(always)]
238    pub const fn variant(&self) -> S6L_A {
239        match self.bits {
240            false => S6L_A::VALUE1,
241            true => S6L_A::VALUE2,
242        }
243    }
244    #[doc = "No write protection is configured for sector n."]
245    #[inline(always)]
246    pub fn is_value1(&self) -> bool {
247        *self == S6L_A::VALUE1
248    }
249    #[doc = "Write protection is configured for sector n."]
250    #[inline(always)]
251    pub fn is_value2(&self) -> bool {
252        *self == S6L_A::VALUE2
253    }
254}
255#[doc = "Sector 7 Locked for Write Protection by User 1\n\nValue on reset: 0"]
256#[derive(Clone, Copy, Debug, PartialEq, Eq)]
257pub enum S7L_A {
258    #[doc = "0: No write protection is configured for sector n."]
259    VALUE1 = 0,
260    #[doc = "1: Write protection is configured for sector n."]
261    VALUE2 = 1,
262}
263impl From<S7L_A> for bool {
264    #[inline(always)]
265    fn from(variant: S7L_A) -> Self {
266        variant as u8 != 0
267    }
268}
269#[doc = "Field `S7L` reader - Sector 7 Locked for Write Protection by User 1"]
270pub type S7L_R = crate::BitReader<S7L_A>;
271impl S7L_R {
272    #[doc = "Get enumerated values variant"]
273    #[inline(always)]
274    pub const fn variant(&self) -> S7L_A {
275        match self.bits {
276            false => S7L_A::VALUE1,
277            true => S7L_A::VALUE2,
278        }
279    }
280    #[doc = "No write protection is configured for sector n."]
281    #[inline(always)]
282    pub fn is_value1(&self) -> bool {
283        *self == S7L_A::VALUE1
284    }
285    #[doc = "Write protection is configured for sector n."]
286    #[inline(always)]
287    pub fn is_value2(&self) -> bool {
288        *self == S7L_A::VALUE2
289    }
290}
291#[doc = "Sector 8 Locked for Write Protection by User 1\n\nValue on reset: 0"]
292#[derive(Clone, Copy, Debug, PartialEq, Eq)]
293pub enum S8L_A {
294    #[doc = "0: No write protection is configured for sector n."]
295    VALUE1 = 0,
296    #[doc = "1: Write protection is configured for sector n."]
297    VALUE2 = 1,
298}
299impl From<S8L_A> for bool {
300    #[inline(always)]
301    fn from(variant: S8L_A) -> Self {
302        variant as u8 != 0
303    }
304}
305#[doc = "Field `S8L` reader - Sector 8 Locked for Write Protection by User 1"]
306pub type S8L_R = crate::BitReader<S8L_A>;
307impl S8L_R {
308    #[doc = "Get enumerated values variant"]
309    #[inline(always)]
310    pub const fn variant(&self) -> S8L_A {
311        match self.bits {
312            false => S8L_A::VALUE1,
313            true => S8L_A::VALUE2,
314        }
315    }
316    #[doc = "No write protection is configured for sector n."]
317    #[inline(always)]
318    pub fn is_value1(&self) -> bool {
319        *self == S8L_A::VALUE1
320    }
321    #[doc = "Write protection is configured for sector n."]
322    #[inline(always)]
323    pub fn is_value2(&self) -> bool {
324        *self == S8L_A::VALUE2
325    }
326}
327#[doc = "Sector 9 Locked for Write Protection by User 1\n\nValue on reset: 0"]
328#[derive(Clone, Copy, Debug, PartialEq, Eq)]
329pub enum S9L_A {
330    #[doc = "0: No write protection is configured for sector n."]
331    VALUE1 = 0,
332    #[doc = "1: Write protection is configured for sector n."]
333    VALUE2 = 1,
334}
335impl From<S9L_A> for bool {
336    #[inline(always)]
337    fn from(variant: S9L_A) -> Self {
338        variant as u8 != 0
339    }
340}
341#[doc = "Field `S9L` reader - Sector 9 Locked for Write Protection by User 1"]
342pub type S9L_R = crate::BitReader<S9L_A>;
343impl S9L_R {
344    #[doc = "Get enumerated values variant"]
345    #[inline(always)]
346    pub const fn variant(&self) -> S9L_A {
347        match self.bits {
348            false => S9L_A::VALUE1,
349            true => S9L_A::VALUE2,
350        }
351    }
352    #[doc = "No write protection is configured for sector n."]
353    #[inline(always)]
354    pub fn is_value1(&self) -> bool {
355        *self == S9L_A::VALUE1
356    }
357    #[doc = "Write protection is configured for sector n."]
358    #[inline(always)]
359    pub fn is_value2(&self) -> bool {
360        *self == S9L_A::VALUE2
361    }
362}
363#[doc = "Sectors 10 and 11 Locked for Write Protection by User 1\n\nValue on reset: 0"]
364#[derive(Clone, Copy, Debug, PartialEq, Eq)]
365pub enum S10_S11L_A {
366    #[doc = "0: No write protection is configured for sectors 10+11."]
367    VALUE1 = 0,
368    #[doc = "1: Write protection is configured for sectors 10+11."]
369    VALUE2 = 1,
370}
371impl From<S10_S11L_A> for bool {
372    #[inline(always)]
373    fn from(variant: S10_S11L_A) -> Self {
374        variant as u8 != 0
375    }
376}
377#[doc = "Field `S10_S11L` reader - Sectors 10 and 11 Locked for Write Protection by User 1"]
378pub type S10_S11L_R = crate::BitReader<S10_S11L_A>;
379impl S10_S11L_R {
380    #[doc = "Get enumerated values variant"]
381    #[inline(always)]
382    pub const fn variant(&self) -> S10_S11L_A {
383        match self.bits {
384            false => S10_S11L_A::VALUE1,
385            true => S10_S11L_A::VALUE2,
386        }
387    }
388    #[doc = "No write protection is configured for sectors 10+11."]
389    #[inline(always)]
390    pub fn is_value1(&self) -> bool {
391        *self == S10_S11L_A::VALUE1
392    }
393    #[doc = "Write protection is configured for sectors 10+11."]
394    #[inline(always)]
395    pub fn is_value2(&self) -> bool {
396        *self == S10_S11L_A::VALUE2
397    }
398}
399#[doc = "Sectors 12 and 13 Locked for Write Protection by User 1\n\nValue on reset: 0"]
400#[derive(Clone, Copy, Debug, PartialEq, Eq)]
401pub enum S12_S13L_A {
402    #[doc = "0: No write protection is configured for sectors 12+13."]
403    VALUE1 = 0,
404    #[doc = "1: Write protection is configured for sectors 12+13."]
405    VALUE2 = 1,
406}
407impl From<S12_S13L_A> for bool {
408    #[inline(always)]
409    fn from(variant: S12_S13L_A) -> Self {
410        variant as u8 != 0
411    }
412}
413#[doc = "Field `S12_S13L` reader - Sectors 12 and 13 Locked for Write Protection by User 1"]
414pub type S12_S13L_R = crate::BitReader<S12_S13L_A>;
415impl S12_S13L_R {
416    #[doc = "Get enumerated values variant"]
417    #[inline(always)]
418    pub const fn variant(&self) -> S12_S13L_A {
419        match self.bits {
420            false => S12_S13L_A::VALUE1,
421            true => S12_S13L_A::VALUE2,
422        }
423    }
424    #[doc = "No write protection is configured for sectors 12+13."]
425    #[inline(always)]
426    pub fn is_value1(&self) -> bool {
427        *self == S12_S13L_A::VALUE1
428    }
429    #[doc = "Write protection is configured for sectors 12+13."]
430    #[inline(always)]
431    pub fn is_value2(&self) -> bool {
432        *self == S12_S13L_A::VALUE2
433    }
434}
435#[doc = "Sectors 14 and 15 Locked for Write Protection by User 1\n\nValue on reset: 0"]
436#[derive(Clone, Copy, Debug, PartialEq, Eq)]
437pub enum S14_S15L_A {
438    #[doc = "0: No write protection is configured for sectors 14+15."]
439    VALUE1 = 0,
440    #[doc = "1: Write protection is configured for sectors 14+15."]
441    VALUE2 = 1,
442}
443impl From<S14_S15L_A> for bool {
444    #[inline(always)]
445    fn from(variant: S14_S15L_A) -> Self {
446        variant as u8 != 0
447    }
448}
449#[doc = "Field `S14_S15L` reader - Sectors 14 and 15 Locked for Write Protection by User 1"]
450pub type S14_S15L_R = crate::BitReader<S14_S15L_A>;
451impl S14_S15L_R {
452    #[doc = "Get enumerated values variant"]
453    #[inline(always)]
454    pub const fn variant(&self) -> S14_S15L_A {
455        match self.bits {
456            false => S14_S15L_A::VALUE1,
457            true => S14_S15L_A::VALUE2,
458        }
459    }
460    #[doc = "No write protection is configured for sectors 14+15."]
461    #[inline(always)]
462    pub fn is_value1(&self) -> bool {
463        *self == S14_S15L_A::VALUE1
464    }
465    #[doc = "Write protection is configured for sectors 14+15."]
466    #[inline(always)]
467    pub fn is_value2(&self) -> bool {
468        *self == S14_S15L_A::VALUE2
469    }
470}
471#[doc = "Physical Sector Repair\n\nValue on reset: 0"]
472#[derive(Clone, Copy, Debug, PartialEq, Eq)]
473pub enum PSR_A {
474    #[doc = "0: Physical Sector Repair command disabled; Erase Physical Sector command sequence available."]
475    VALUE1 = 0,
476    #[doc = "1: Physical Sector Repair command sequence enabled; Erase Physical Sector command sequence disabled."]
477    VALUE2 = 1,
478}
479impl From<PSR_A> for bool {
480    #[inline(always)]
481    fn from(variant: PSR_A) -> Self {
482        variant as u8 != 0
483    }
484}
485#[doc = "Field `PSR` reader - Physical Sector Repair"]
486pub type PSR_R = crate::BitReader<PSR_A>;
487impl PSR_R {
488    #[doc = "Get enumerated values variant"]
489    #[inline(always)]
490    pub const fn variant(&self) -> PSR_A {
491        match self.bits {
492            false => PSR_A::VALUE1,
493            true => PSR_A::VALUE2,
494        }
495    }
496    #[doc = "Physical Sector Repair command disabled; Erase Physical Sector command sequence available."]
497    #[inline(always)]
498    pub fn is_value1(&self) -> bool {
499        *self == PSR_A::VALUE1
500    }
501    #[doc = "Physical Sector Repair command sequence enabled; Erase Physical Sector command sequence disabled."]
502    #[inline(always)]
503    pub fn is_value2(&self) -> bool {
504        *self == PSR_A::VALUE2
505    }
506}
507impl R {
508    #[doc = "Bit 0 - Sector 0 Locked for Write Protection by User 1"]
509    #[inline(always)]
510    pub fn s0l(&self) -> S0L_R {
511        S0L_R::new((self.bits & 1) != 0)
512    }
513    #[doc = "Bit 1 - Sector 1 Locked for Write Protection by User 1"]
514    #[inline(always)]
515    pub fn s1l(&self) -> S1L_R {
516        S1L_R::new(((self.bits >> 1) & 1) != 0)
517    }
518    #[doc = "Bit 2 - Sector 2 Locked for Write Protection by User 1"]
519    #[inline(always)]
520    pub fn s2l(&self) -> S2L_R {
521        S2L_R::new(((self.bits >> 2) & 1) != 0)
522    }
523    #[doc = "Bit 3 - Sector 3 Locked for Write Protection by User 1"]
524    #[inline(always)]
525    pub fn s3l(&self) -> S3L_R {
526        S3L_R::new(((self.bits >> 3) & 1) != 0)
527    }
528    #[doc = "Bit 4 - Sector 4 Locked for Write Protection by User 1"]
529    #[inline(always)]
530    pub fn s4l(&self) -> S4L_R {
531        S4L_R::new(((self.bits >> 4) & 1) != 0)
532    }
533    #[doc = "Bit 5 - Sector 5 Locked for Write Protection by User 1"]
534    #[inline(always)]
535    pub fn s5l(&self) -> S5L_R {
536        S5L_R::new(((self.bits >> 5) & 1) != 0)
537    }
538    #[doc = "Bit 6 - Sector 6 Locked for Write Protection by User 1"]
539    #[inline(always)]
540    pub fn s6l(&self) -> S6L_R {
541        S6L_R::new(((self.bits >> 6) & 1) != 0)
542    }
543    #[doc = "Bit 7 - Sector 7 Locked for Write Protection by User 1"]
544    #[inline(always)]
545    pub fn s7l(&self) -> S7L_R {
546        S7L_R::new(((self.bits >> 7) & 1) != 0)
547    }
548    #[doc = "Bit 8 - Sector 8 Locked for Write Protection by User 1"]
549    #[inline(always)]
550    pub fn s8l(&self) -> S8L_R {
551        S8L_R::new(((self.bits >> 8) & 1) != 0)
552    }
553    #[doc = "Bit 9 - Sector 9 Locked for Write Protection by User 1"]
554    #[inline(always)]
555    pub fn s9l(&self) -> S9L_R {
556        S9L_R::new(((self.bits >> 9) & 1) != 0)
557    }
558    #[doc = "Bit 10 - Sectors 10 and 11 Locked for Write Protection by User 1"]
559    #[inline(always)]
560    pub fn s10_s11l(&self) -> S10_S11L_R {
561        S10_S11L_R::new(((self.bits >> 10) & 1) != 0)
562    }
563    #[doc = "Bit 11 - Sectors 12 and 13 Locked for Write Protection by User 1"]
564    #[inline(always)]
565    pub fn s12_s13l(&self) -> S12_S13L_R {
566        S12_S13L_R::new(((self.bits >> 11) & 1) != 0)
567    }
568    #[doc = "Bit 12 - Sectors 14 and 15 Locked for Write Protection by User 1"]
569    #[inline(always)]
570    pub fn s14_s15l(&self) -> S14_S15L_R {
571        S14_S15L_R::new(((self.bits >> 12) & 1) != 0)
572    }
573    #[doc = "Bit 16 - Physical Sector Repair"]
574    #[inline(always)]
575    pub fn psr(&self) -> PSR_R {
576        PSR_R::new(((self.bits >> 16) & 1) != 0)
577    }
578}
579#[doc = "Flash Protection Configuration Register User 1\n\nYou can [`read`](crate::Reg::read) this register and get [`procon1::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
580pub struct PROCON1_SPEC;
581impl crate::RegisterSpec for PROCON1_SPEC {
582    type Ux = u32;
583}
584#[doc = "`read()` method returns [`procon1::R`](R) reader structure"]
585impl crate::Readable for PROCON1_SPEC {}
586#[doc = "`reset()` method sets PROCON1 to value 0"]
587impl crate::Resettable for PROCON1_SPEC {
588    const RESET_VALUE: u32 = 0;
589}