1pub struct R(crate::R<CR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16pub struct W(crate::W<CR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CR_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<CR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37pub type PG_R = crate::BitReader<PG_A>;
39#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum PG_A {
44    Program = 1,
46}
47impl From<PG_A> for bool {
48    #[inline(always)]
49    fn from(variant: PG_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl PG_R {
54    #[inline(always)]
56    pub fn variant(&self) -> Option<PG_A> {
57        match self.bits {
58            true => Some(PG_A::Program),
59            _ => None,
60        }
61    }
62    #[inline(always)]
64    pub fn is_program(&self) -> bool {
65        *self == PG_A::Program
66    }
67}
68pub type PG_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, PG_A, O>;
70impl<'a, const O: u8> PG_W<'a, O> {
71    #[inline(always)]
73    pub fn program(self) -> &'a mut W {
74        self.variant(PG_A::Program)
75    }
76}
77pub type PER_R = crate::BitReader<PER_A>;
79#[derive(Clone, Copy, Debug, PartialEq, Eq)]
83pub enum PER_A {
84    PageErase = 1,
86}
87impl From<PER_A> for bool {
88    #[inline(always)]
89    fn from(variant: PER_A) -> Self {
90        variant as u8 != 0
91    }
92}
93impl PER_R {
94    #[inline(always)]
96    pub fn variant(&self) -> Option<PER_A> {
97        match self.bits {
98            true => Some(PER_A::PageErase),
99            _ => None,
100        }
101    }
102    #[inline(always)]
104    pub fn is_page_erase(&self) -> bool {
105        *self == PER_A::PageErase
106    }
107}
108pub type PER_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, PER_A, O>;
110impl<'a, const O: u8> PER_W<'a, O> {
111    #[inline(always)]
113    pub fn page_erase(self) -> &'a mut W {
114        self.variant(PER_A::PageErase)
115    }
116}
117pub type MER_R = crate::BitReader<MER_A>;
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
123pub enum MER_A {
124    MassErase = 1,
126}
127impl From<MER_A> for bool {
128    #[inline(always)]
129    fn from(variant: MER_A) -> Self {
130        variant as u8 != 0
131    }
132}
133impl MER_R {
134    #[inline(always)]
136    pub fn variant(&self) -> Option<MER_A> {
137        match self.bits {
138            true => Some(MER_A::MassErase),
139            _ => None,
140        }
141    }
142    #[inline(always)]
144    pub fn is_mass_erase(&self) -> bool {
145        *self == MER_A::MassErase
146    }
147}
148pub type MER_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, MER_A, O>;
150impl<'a, const O: u8> MER_W<'a, O> {
151    #[inline(always)]
153    pub fn mass_erase(self) -> &'a mut W {
154        self.variant(MER_A::MassErase)
155    }
156}
157pub type SER_R = crate::BitReader<SER_A>;
159#[derive(Clone, Copy, Debug, PartialEq, Eq)]
163pub enum SER_A {
164    SectorErase = 1,
166}
167impl From<SER_A> for bool {
168    #[inline(always)]
169    fn from(variant: SER_A) -> Self {
170        variant as u8 != 0
171    }
172}
173impl SER_R {
174    #[inline(always)]
176    pub fn variant(&self) -> Option<SER_A> {
177        match self.bits {
178            true => Some(SER_A::SectorErase),
179            _ => None,
180        }
181    }
182    #[inline(always)]
184    pub fn is_sector_erase(&self) -> bool {
185        *self == SER_A::SectorErase
186    }
187}
188pub type SER_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, SER_A, O>;
190impl<'a, const O: u8> SER_W<'a, O> {
191    #[inline(always)]
193    pub fn sector_erase(self) -> &'a mut W {
194        self.variant(SER_A::SectorErase)
195    }
196}
197pub type OPTSTRT_R = crate::BitReader<OPTSTRT_A>;
199#[derive(Clone, Copy, Debug, PartialEq, Eq)]
203pub enum OPTSTRT_A {
204    OptionByteProgram = 1,
206}
207impl From<OPTSTRT_A> for bool {
208    #[inline(always)]
209    fn from(variant: OPTSTRT_A) -> Self {
210        variant as u8 != 0
211    }
212}
213impl OPTSTRT_R {
214    #[inline(always)]
216    pub fn variant(&self) -> Option<OPTSTRT_A> {
217        match self.bits {
218            true => Some(OPTSTRT_A::OptionByteProgram),
219            _ => None,
220        }
221    }
222    #[inline(always)]
224    pub fn is_option_byte_program(&self) -> bool {
225        *self == OPTSTRT_A::OptionByteProgram
226    }
227}
228pub type OPTSTRT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, OPTSTRT_A, O>;
230impl<'a, const O: u8> OPTSTRT_W<'a, O> {
231    #[inline(always)]
233    pub fn option_byte_program(self) -> &'a mut W {
234        self.variant(OPTSTRT_A::OptionByteProgram)
235    }
236}
237pub type PGSTRT_R = crate::BitReader<bool>;
239pub type PGSTRT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
241pub type EOPIE_R = crate::BitReader<EOPIE_A>;
243#[derive(Clone, Copy, Debug, PartialEq, Eq)]
247pub enum EOPIE_A {
248    Disabled = 0,
250    Enabled = 1,
252}
253impl From<EOPIE_A> for bool {
254    #[inline(always)]
255    fn from(variant: EOPIE_A) -> Self {
256        variant as u8 != 0
257    }
258}
259impl EOPIE_R {
260    #[inline(always)]
262    pub fn variant(&self) -> EOPIE_A {
263        match self.bits {
264            false => EOPIE_A::Disabled,
265            true => EOPIE_A::Enabled,
266        }
267    }
268    #[inline(always)]
270    pub fn is_disabled(&self) -> bool {
271        *self == EOPIE_A::Disabled
272    }
273    #[inline(always)]
275    pub fn is_enabled(&self) -> bool {
276        *self == EOPIE_A::Enabled
277    }
278}
279pub type EOPIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, EOPIE_A, O>;
281impl<'a, const O: u8> EOPIE_W<'a, O> {
282    #[inline(always)]
284    pub fn disabled(self) -> &'a mut W {
285        self.variant(EOPIE_A::Disabled)
286    }
287    #[inline(always)]
289    pub fn enabled(self) -> &'a mut W {
290        self.variant(EOPIE_A::Enabled)
291    }
292}
293pub type ERRIE_R = crate::BitReader<ERRIE_A>;
295#[derive(Clone, Copy, Debug, PartialEq, Eq)]
299pub enum ERRIE_A {
300    Disabled = 0,
302    Enabled = 1,
304}
305impl From<ERRIE_A> for bool {
306    #[inline(always)]
307    fn from(variant: ERRIE_A) -> Self {
308        variant as u8 != 0
309    }
310}
311impl ERRIE_R {
312    #[inline(always)]
314    pub fn variant(&self) -> ERRIE_A {
315        match self.bits {
316            false => ERRIE_A::Disabled,
317            true => ERRIE_A::Enabled,
318        }
319    }
320    #[inline(always)]
322    pub fn is_disabled(&self) -> bool {
323        *self == ERRIE_A::Disabled
324    }
325    #[inline(always)]
327    pub fn is_enabled(&self) -> bool {
328        *self == ERRIE_A::Enabled
329    }
330}
331pub type ERRIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, ERRIE_A, O>;
333impl<'a, const O: u8> ERRIE_W<'a, O> {
334    #[inline(always)]
336    pub fn disabled(self) -> &'a mut W {
337        self.variant(ERRIE_A::Disabled)
338    }
339    #[inline(always)]
341    pub fn enabled(self) -> &'a mut W {
342        self.variant(ERRIE_A::Enabled)
343    }
344}
345pub type OBL_LAUNCH_R = crate::BitReader<OBL_LAUNCH_A>;
347#[derive(Clone, Copy, Debug, PartialEq, Eq)]
351pub enum OBL_LAUNCH_A {
352    Inactive = 0,
354    Active = 1,
356}
357impl From<OBL_LAUNCH_A> for bool {
358    #[inline(always)]
359    fn from(variant: OBL_LAUNCH_A) -> Self {
360        variant as u8 != 0
361    }
362}
363impl OBL_LAUNCH_R {
364    #[inline(always)]
366    pub fn variant(&self) -> OBL_LAUNCH_A {
367        match self.bits {
368            false => OBL_LAUNCH_A::Inactive,
369            true => OBL_LAUNCH_A::Active,
370        }
371    }
372    #[inline(always)]
374    pub fn is_inactive(&self) -> bool {
375        *self == OBL_LAUNCH_A::Inactive
376    }
377    #[inline(always)]
379    pub fn is_active(&self) -> bool {
380        *self == OBL_LAUNCH_A::Active
381    }
382}
383pub type OBL_LAUNCH_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, OBL_LAUNCH_A, O>;
385impl<'a, const O: u8> OBL_LAUNCH_W<'a, O> {
386    #[inline(always)]
388    pub fn inactive(self) -> &'a mut W {
389        self.variant(OBL_LAUNCH_A::Inactive)
390    }
391    #[inline(always)]
393    pub fn active(self) -> &'a mut W {
394        self.variant(OBL_LAUNCH_A::Active)
395    }
396}
397pub type OPTLOCK_R = crate::BitReader<OPTLOCK_A>;
399#[derive(Clone, Copy, Debug, PartialEq, Eq)]
403pub enum OPTLOCK_A {
404    Unlocked = 0,
406    Locked = 1,
408}
409impl From<OPTLOCK_A> for bool {
410    #[inline(always)]
411    fn from(variant: OPTLOCK_A) -> Self {
412        variant as u8 != 0
413    }
414}
415impl OPTLOCK_R {
416    #[inline(always)]
418    pub fn variant(&self) -> OPTLOCK_A {
419        match self.bits {
420            false => OPTLOCK_A::Unlocked,
421            true => OPTLOCK_A::Locked,
422        }
423    }
424    #[inline(always)]
426    pub fn is_unlocked(&self) -> bool {
427        *self == OPTLOCK_A::Unlocked
428    }
429    #[inline(always)]
431    pub fn is_locked(&self) -> bool {
432        *self == OPTLOCK_A::Locked
433    }
434}
435pub type OPTLOCK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, OPTLOCK_A, O>;
437impl<'a, const O: u8> OPTLOCK_W<'a, O> {
438    #[inline(always)]
440    pub fn unlocked(self) -> &'a mut W {
441        self.variant(OPTLOCK_A::Unlocked)
442    }
443    #[inline(always)]
445    pub fn locked(self) -> &'a mut W {
446        self.variant(OPTLOCK_A::Locked)
447    }
448}
449pub type LOCK_R = crate::BitReader<LOCK_A>;
451#[derive(Clone, Copy, Debug, PartialEq, Eq)]
455pub enum LOCK_A {
456    Unlocked = 0,
458    Locked = 1,
460}
461impl From<LOCK_A> for bool {
462    #[inline(always)]
463    fn from(variant: LOCK_A) -> Self {
464        variant as u8 != 0
465    }
466}
467impl LOCK_R {
468    #[inline(always)]
470    pub fn variant(&self) -> LOCK_A {
471        match self.bits {
472            false => LOCK_A::Unlocked,
473            true => LOCK_A::Locked,
474        }
475    }
476    #[inline(always)]
478    pub fn is_unlocked(&self) -> bool {
479        *self == LOCK_A::Unlocked
480    }
481    #[inline(always)]
483    pub fn is_locked(&self) -> bool {
484        *self == LOCK_A::Locked
485    }
486}
487pub type LOCK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, LOCK_A, O>;
489impl<'a, const O: u8> LOCK_W<'a, O> {
490    #[inline(always)]
492    pub fn unlocked(self) -> &'a mut W {
493        self.variant(LOCK_A::Unlocked)
494    }
495    #[inline(always)]
497    pub fn locked(self) -> &'a mut W {
498        self.variant(LOCK_A::Locked)
499    }
500}
501impl R {
502    #[inline(always)]
504    pub fn pg(&self) -> PG_R {
505        PG_R::new((self.bits & 1) != 0)
506    }
507    #[inline(always)]
509    pub fn per(&self) -> PER_R {
510        PER_R::new(((self.bits >> 1) & 1) != 0)
511    }
512    #[inline(always)]
514    pub fn mer(&self) -> MER_R {
515        MER_R::new(((self.bits >> 2) & 1) != 0)
516    }
517    #[inline(always)]
519    pub fn ser(&self) -> SER_R {
520        SER_R::new(((self.bits >> 11) & 1) != 0)
521    }
522    #[inline(always)]
524    pub fn optstrt(&self) -> OPTSTRT_R {
525        OPTSTRT_R::new(((self.bits >> 17) & 1) != 0)
526    }
527    #[inline(always)]
529    pub fn pgstrt(&self) -> PGSTRT_R {
530        PGSTRT_R::new(((self.bits >> 19) & 1) != 0)
531    }
532    #[inline(always)]
534    pub fn eopie(&self) -> EOPIE_R {
535        EOPIE_R::new(((self.bits >> 24) & 1) != 0)
536    }
537    #[inline(always)]
539    pub fn errie(&self) -> ERRIE_R {
540        ERRIE_R::new(((self.bits >> 25) & 1) != 0)
541    }
542    #[inline(always)]
544    pub fn obl_launch(&self) -> OBL_LAUNCH_R {
545        OBL_LAUNCH_R::new(((self.bits >> 27) & 1) != 0)
546    }
547    #[inline(always)]
549    pub fn optlock(&self) -> OPTLOCK_R {
550        OPTLOCK_R::new(((self.bits >> 30) & 1) != 0)
551    }
552    #[inline(always)]
554    pub fn lock(&self) -> LOCK_R {
555        LOCK_R::new(((self.bits >> 31) & 1) != 0)
556    }
557}
558impl W {
559    #[inline(always)]
561    #[must_use]
562    pub fn pg(&mut self) -> PG_W<0> {
563        PG_W::new(self)
564    }
565    #[inline(always)]
567    #[must_use]
568    pub fn per(&mut self) -> PER_W<1> {
569        PER_W::new(self)
570    }
571    #[inline(always)]
573    #[must_use]
574    pub fn mer(&mut self) -> MER_W<2> {
575        MER_W::new(self)
576    }
577    #[inline(always)]
579    #[must_use]
580    pub fn ser(&mut self) -> SER_W<11> {
581        SER_W::new(self)
582    }
583    #[inline(always)]
585    #[must_use]
586    pub fn optstrt(&mut self) -> OPTSTRT_W<17> {
587        OPTSTRT_W::new(self)
588    }
589    #[inline(always)]
591    #[must_use]
592    pub fn pgstrt(&mut self) -> PGSTRT_W<19> {
593        PGSTRT_W::new(self)
594    }
595    #[inline(always)]
597    #[must_use]
598    pub fn eopie(&mut self) -> EOPIE_W<24> {
599        EOPIE_W::new(self)
600    }
601    #[inline(always)]
603    #[must_use]
604    pub fn errie(&mut self) -> ERRIE_W<25> {
605        ERRIE_W::new(self)
606    }
607    #[inline(always)]
609    #[must_use]
610    pub fn obl_launch(&mut self) -> OBL_LAUNCH_W<27> {
611        OBL_LAUNCH_W::new(self)
612    }
613    #[inline(always)]
615    #[must_use]
616    pub fn optlock(&mut self) -> OPTLOCK_W<30> {
617        OPTLOCK_W::new(self)
618    }
619    #[inline(always)]
621    #[must_use]
622    pub fn lock(&mut self) -> LOCK_W<31> {
623        LOCK_W::new(self)
624    }
625    #[inline(always)]
627    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
628        self.0.bits(bits);
629        self
630    }
631}
632pub struct CR_SPEC;
638impl crate::RegisterSpec for CR_SPEC {
639    type Ux = u32;
640}
641impl crate::Readable for CR_SPEC {
643    type Reader = R;
644}
645impl crate::Writable for CR_SPEC {
647    type Writer = W;
648    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
649    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
650}
651impl crate::Resettable for CR_SPEC {
653    const RESET_VALUE: Self::Ux = 0xc000_0000;
654}