1#[doc = "Register `MSFCFG` reader"]
2pub type R = crate::R<MsfcfgSpec>;
3#[doc = "Register `MSFCFG` writer"]
4pub type W = crate::W<MsfcfgSpec>;
5#[doc = "user IFR sector 0 erase control\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum IfrEraseDis0 {
9 #[doc = "0: Enable IFR sector erase."]
10 Enable = 0,
11 #[doc = "1: Disable IFR sector erase, write one lock until a system reset."]
12 Disable = 1,
13}
14impl From<IfrEraseDis0> for bool {
15 #[inline(always)]
16 fn from(variant: IfrEraseDis0) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `IFR_ERASE_DIS0` reader - user IFR sector 0 erase control"]
21pub type IfrEraseDis0R = crate::BitReader<IfrEraseDis0>;
22impl IfrEraseDis0R {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> IfrEraseDis0 {
26 match self.bits {
27 false => IfrEraseDis0::Enable,
28 true => IfrEraseDis0::Disable,
29 }
30 }
31 #[doc = "Enable IFR sector erase."]
32 #[inline(always)]
33 pub fn is_enable(&self) -> bool {
34 *self == IfrEraseDis0::Enable
35 }
36 #[doc = "Disable IFR sector erase, write one lock until a system reset."]
37 #[inline(always)]
38 pub fn is_disable(&self) -> bool {
39 *self == IfrEraseDis0::Disable
40 }
41}
42#[doc = "Field `IFR_ERASE_DIS0` writer - user IFR sector 0 erase control"]
43pub type IfrEraseDis0W<'a, REG> = crate::BitWriter<'a, REG, IfrEraseDis0>;
44impl<'a, REG> IfrEraseDis0W<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Enable IFR sector erase."]
49 #[inline(always)]
50 pub fn enable(self) -> &'a mut crate::W<REG> {
51 self.variant(IfrEraseDis0::Enable)
52 }
53 #[doc = "Disable IFR sector erase, write one lock until a system reset."]
54 #[inline(always)]
55 pub fn disable(self) -> &'a mut crate::W<REG> {
56 self.variant(IfrEraseDis0::Disable)
57 }
58}
59#[doc = "user IFR sector 1 erase control\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum IfrEraseDis1 {
63 #[doc = "0: Enable IFR sector erase."]
64 Enable = 0,
65 #[doc = "1: Disable IFR sector erase, write one lock until a system reset."]
66 Disable = 1,
67}
68impl From<IfrEraseDis1> for bool {
69 #[inline(always)]
70 fn from(variant: IfrEraseDis1) -> Self {
71 variant as u8 != 0
72 }
73}
74#[doc = "Field `IFR_ERASE_DIS1` reader - user IFR sector 1 erase control"]
75pub type IfrEraseDis1R = crate::BitReader<IfrEraseDis1>;
76impl IfrEraseDis1R {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub const fn variant(&self) -> IfrEraseDis1 {
80 match self.bits {
81 false => IfrEraseDis1::Enable,
82 true => IfrEraseDis1::Disable,
83 }
84 }
85 #[doc = "Enable IFR sector erase."]
86 #[inline(always)]
87 pub fn is_enable(&self) -> bool {
88 *self == IfrEraseDis1::Enable
89 }
90 #[doc = "Disable IFR sector erase, write one lock until a system reset."]
91 #[inline(always)]
92 pub fn is_disable(&self) -> bool {
93 *self == IfrEraseDis1::Disable
94 }
95}
96#[doc = "Field `IFR_ERASE_DIS1` writer - user IFR sector 1 erase control"]
97pub type IfrEraseDis1W<'a, REG> = crate::BitWriter<'a, REG, IfrEraseDis1>;
98impl<'a, REG> IfrEraseDis1W<'a, REG>
99where
100 REG: crate::Writable + crate::RegisterSpec,
101{
102 #[doc = "Enable IFR sector erase."]
103 #[inline(always)]
104 pub fn enable(self) -> &'a mut crate::W<REG> {
105 self.variant(IfrEraseDis1::Enable)
106 }
107 #[doc = "Disable IFR sector erase, write one lock until a system reset."]
108 #[inline(always)]
109 pub fn disable(self) -> &'a mut crate::W<REG> {
110 self.variant(IfrEraseDis1::Disable)
111 }
112}
113#[doc = "user IFR sector 2 erase control\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum IfrEraseDis2 {
117 #[doc = "0: Enable IFR sector erase."]
118 Enable = 0,
119 #[doc = "1: Disable IFR sector erase, write one lock until a system reset."]
120 Disable = 1,
121}
122impl From<IfrEraseDis2> for bool {
123 #[inline(always)]
124 fn from(variant: IfrEraseDis2) -> Self {
125 variant as u8 != 0
126 }
127}
128#[doc = "Field `IFR_ERASE_DIS2` reader - user IFR sector 2 erase control"]
129pub type IfrEraseDis2R = crate::BitReader<IfrEraseDis2>;
130impl IfrEraseDis2R {
131 #[doc = "Get enumerated values variant"]
132 #[inline(always)]
133 pub const fn variant(&self) -> IfrEraseDis2 {
134 match self.bits {
135 false => IfrEraseDis2::Enable,
136 true => IfrEraseDis2::Disable,
137 }
138 }
139 #[doc = "Enable IFR sector erase."]
140 #[inline(always)]
141 pub fn is_enable(&self) -> bool {
142 *self == IfrEraseDis2::Enable
143 }
144 #[doc = "Disable IFR sector erase, write one lock until a system reset."]
145 #[inline(always)]
146 pub fn is_disable(&self) -> bool {
147 *self == IfrEraseDis2::Disable
148 }
149}
150#[doc = "Field `IFR_ERASE_DIS2` writer - user IFR sector 2 erase control"]
151pub type IfrEraseDis2W<'a, REG> = crate::BitWriter<'a, REG, IfrEraseDis2>;
152impl<'a, REG> IfrEraseDis2W<'a, REG>
153where
154 REG: crate::Writable + crate::RegisterSpec,
155{
156 #[doc = "Enable IFR sector erase."]
157 #[inline(always)]
158 pub fn enable(self) -> &'a mut crate::W<REG> {
159 self.variant(IfrEraseDis2::Enable)
160 }
161 #[doc = "Disable IFR sector erase, write one lock until a system reset."]
162 #[inline(always)]
163 pub fn disable(self) -> &'a mut crate::W<REG> {
164 self.variant(IfrEraseDis2::Disable)
165 }
166}
167#[doc = "user IFR sector 3 erase control\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum IfrEraseDis3 {
171 #[doc = "0: Enable IFR sector erase."]
172 Enable = 0,
173 #[doc = "1: Disable IFR sector erase, write one lock until a system reset."]
174 Disable = 1,
175}
176impl From<IfrEraseDis3> for bool {
177 #[inline(always)]
178 fn from(variant: IfrEraseDis3) -> Self {
179 variant as u8 != 0
180 }
181}
182#[doc = "Field `IFR_ERASE_DIS3` reader - user IFR sector 3 erase control"]
183pub type IfrEraseDis3R = crate::BitReader<IfrEraseDis3>;
184impl IfrEraseDis3R {
185 #[doc = "Get enumerated values variant"]
186 #[inline(always)]
187 pub const fn variant(&self) -> IfrEraseDis3 {
188 match self.bits {
189 false => IfrEraseDis3::Enable,
190 true => IfrEraseDis3::Disable,
191 }
192 }
193 #[doc = "Enable IFR sector erase."]
194 #[inline(always)]
195 pub fn is_enable(&self) -> bool {
196 *self == IfrEraseDis3::Enable
197 }
198 #[doc = "Disable IFR sector erase, write one lock until a system reset."]
199 #[inline(always)]
200 pub fn is_disable(&self) -> bool {
201 *self == IfrEraseDis3::Disable
202 }
203}
204#[doc = "Field `IFR_ERASE_DIS3` writer - user IFR sector 3 erase control"]
205pub type IfrEraseDis3W<'a, REG> = crate::BitWriter<'a, REG, IfrEraseDis3>;
206impl<'a, REG> IfrEraseDis3W<'a, REG>
207where
208 REG: crate::Writable + crate::RegisterSpec,
209{
210 #[doc = "Enable IFR sector erase."]
211 #[inline(always)]
212 pub fn enable(self) -> &'a mut crate::W<REG> {
213 self.variant(IfrEraseDis3::Enable)
214 }
215 #[doc = "Disable IFR sector erase, write one lock until a system reset."]
216 #[inline(always)]
217 pub fn disable(self) -> &'a mut crate::W<REG> {
218 self.variant(IfrEraseDis3::Disable)
219 }
220}
221#[doc = "Mass erase control\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum MassEraseDis {
225 #[doc = "0: Enables mass erase"]
226 Enable = 0,
227 #[doc = "1: Disables mass erase, write one lock until a system reset."]
228 Disable = 1,
229}
230impl From<MassEraseDis> for bool {
231 #[inline(always)]
232 fn from(variant: MassEraseDis) -> Self {
233 variant as u8 != 0
234 }
235}
236#[doc = "Field `MASS_ERASE_DIS` reader - Mass erase control"]
237pub type MassEraseDisR = crate::BitReader<MassEraseDis>;
238impl MassEraseDisR {
239 #[doc = "Get enumerated values variant"]
240 #[inline(always)]
241 pub const fn variant(&self) -> MassEraseDis {
242 match self.bits {
243 false => MassEraseDis::Enable,
244 true => MassEraseDis::Disable,
245 }
246 }
247 #[doc = "Enables mass erase"]
248 #[inline(always)]
249 pub fn is_enable(&self) -> bool {
250 *self == MassEraseDis::Enable
251 }
252 #[doc = "Disables mass erase, write one lock until a system reset."]
253 #[inline(always)]
254 pub fn is_disable(&self) -> bool {
255 *self == MassEraseDis::Disable
256 }
257}
258#[doc = "Field `MASS_ERASE_DIS` writer - Mass erase control"]
259pub type MassEraseDisW<'a, REG> = crate::BitWriter<'a, REG, MassEraseDis>;
260impl<'a, REG> MassEraseDisW<'a, REG>
261where
262 REG: crate::Writable + crate::RegisterSpec,
263{
264 #[doc = "Enables mass erase"]
265 #[inline(always)]
266 pub fn enable(self) -> &'a mut crate::W<REG> {
267 self.variant(MassEraseDis::Enable)
268 }
269 #[doc = "Disables mass erase, write one lock until a system reset."]
270 #[inline(always)]
271 pub fn disable(self) -> &'a mut crate::W<REG> {
272 self.variant(MassEraseDis::Disable)
273 }
274}
275impl R {
276 #[doc = "Bit 0 - user IFR sector 0 erase control"]
277 #[inline(always)]
278 pub fn ifr_erase_dis0(&self) -> IfrEraseDis0R {
279 IfrEraseDis0R::new((self.bits & 1) != 0)
280 }
281 #[doc = "Bit 1 - user IFR sector 1 erase control"]
282 #[inline(always)]
283 pub fn ifr_erase_dis1(&self) -> IfrEraseDis1R {
284 IfrEraseDis1R::new(((self.bits >> 1) & 1) != 0)
285 }
286 #[doc = "Bit 2 - user IFR sector 2 erase control"]
287 #[inline(always)]
288 pub fn ifr_erase_dis2(&self) -> IfrEraseDis2R {
289 IfrEraseDis2R::new(((self.bits >> 2) & 1) != 0)
290 }
291 #[doc = "Bit 3 - user IFR sector 3 erase control"]
292 #[inline(always)]
293 pub fn ifr_erase_dis3(&self) -> IfrEraseDis3R {
294 IfrEraseDis3R::new(((self.bits >> 3) & 1) != 0)
295 }
296 #[doc = "Bit 8 - Mass erase control"]
297 #[inline(always)]
298 pub fn mass_erase_dis(&self) -> MassEraseDisR {
299 MassEraseDisR::new(((self.bits >> 8) & 1) != 0)
300 }
301}
302#[cfg(feature = "debug")]
303impl core::fmt::Debug for R {
304 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
305 f.debug_struct("MSFCFG")
306 .field("ifr_erase_dis0", &self.ifr_erase_dis0())
307 .field("ifr_erase_dis1", &self.ifr_erase_dis1())
308 .field("ifr_erase_dis2", &self.ifr_erase_dis2())
309 .field("ifr_erase_dis3", &self.ifr_erase_dis3())
310 .field("mass_erase_dis", &self.mass_erase_dis())
311 .finish()
312 }
313}
314impl W {
315 #[doc = "Bit 0 - user IFR sector 0 erase control"]
316 #[inline(always)]
317 pub fn ifr_erase_dis0(&mut self) -> IfrEraseDis0W<'_, MsfcfgSpec> {
318 IfrEraseDis0W::new(self, 0)
319 }
320 #[doc = "Bit 1 - user IFR sector 1 erase control"]
321 #[inline(always)]
322 pub fn ifr_erase_dis1(&mut self) -> IfrEraseDis1W<'_, MsfcfgSpec> {
323 IfrEraseDis1W::new(self, 1)
324 }
325 #[doc = "Bit 2 - user IFR sector 2 erase control"]
326 #[inline(always)]
327 pub fn ifr_erase_dis2(&mut self) -> IfrEraseDis2W<'_, MsfcfgSpec> {
328 IfrEraseDis2W::new(self, 2)
329 }
330 #[doc = "Bit 3 - user IFR sector 3 erase control"]
331 #[inline(always)]
332 pub fn ifr_erase_dis3(&mut self) -> IfrEraseDis3W<'_, MsfcfgSpec> {
333 IfrEraseDis3W::new(self, 3)
334 }
335 #[doc = "Bit 8 - Mass erase control"]
336 #[inline(always)]
337 pub fn mass_erase_dis(&mut self) -> MassEraseDisW<'_, MsfcfgSpec> {
338 MassEraseDisW::new(self, 8)
339 }
340}
341#[doc = "MSF Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`msfcfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`msfcfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
342pub struct MsfcfgSpec;
343impl crate::RegisterSpec for MsfcfgSpec {
344 type Ux = u32;
345}
346#[doc = "`read()` method returns [`msfcfg::R`](R) reader structure"]
347impl crate::Readable for MsfcfgSpec {}
348#[doc = "`write(|w| ..)` method takes [`msfcfg::W`](W) writer structure"]
349impl crate::Writable for MsfcfgSpec {
350 type Safety = crate::Unsafe;
351}
352#[doc = "`reset()` method sets MSFCFG to value 0"]
353impl crate::Resettable for MsfcfgSpec {}