atsaml21j18a/nvmctrl/
param.rs1#[doc = "Register `PARAM` reader"]
2pub struct R(crate::R<PARAM_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PARAM_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PARAM_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PARAM_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PARAM` writer"]
17pub struct W(crate::W<PARAM_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PARAM_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<PARAM_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PARAM_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `NVMP` reader - NVM Pages"]
38pub type NVMP_R = crate::FieldReader<u16, u16>;
39#[doc = "Field `PSZ` reader - Page Size"]
40pub type PSZ_R = crate::FieldReader<u8, PSZSELECT_A>;
41#[doc = "Page Size\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43#[repr(u8)]
44pub enum PSZSELECT_A {
45 #[doc = "0: 8 bytes"]
46 _8 = 0,
47 #[doc = "1: 16 bytes"]
48 _16 = 1,
49 #[doc = "2: 32 bytes"]
50 _32 = 2,
51 #[doc = "3: 64 bytes"]
52 _64 = 3,
53 #[doc = "4: 128 bytes"]
54 _128 = 4,
55 #[doc = "5: 256 bytes"]
56 _256 = 5,
57 #[doc = "6: 512 bytes"]
58 _512 = 6,
59 #[doc = "7: 1024 bytes"]
60 _1024 = 7,
61}
62impl From<PSZSELECT_A> for u8 {
63 #[inline(always)]
64 fn from(variant: PSZSELECT_A) -> Self {
65 variant as _
66 }
67}
68impl PSZ_R {
69 #[doc = "Get enumerated values variant"]
70 #[inline(always)]
71 pub fn variant(&self) -> PSZSELECT_A {
72 match self.bits {
73 0 => PSZSELECT_A::_8,
74 1 => PSZSELECT_A::_16,
75 2 => PSZSELECT_A::_32,
76 3 => PSZSELECT_A::_64,
77 4 => PSZSELECT_A::_128,
78 5 => PSZSELECT_A::_256,
79 6 => PSZSELECT_A::_512,
80 7 => PSZSELECT_A::_1024,
81 _ => unreachable!(),
82 }
83 }
84 #[doc = "Checks if the value of the field is `_8`"]
85 #[inline(always)]
86 pub fn is_8(&self) -> bool {
87 *self == PSZSELECT_A::_8
88 }
89 #[doc = "Checks if the value of the field is `_16`"]
90 #[inline(always)]
91 pub fn is_16(&self) -> bool {
92 *self == PSZSELECT_A::_16
93 }
94 #[doc = "Checks if the value of the field is `_32`"]
95 #[inline(always)]
96 pub fn is_32(&self) -> bool {
97 *self == PSZSELECT_A::_32
98 }
99 #[doc = "Checks if the value of the field is `_64`"]
100 #[inline(always)]
101 pub fn is_64(&self) -> bool {
102 *self == PSZSELECT_A::_64
103 }
104 #[doc = "Checks if the value of the field is `_128`"]
105 #[inline(always)]
106 pub fn is_128(&self) -> bool {
107 *self == PSZSELECT_A::_128
108 }
109 #[doc = "Checks if the value of the field is `_256`"]
110 #[inline(always)]
111 pub fn is_256(&self) -> bool {
112 *self == PSZSELECT_A::_256
113 }
114 #[doc = "Checks if the value of the field is `_512`"]
115 #[inline(always)]
116 pub fn is_512(&self) -> bool {
117 *self == PSZSELECT_A::_512
118 }
119 #[doc = "Checks if the value of the field is `_1024`"]
120 #[inline(always)]
121 pub fn is_1024(&self) -> bool {
122 *self == PSZSELECT_A::_1024
123 }
124}
125#[doc = "Field `RWWEEP` reader - RWW EEPROM Pages"]
126pub type RWWEEP_R = crate::FieldReader<u16, u16>;
127impl R {
128 #[doc = "Bits 0:15 - NVM Pages"]
129 #[inline(always)]
130 pub fn nvmp(&self) -> NVMP_R {
131 NVMP_R::new((self.bits & 0xffff) as u16)
132 }
133 #[doc = "Bits 16:18 - Page Size"]
134 #[inline(always)]
135 pub fn psz(&self) -> PSZ_R {
136 PSZ_R::new(((self.bits >> 16) & 7) as u8)
137 }
138 #[doc = "Bits 20:31 - RWW EEPROM Pages"]
139 #[inline(always)]
140 pub fn rwweep(&self) -> RWWEEP_R {
141 RWWEEP_R::new(((self.bits >> 20) & 0x0fff) as u16)
142 }
143}
144impl W {
145 #[doc = "Writes raw bits to the register."]
146 #[inline(always)]
147 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
148 self.0.bits(bits);
149 self
150 }
151}
152#[doc = "NVM Parameter\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [param](index.html) module"]
153pub struct PARAM_SPEC;
154impl crate::RegisterSpec for PARAM_SPEC {
155 type Ux = u32;
156}
157#[doc = "`read()` method returns [param::R](R) reader structure"]
158impl crate::Readable for PARAM_SPEC {
159 type Reader = R;
160}
161#[doc = "`write(|w| ..)` method takes [param::W](W) writer structure"]
162impl crate::Writable for PARAM_SPEC {
163 type Writer = W;
164 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
165 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
166}
167#[doc = "`reset()` method sets PARAM to value 0"]
168impl crate::Resettable for PARAM_SPEC {
169 const RESET_VALUE: Self::Ux = 0;
170}