atsam3n4c/efc/
fcr.rs

1#[doc = "Register `FCR` writer"]
2pub type W = crate::W<FcrSpec>;
3#[doc = "Flash Command"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5#[repr(u8)]
6pub enum Fcmd {
7    #[doc = "0: Get Flash Descriptor"]
8    Getd = 0,
9    #[doc = "1: Write page"]
10    Wp = 1,
11    #[doc = "2: Write page and lock"]
12    Wpl = 2,
13    #[doc = "3: Erase page and write page"]
14    Ewp = 3,
15    #[doc = "4: Erase page and write page then lock"]
16    Ewpl = 4,
17    #[doc = "5: Erase all"]
18    Ea = 5,
19    #[doc = "8: Set Lock Bit"]
20    Slb = 8,
21    #[doc = "9: Clear Lock Bit"]
22    Clb = 9,
23    #[doc = "10: Get Lock Bit"]
24    Glb = 10,
25    #[doc = "11: Set GPNVM Bit"]
26    Sgpb = 11,
27    #[doc = "12: Clear GPNVM Bit"]
28    Cgpb = 12,
29    #[doc = "13: Get GPNVM Bit"]
30    Ggpb = 13,
31    #[doc = "14: Start Read Unique Identifier"]
32    Stui = 14,
33    #[doc = "15: Stop Read Unique Identifier"]
34    Spui = 15,
35    #[doc = "16: Get CALIB Bit"]
36    Gcalb = 16,
37}
38impl From<Fcmd> for u8 {
39    #[inline(always)]
40    fn from(variant: Fcmd) -> Self {
41        variant as _
42    }
43}
44impl crate::FieldSpec for Fcmd {
45    type Ux = u8;
46}
47impl crate::IsEnum for Fcmd {}
48#[doc = "Field `FCMD` writer - Flash Command"]
49pub type FcmdW<'a, REG> = crate::FieldWriter<'a, REG, 8, Fcmd>;
50impl<'a, REG> FcmdW<'a, REG>
51where
52    REG: crate::Writable + crate::RegisterSpec,
53    REG::Ux: From<u8>,
54{
55    #[doc = "Get Flash Descriptor"]
56    #[inline(always)]
57    pub fn getd(self) -> &'a mut crate::W<REG> {
58        self.variant(Fcmd::Getd)
59    }
60    #[doc = "Write page"]
61    #[inline(always)]
62    pub fn wp(self) -> &'a mut crate::W<REG> {
63        self.variant(Fcmd::Wp)
64    }
65    #[doc = "Write page and lock"]
66    #[inline(always)]
67    pub fn wpl(self) -> &'a mut crate::W<REG> {
68        self.variant(Fcmd::Wpl)
69    }
70    #[doc = "Erase page and write page"]
71    #[inline(always)]
72    pub fn ewp(self) -> &'a mut crate::W<REG> {
73        self.variant(Fcmd::Ewp)
74    }
75    #[doc = "Erase page and write page then lock"]
76    #[inline(always)]
77    pub fn ewpl(self) -> &'a mut crate::W<REG> {
78        self.variant(Fcmd::Ewpl)
79    }
80    #[doc = "Erase all"]
81    #[inline(always)]
82    pub fn ea(self) -> &'a mut crate::W<REG> {
83        self.variant(Fcmd::Ea)
84    }
85    #[doc = "Set Lock Bit"]
86    #[inline(always)]
87    pub fn slb(self) -> &'a mut crate::W<REG> {
88        self.variant(Fcmd::Slb)
89    }
90    #[doc = "Clear Lock Bit"]
91    #[inline(always)]
92    pub fn clb(self) -> &'a mut crate::W<REG> {
93        self.variant(Fcmd::Clb)
94    }
95    #[doc = "Get Lock Bit"]
96    #[inline(always)]
97    pub fn glb(self) -> &'a mut crate::W<REG> {
98        self.variant(Fcmd::Glb)
99    }
100    #[doc = "Set GPNVM Bit"]
101    #[inline(always)]
102    pub fn sgpb(self) -> &'a mut crate::W<REG> {
103        self.variant(Fcmd::Sgpb)
104    }
105    #[doc = "Clear GPNVM Bit"]
106    #[inline(always)]
107    pub fn cgpb(self) -> &'a mut crate::W<REG> {
108        self.variant(Fcmd::Cgpb)
109    }
110    #[doc = "Get GPNVM Bit"]
111    #[inline(always)]
112    pub fn ggpb(self) -> &'a mut crate::W<REG> {
113        self.variant(Fcmd::Ggpb)
114    }
115    #[doc = "Start Read Unique Identifier"]
116    #[inline(always)]
117    pub fn stui(self) -> &'a mut crate::W<REG> {
118        self.variant(Fcmd::Stui)
119    }
120    #[doc = "Stop Read Unique Identifier"]
121    #[inline(always)]
122    pub fn spui(self) -> &'a mut crate::W<REG> {
123        self.variant(Fcmd::Spui)
124    }
125    #[doc = "Get CALIB Bit"]
126    #[inline(always)]
127    pub fn gcalb(self) -> &'a mut crate::W<REG> {
128        self.variant(Fcmd::Gcalb)
129    }
130}
131#[doc = "Field `FARG` writer - Flash Command Argument"]
132pub type FargW<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
133#[doc = "Flash Writing Protection Key"]
134#[derive(Clone, Copy, Debug, PartialEq, Eq)]
135#[repr(u8)]
136pub enum Fkey {
137    #[doc = "90: The 0x5A value enables the command defined by the bits of the register. If the field is written with a different value, the write is not performed and no action is started."]
138    Passwd = 90,
139}
140impl From<Fkey> for u8 {
141    #[inline(always)]
142    fn from(variant: Fkey) -> Self {
143        variant as _
144    }
145}
146impl crate::FieldSpec for Fkey {
147    type Ux = u8;
148}
149impl crate::IsEnum for Fkey {}
150#[doc = "Field `FKEY` writer - Flash Writing Protection Key"]
151pub type FkeyW<'a, REG> = crate::FieldWriter<'a, REG, 8, Fkey>;
152impl<'a, REG> FkeyW<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155    REG::Ux: From<u8>,
156{
157    #[doc = "The 0x5A value enables the command defined by the bits of the register. If the field is written with a different value, the write is not performed and no action is started."]
158    #[inline(always)]
159    pub fn passwd(self) -> &'a mut crate::W<REG> {
160        self.variant(Fkey::Passwd)
161    }
162}
163impl W {
164    #[doc = "Bits 0:7 - Flash Command"]
165    #[inline(always)]
166    #[must_use]
167    pub fn fcmd(&mut self) -> FcmdW<FcrSpec> {
168        FcmdW::new(self, 0)
169    }
170    #[doc = "Bits 8:23 - Flash Command Argument"]
171    #[inline(always)]
172    #[must_use]
173    pub fn farg(&mut self) -> FargW<FcrSpec> {
174        FargW::new(self, 8)
175    }
176    #[doc = "Bits 24:31 - Flash Writing Protection Key"]
177    #[inline(always)]
178    #[must_use]
179    pub fn fkey(&mut self) -> FkeyW<FcrSpec> {
180        FkeyW::new(self, 24)
181    }
182}
183#[doc = "EEFC Flash Command Register\n\nYou can [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`fcr::W`](W). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
184pub struct FcrSpec;
185impl crate::RegisterSpec for FcrSpec {
186    type Ux = u32;
187}
188#[doc = "`write(|w| ..)` method takes [`fcr::W`](W) writer structure"]
189impl crate::Writable for FcrSpec {
190    type Safety = crate::Unsafe;
191    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
192    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
193}