atsamd51j/nvmctrl/
param.rs
1#[doc = "Register `PARAM` reader"]
2pub type R = crate::R<ParamSpec>;
3#[doc = "Field `NVMP` reader - NVM Pages"]
4pub type NvmpR = crate::FieldReader<u16>;
5#[doc = "Page Size\n\nValue on reset: 6"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Pszselect {
9 #[doc = "0: 8 bytes"]
10 _8 = 0,
11 #[doc = "1: 16 bytes"]
12 _16 = 1,
13 #[doc = "2: 32 bytes"]
14 _32 = 2,
15 #[doc = "3: 64 bytes"]
16 _64 = 3,
17 #[doc = "4: 128 bytes"]
18 _128 = 4,
19 #[doc = "5: 256 bytes"]
20 _256 = 5,
21 #[doc = "6: 512 bytes"]
22 _512 = 6,
23 #[doc = "7: 1024 bytes"]
24 _1024 = 7,
25}
26impl From<Pszselect> for u8 {
27 #[inline(always)]
28 fn from(variant: Pszselect) -> Self {
29 variant as _
30 }
31}
32impl crate::FieldSpec for Pszselect {
33 type Ux = u8;
34}
35impl crate::IsEnum for Pszselect {}
36#[doc = "Field `PSZ` reader - Page Size"]
37pub type PszR = crate::FieldReader<Pszselect>;
38impl PszR {
39 #[doc = "Get enumerated values variant"]
40 #[inline(always)]
41 pub const fn variant(&self) -> Pszselect {
42 match self.bits {
43 0 => Pszselect::_8,
44 1 => Pszselect::_16,
45 2 => Pszselect::_32,
46 3 => Pszselect::_64,
47 4 => Pszselect::_128,
48 5 => Pszselect::_256,
49 6 => Pszselect::_512,
50 7 => Pszselect::_1024,
51 _ => unreachable!(),
52 }
53 }
54 #[doc = "8 bytes"]
55 #[inline(always)]
56 pub fn is_8(&self) -> bool {
57 *self == Pszselect::_8
58 }
59 #[doc = "16 bytes"]
60 #[inline(always)]
61 pub fn is_16(&self) -> bool {
62 *self == Pszselect::_16
63 }
64 #[doc = "32 bytes"]
65 #[inline(always)]
66 pub fn is_32(&self) -> bool {
67 *self == Pszselect::_32
68 }
69 #[doc = "64 bytes"]
70 #[inline(always)]
71 pub fn is_64(&self) -> bool {
72 *self == Pszselect::_64
73 }
74 #[doc = "128 bytes"]
75 #[inline(always)]
76 pub fn is_128(&self) -> bool {
77 *self == Pszselect::_128
78 }
79 #[doc = "256 bytes"]
80 #[inline(always)]
81 pub fn is_256(&self) -> bool {
82 *self == Pszselect::_256
83 }
84 #[doc = "512 bytes"]
85 #[inline(always)]
86 pub fn is_512(&self) -> bool {
87 *self == Pszselect::_512
88 }
89 #[doc = "1024 bytes"]
90 #[inline(always)]
91 pub fn is_1024(&self) -> bool {
92 *self == Pszselect::_1024
93 }
94}
95#[doc = "Field `SEE` reader - SmartEEPROM Supported"]
96pub type SeeR = crate::BitReader;
97impl R {
98 #[doc = "Bits 0:15 - NVM Pages"]
99 #[inline(always)]
100 pub fn nvmp(&self) -> NvmpR {
101 NvmpR::new((self.bits & 0xffff) as u16)
102 }
103 #[doc = "Bits 16:18 - Page Size"]
104 #[inline(always)]
105 pub fn psz(&self) -> PszR {
106 PszR::new(((self.bits >> 16) & 7) as u8)
107 }
108 #[doc = "Bit 31 - SmartEEPROM Supported"]
109 #[inline(always)]
110 pub fn see(&self) -> SeeR {
111 SeeR::new(((self.bits >> 31) & 1) != 0)
112 }
113}
114#[doc = "NVM Parameter\n\nYou can [`read`](crate::Reg::read) this register and get [`param::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
115pub struct ParamSpec;
116impl crate::RegisterSpec for ParamSpec {
117 type Ux = u32;
118}
119#[doc = "`read()` method returns [`param::R`](R) reader structure"]
120impl crate::Readable for ParamSpec {}
121#[doc = "`reset()` method sets PARAM to value 0x0006_0000"]
122impl crate::Resettable for ParamSpec {
123 const RESET_VALUE: u32 = 0x0006_0000;
124}