1#[doc = "Reader of register FCFG1"]
2pub type R = crate::R<u32, super::FCFG1>;
3#[doc = "Writer for register FCFG1"]
4pub type W = crate::W<u32, super::FCFG1>;
5#[doc = "Register FCFG1 `reset()`'s with value 0xff0f_0f00"]
6impl crate::ResetValue for super::FCFG1 {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0xff0f_0f00
11 }
12}
13#[doc = "Flash Disable\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum FLASHDIS_A {
16 #[doc = "0: Flash is enabled"]
17 _0 = 0,
18 #[doc = "1: Flash is disabled"]
19 _1 = 1,
20}
21impl From<FLASHDIS_A> for bool {
22 #[inline(always)]
23 fn from(variant: FLASHDIS_A) -> Self {
24 variant as u8 != 0
25 }
26}
27#[doc = "Reader of field `FLASHDIS`"]
28pub type FLASHDIS_R = crate::R<bool, FLASHDIS_A>;
29impl FLASHDIS_R {
30 #[doc = r"Get enumerated values variant"]
31 #[inline(always)]
32 pub fn variant(&self) -> FLASHDIS_A {
33 match self.bits {
34 false => FLASHDIS_A::_0,
35 true => FLASHDIS_A::_1,
36 }
37 }
38 #[doc = "Checks if the value of the field is `_0`"]
39 #[inline(always)]
40 pub fn is_0(&self) -> bool {
41 *self == FLASHDIS_A::_0
42 }
43 #[doc = "Checks if the value of the field is `_1`"]
44 #[inline(always)]
45 pub fn is_1(&self) -> bool {
46 *self == FLASHDIS_A::_1
47 }
48}
49#[doc = "Write proxy for field `FLASHDIS`"]
50pub struct FLASHDIS_W<'a> {
51 w: &'a mut W,
52}
53impl<'a> FLASHDIS_W<'a> {
54 #[doc = r"Writes `variant` to the field"]
55 #[inline(always)]
56 pub fn variant(self, variant: FLASHDIS_A) -> &'a mut W {
57 {
58 self.bit(variant.into())
59 }
60 }
61 #[doc = "Flash is enabled"]
62 #[inline(always)]
63 pub fn _0(self) -> &'a mut W {
64 self.variant(FLASHDIS_A::_0)
65 }
66 #[doc = "Flash is disabled"]
67 #[inline(always)]
68 pub fn _1(self) -> &'a mut W {
69 self.variant(FLASHDIS_A::_1)
70 }
71 #[doc = r"Sets the field bit"]
72 #[inline(always)]
73 pub fn set_bit(self) -> &'a mut W {
74 self.bit(true)
75 }
76 #[doc = r"Clears the field bit"]
77 #[inline(always)]
78 pub fn clear_bit(self) -> &'a mut W {
79 self.bit(false)
80 }
81 #[doc = r"Writes raw bits to the field"]
82 #[inline(always)]
83 pub fn bit(self, value: bool) -> &'a mut W {
84 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
85 self.w
86 }
87}
88#[doc = "Flash Doze\n\nValue on reset: 0"]
89#[derive(Clone, Copy, Debug, PartialEq)]
90pub enum FLASHDOZE_A {
91 #[doc = "0: Flash remains enabled during Wait mode"]
92 _0 = 0,
93 #[doc = "1: Flash is disabled for the duration of Wait mode"]
94 _1 = 1,
95}
96impl From<FLASHDOZE_A> for bool {
97 #[inline(always)]
98 fn from(variant: FLASHDOZE_A) -> Self {
99 variant as u8 != 0
100 }
101}
102#[doc = "Reader of field `FLASHDOZE`"]
103pub type FLASHDOZE_R = crate::R<bool, FLASHDOZE_A>;
104impl FLASHDOZE_R {
105 #[doc = r"Get enumerated values variant"]
106 #[inline(always)]
107 pub fn variant(&self) -> FLASHDOZE_A {
108 match self.bits {
109 false => FLASHDOZE_A::_0,
110 true => FLASHDOZE_A::_1,
111 }
112 }
113 #[doc = "Checks if the value of the field is `_0`"]
114 #[inline(always)]
115 pub fn is_0(&self) -> bool {
116 *self == FLASHDOZE_A::_0
117 }
118 #[doc = "Checks if the value of the field is `_1`"]
119 #[inline(always)]
120 pub fn is_1(&self) -> bool {
121 *self == FLASHDOZE_A::_1
122 }
123}
124#[doc = "Write proxy for field `FLASHDOZE`"]
125pub struct FLASHDOZE_W<'a> {
126 w: &'a mut W,
127}
128impl<'a> FLASHDOZE_W<'a> {
129 #[doc = r"Writes `variant` to the field"]
130 #[inline(always)]
131 pub fn variant(self, variant: FLASHDOZE_A) -> &'a mut W {
132 {
133 self.bit(variant.into())
134 }
135 }
136 #[doc = "Flash remains enabled during Wait mode"]
137 #[inline(always)]
138 pub fn _0(self) -> &'a mut W {
139 self.variant(FLASHDOZE_A::_0)
140 }
141 #[doc = "Flash is disabled for the duration of Wait mode"]
142 #[inline(always)]
143 pub fn _1(self) -> &'a mut W {
144 self.variant(FLASHDOZE_A::_1)
145 }
146 #[doc = r"Sets the field bit"]
147 #[inline(always)]
148 pub fn set_bit(self) -> &'a mut W {
149 self.bit(true)
150 }
151 #[doc = r"Clears the field bit"]
152 #[inline(always)]
153 pub fn clear_bit(self) -> &'a mut W {
154 self.bit(false)
155 }
156 #[doc = r"Writes raw bits to the field"]
157 #[inline(always)]
158 pub fn bit(self, value: bool) -> &'a mut W {
159 self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
160 self.w
161 }
162}
163#[doc = "Reader of field `DEPART`"]
164pub type DEPART_R = crate::R<u8, u8>;
165#[doc = "EEPROM size\n\nValue on reset: 15"]
166#[derive(Clone, Copy, Debug, PartialEq)]
167#[repr(u8)]
168pub enum EESIZE_A {
169 #[doc = "0: 16 KB"]
170 _0000 = 0,
171 #[doc = "1: 8 KB"]
172 _0001 = 1,
173 #[doc = "2: 4 KB"]
174 _0010 = 2,
175 #[doc = "3: 2 KB"]
176 _0011 = 3,
177 #[doc = "4: 1 KB"]
178 _0100 = 4,
179 #[doc = "5: 512 Bytes"]
180 _0101 = 5,
181 #[doc = "6: 256 Bytes"]
182 _0110 = 6,
183 #[doc = "7: 128 Bytes"]
184 _0111 = 7,
185 #[doc = "8: 64 Bytes"]
186 _1000 = 8,
187 #[doc = "9: 32 Bytes"]
188 _1001 = 9,
189 #[doc = "15: 0 Bytes"]
190 _1111 = 15,
191}
192impl From<EESIZE_A> for u8 {
193 #[inline(always)]
194 fn from(variant: EESIZE_A) -> Self {
195 variant as _
196 }
197}
198#[doc = "Reader of field `EESIZE`"]
199pub type EESIZE_R = crate::R<u8, EESIZE_A>;
200impl EESIZE_R {
201 #[doc = r"Get enumerated values variant"]
202 #[inline(always)]
203 pub fn variant(&self) -> crate::Variant<u8, EESIZE_A> {
204 use crate::Variant::*;
205 match self.bits {
206 0 => Val(EESIZE_A::_0000),
207 1 => Val(EESIZE_A::_0001),
208 2 => Val(EESIZE_A::_0010),
209 3 => Val(EESIZE_A::_0011),
210 4 => Val(EESIZE_A::_0100),
211 5 => Val(EESIZE_A::_0101),
212 6 => Val(EESIZE_A::_0110),
213 7 => Val(EESIZE_A::_0111),
214 8 => Val(EESIZE_A::_1000),
215 9 => Val(EESIZE_A::_1001),
216 15 => Val(EESIZE_A::_1111),
217 i => Res(i),
218 }
219 }
220 #[doc = "Checks if the value of the field is `_0000`"]
221 #[inline(always)]
222 pub fn is_0000(&self) -> bool {
223 *self == EESIZE_A::_0000
224 }
225 #[doc = "Checks if the value of the field is `_0001`"]
226 #[inline(always)]
227 pub fn is_0001(&self) -> bool {
228 *self == EESIZE_A::_0001
229 }
230 #[doc = "Checks if the value of the field is `_0010`"]
231 #[inline(always)]
232 pub fn is_0010(&self) -> bool {
233 *self == EESIZE_A::_0010
234 }
235 #[doc = "Checks if the value of the field is `_0011`"]
236 #[inline(always)]
237 pub fn is_0011(&self) -> bool {
238 *self == EESIZE_A::_0011
239 }
240 #[doc = "Checks if the value of the field is `_0100`"]
241 #[inline(always)]
242 pub fn is_0100(&self) -> bool {
243 *self == EESIZE_A::_0100
244 }
245 #[doc = "Checks if the value of the field is `_0101`"]
246 #[inline(always)]
247 pub fn is_0101(&self) -> bool {
248 *self == EESIZE_A::_0101
249 }
250 #[doc = "Checks if the value of the field is `_0110`"]
251 #[inline(always)]
252 pub fn is_0110(&self) -> bool {
253 *self == EESIZE_A::_0110
254 }
255 #[doc = "Checks if the value of the field is `_0111`"]
256 #[inline(always)]
257 pub fn is_0111(&self) -> bool {
258 *self == EESIZE_A::_0111
259 }
260 #[doc = "Checks if the value of the field is `_1000`"]
261 #[inline(always)]
262 pub fn is_1000(&self) -> bool {
263 *self == EESIZE_A::_1000
264 }
265 #[doc = "Checks if the value of the field is `_1001`"]
266 #[inline(always)]
267 pub fn is_1001(&self) -> bool {
268 *self == EESIZE_A::_1001
269 }
270 #[doc = "Checks if the value of the field is `_1111`"]
271 #[inline(always)]
272 pub fn is_1111(&self) -> bool {
273 *self == EESIZE_A::_1111
274 }
275}
276#[doc = "Program flash size\n\nValue on reset: 15"]
277#[derive(Clone, Copy, Debug, PartialEq)]
278#[repr(u8)]
279pub enum PFSIZE_A {
280 #[doc = "3: 32 KB of program flash memory"]
281 _0011 = 3,
282 #[doc = "5: 64 KB of program flash memory"]
283 _0101 = 5,
284 #[doc = "7: 128 KB of program flash memory"]
285 _0111 = 7,
286 #[doc = "9: 256 KB of program flash memory"]
287 _1001 = 9,
288 #[doc = "11: 512 KB of program flash memory"]
289 _1011 = 11,
290 #[doc = "13: 1024 KB of program flash memory"]
291 _1101 = 13,
292 #[doc = "15: 1024 KB of program flash memory"]
293 _1111 = 15,
294}
295impl From<PFSIZE_A> for u8 {
296 #[inline(always)]
297 fn from(variant: PFSIZE_A) -> Self {
298 variant as _
299 }
300}
301#[doc = "Reader of field `PFSIZE`"]
302pub type PFSIZE_R = crate::R<u8, PFSIZE_A>;
303impl PFSIZE_R {
304 #[doc = r"Get enumerated values variant"]
305 #[inline(always)]
306 pub fn variant(&self) -> crate::Variant<u8, PFSIZE_A> {
307 use crate::Variant::*;
308 match self.bits {
309 3 => Val(PFSIZE_A::_0011),
310 5 => Val(PFSIZE_A::_0101),
311 7 => Val(PFSIZE_A::_0111),
312 9 => Val(PFSIZE_A::_1001),
313 11 => Val(PFSIZE_A::_1011),
314 13 => Val(PFSIZE_A::_1101),
315 15 => Val(PFSIZE_A::_1111),
316 i => Res(i),
317 }
318 }
319 #[doc = "Checks if the value of the field is `_0011`"]
320 #[inline(always)]
321 pub fn is_0011(&self) -> bool {
322 *self == PFSIZE_A::_0011
323 }
324 #[doc = "Checks if the value of the field is `_0101`"]
325 #[inline(always)]
326 pub fn is_0101(&self) -> bool {
327 *self == PFSIZE_A::_0101
328 }
329 #[doc = "Checks if the value of the field is `_0111`"]
330 #[inline(always)]
331 pub fn is_0111(&self) -> bool {
332 *self == PFSIZE_A::_0111
333 }
334 #[doc = "Checks if the value of the field is `_1001`"]
335 #[inline(always)]
336 pub fn is_1001(&self) -> bool {
337 *self == PFSIZE_A::_1001
338 }
339 #[doc = "Checks if the value of the field is `_1011`"]
340 #[inline(always)]
341 pub fn is_1011(&self) -> bool {
342 *self == PFSIZE_A::_1011
343 }
344 #[doc = "Checks if the value of the field is `_1101`"]
345 #[inline(always)]
346 pub fn is_1101(&self) -> bool {
347 *self == PFSIZE_A::_1101
348 }
349 #[doc = "Checks if the value of the field is `_1111`"]
350 #[inline(always)]
351 pub fn is_1111(&self) -> bool {
352 *self == PFSIZE_A::_1111
353 }
354}
355#[doc = "FlexNVM size\n\nValue on reset: 15"]
356#[derive(Clone, Copy, Debug, PartialEq)]
357#[repr(u8)]
358pub enum NVMSIZE_A {
359 #[doc = "0: 0 KB of FlexNVM"]
360 _0000 = 0,
361 #[doc = "3: 32 KB of FlexNVM"]
362 _0011 = 3,
363 #[doc = "5: 64 KB of FlexNVM"]
364 _0101 = 5,
365 #[doc = "7: 128 KB of FlexNVM"]
366 _0111 = 7,
367 #[doc = "9: 256 KB of FlexNVM"]
368 _1001 = 9,
369 #[doc = "11: 512 KB of FlexNVM"]
370 _1011 = 11,
371 #[doc = "15: 512 KB of FlexNVM"]
372 _1111 = 15,
373}
374impl From<NVMSIZE_A> for u8 {
375 #[inline(always)]
376 fn from(variant: NVMSIZE_A) -> Self {
377 variant as _
378 }
379}
380#[doc = "Reader of field `NVMSIZE`"]
381pub type NVMSIZE_R = crate::R<u8, NVMSIZE_A>;
382impl NVMSIZE_R {
383 #[doc = r"Get enumerated values variant"]
384 #[inline(always)]
385 pub fn variant(&self) -> crate::Variant<u8, NVMSIZE_A> {
386 use crate::Variant::*;
387 match self.bits {
388 0 => Val(NVMSIZE_A::_0000),
389 3 => Val(NVMSIZE_A::_0011),
390 5 => Val(NVMSIZE_A::_0101),
391 7 => Val(NVMSIZE_A::_0111),
392 9 => Val(NVMSIZE_A::_1001),
393 11 => Val(NVMSIZE_A::_1011),
394 15 => Val(NVMSIZE_A::_1111),
395 i => Res(i),
396 }
397 }
398 #[doc = "Checks if the value of the field is `_0000`"]
399 #[inline(always)]
400 pub fn is_0000(&self) -> bool {
401 *self == NVMSIZE_A::_0000
402 }
403 #[doc = "Checks if the value of the field is `_0011`"]
404 #[inline(always)]
405 pub fn is_0011(&self) -> bool {
406 *self == NVMSIZE_A::_0011
407 }
408 #[doc = "Checks if the value of the field is `_0101`"]
409 #[inline(always)]
410 pub fn is_0101(&self) -> bool {
411 *self == NVMSIZE_A::_0101
412 }
413 #[doc = "Checks if the value of the field is `_0111`"]
414 #[inline(always)]
415 pub fn is_0111(&self) -> bool {
416 *self == NVMSIZE_A::_0111
417 }
418 #[doc = "Checks if the value of the field is `_1001`"]
419 #[inline(always)]
420 pub fn is_1001(&self) -> bool {
421 *self == NVMSIZE_A::_1001
422 }
423 #[doc = "Checks if the value of the field is `_1011`"]
424 #[inline(always)]
425 pub fn is_1011(&self) -> bool {
426 *self == NVMSIZE_A::_1011
427 }
428 #[doc = "Checks if the value of the field is `_1111`"]
429 #[inline(always)]
430 pub fn is_1111(&self) -> bool {
431 *self == NVMSIZE_A::_1111
432 }
433}
434impl R {
435 #[doc = "Bit 0 - Flash Disable"]
436 #[inline(always)]
437 pub fn flashdis(&self) -> FLASHDIS_R {
438 FLASHDIS_R::new((self.bits & 0x01) != 0)
439 }
440 #[doc = "Bit 1 - Flash Doze"]
441 #[inline(always)]
442 pub fn flashdoze(&self) -> FLASHDOZE_R {
443 FLASHDOZE_R::new(((self.bits >> 1) & 0x01) != 0)
444 }
445 #[doc = "Bits 8:11 - FlexNVM partition"]
446 #[inline(always)]
447 pub fn depart(&self) -> DEPART_R {
448 DEPART_R::new(((self.bits >> 8) & 0x0f) as u8)
449 }
450 #[doc = "Bits 16:19 - EEPROM size"]
451 #[inline(always)]
452 pub fn eesize(&self) -> EESIZE_R {
453 EESIZE_R::new(((self.bits >> 16) & 0x0f) as u8)
454 }
455 #[doc = "Bits 24:27 - Program flash size"]
456 #[inline(always)]
457 pub fn pfsize(&self) -> PFSIZE_R {
458 PFSIZE_R::new(((self.bits >> 24) & 0x0f) as u8)
459 }
460 #[doc = "Bits 28:31 - FlexNVM size"]
461 #[inline(always)]
462 pub fn nvmsize(&self) -> NVMSIZE_R {
463 NVMSIZE_R::new(((self.bits >> 28) & 0x0f) as u8)
464 }
465}
466impl W {
467 #[doc = "Bit 0 - Flash Disable"]
468 #[inline(always)]
469 pub fn flashdis(&mut self) -> FLASHDIS_W {
470 FLASHDIS_W { w: self }
471 }
472 #[doc = "Bit 1 - Flash Doze"]
473 #[inline(always)]
474 pub fn flashdoze(&mut self) -> FLASHDOZE_W {
475 FLASHDOZE_W { w: self }
476 }
477}