1#[doc = "Register `PMPROT` reader"]
2pub type R = crate::R<PmprotSpec>;
3#[doc = "Register `PMPROT` writer"]
4pub type W = crate::W<PmprotSpec>;
5#[doc = "Low-Power Mode\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Lpmode {
10 #[doc = "0: Not allowed"]
11 Disabled = 0,
12 #[doc = "1: Allowed"]
13 En = 1,
14 #[doc = "2: Allowed"]
15 En1 = 2,
16 #[doc = "3: Allowed"]
17 En2 = 3,
18 #[doc = "4: Allowed"]
19 En3 = 4,
20 #[doc = "5: Allowed"]
21 En4 = 5,
22 #[doc = "6: Allowed"]
23 En5 = 6,
24 #[doc = "7: Allowed"]
25 En6 = 7,
26 #[doc = "8: Allowed"]
27 En7 = 8,
28 #[doc = "9: Allowed"]
29 En8 = 9,
30 #[doc = "10: Allowed"]
31 En9 = 10,
32 #[doc = "11: Allowed"]
33 En10 = 11,
34 #[doc = "12: Allowed"]
35 En11 = 12,
36 #[doc = "13: Allowed"]
37 En12 = 13,
38 #[doc = "14: Allowed"]
39 En13 = 14,
40 #[doc = "15: Allowed"]
41 En14 = 15,
42}
43impl From<Lpmode> for u8 {
44 #[inline(always)]
45 fn from(variant: Lpmode) -> Self {
46 variant as _
47 }
48}
49impl crate::FieldSpec for Lpmode {
50 type Ux = u8;
51}
52impl crate::IsEnum for Lpmode {}
53#[doc = "Field `LPMODE` reader - Low-Power Mode"]
54pub type LpmodeR = crate::FieldReader<Lpmode>;
55impl LpmodeR {
56 #[doc = "Get enumerated values variant"]
57 #[inline(always)]
58 pub const fn variant(&self) -> Lpmode {
59 match self.bits {
60 0 => Lpmode::Disabled,
61 1 => Lpmode::En,
62 2 => Lpmode::En1,
63 3 => Lpmode::En2,
64 4 => Lpmode::En3,
65 5 => Lpmode::En4,
66 6 => Lpmode::En5,
67 7 => Lpmode::En6,
68 8 => Lpmode::En7,
69 9 => Lpmode::En8,
70 10 => Lpmode::En9,
71 11 => Lpmode::En10,
72 12 => Lpmode::En11,
73 13 => Lpmode::En12,
74 14 => Lpmode::En13,
75 15 => Lpmode::En14,
76 _ => unreachable!(),
77 }
78 }
79 #[doc = "Not allowed"]
80 #[inline(always)]
81 pub fn is_disabled(&self) -> bool {
82 *self == Lpmode::Disabled
83 }
84 #[doc = "Allowed"]
85 #[inline(always)]
86 pub fn is_en(&self) -> bool {
87 *self == Lpmode::En
88 }
89 #[doc = "Allowed"]
90 #[inline(always)]
91 pub fn is_en1(&self) -> bool {
92 *self == Lpmode::En1
93 }
94 #[doc = "Allowed"]
95 #[inline(always)]
96 pub fn is_en2(&self) -> bool {
97 *self == Lpmode::En2
98 }
99 #[doc = "Allowed"]
100 #[inline(always)]
101 pub fn is_en3(&self) -> bool {
102 *self == Lpmode::En3
103 }
104 #[doc = "Allowed"]
105 #[inline(always)]
106 pub fn is_en4(&self) -> bool {
107 *self == Lpmode::En4
108 }
109 #[doc = "Allowed"]
110 #[inline(always)]
111 pub fn is_en5(&self) -> bool {
112 *self == Lpmode::En5
113 }
114 #[doc = "Allowed"]
115 #[inline(always)]
116 pub fn is_en6(&self) -> bool {
117 *self == Lpmode::En6
118 }
119 #[doc = "Allowed"]
120 #[inline(always)]
121 pub fn is_en7(&self) -> bool {
122 *self == Lpmode::En7
123 }
124 #[doc = "Allowed"]
125 #[inline(always)]
126 pub fn is_en8(&self) -> bool {
127 *self == Lpmode::En8
128 }
129 #[doc = "Allowed"]
130 #[inline(always)]
131 pub fn is_en9(&self) -> bool {
132 *self == Lpmode::En9
133 }
134 #[doc = "Allowed"]
135 #[inline(always)]
136 pub fn is_en10(&self) -> bool {
137 *self == Lpmode::En10
138 }
139 #[doc = "Allowed"]
140 #[inline(always)]
141 pub fn is_en11(&self) -> bool {
142 *self == Lpmode::En11
143 }
144 #[doc = "Allowed"]
145 #[inline(always)]
146 pub fn is_en12(&self) -> bool {
147 *self == Lpmode::En12
148 }
149 #[doc = "Allowed"]
150 #[inline(always)]
151 pub fn is_en13(&self) -> bool {
152 *self == Lpmode::En13
153 }
154 #[doc = "Allowed"]
155 #[inline(always)]
156 pub fn is_en14(&self) -> bool {
157 *self == Lpmode::En14
158 }
159}
160#[doc = "Field `LPMODE` writer - Low-Power Mode"]
161pub type LpmodeW<'a, REG> = crate::FieldWriter<'a, REG, 4, Lpmode, crate::Safe>;
162impl<'a, REG> LpmodeW<'a, REG>
163where
164 REG: crate::Writable + crate::RegisterSpec,
165 REG::Ux: From<u8>,
166{
167 #[doc = "Not allowed"]
168 #[inline(always)]
169 pub fn disabled(self) -> &'a mut crate::W<REG> {
170 self.variant(Lpmode::Disabled)
171 }
172 #[doc = "Allowed"]
173 #[inline(always)]
174 pub fn en(self) -> &'a mut crate::W<REG> {
175 self.variant(Lpmode::En)
176 }
177 #[doc = "Allowed"]
178 #[inline(always)]
179 pub fn en1(self) -> &'a mut crate::W<REG> {
180 self.variant(Lpmode::En1)
181 }
182 #[doc = "Allowed"]
183 #[inline(always)]
184 pub fn en2(self) -> &'a mut crate::W<REG> {
185 self.variant(Lpmode::En2)
186 }
187 #[doc = "Allowed"]
188 #[inline(always)]
189 pub fn en3(self) -> &'a mut crate::W<REG> {
190 self.variant(Lpmode::En3)
191 }
192 #[doc = "Allowed"]
193 #[inline(always)]
194 pub fn en4(self) -> &'a mut crate::W<REG> {
195 self.variant(Lpmode::En4)
196 }
197 #[doc = "Allowed"]
198 #[inline(always)]
199 pub fn en5(self) -> &'a mut crate::W<REG> {
200 self.variant(Lpmode::En5)
201 }
202 #[doc = "Allowed"]
203 #[inline(always)]
204 pub fn en6(self) -> &'a mut crate::W<REG> {
205 self.variant(Lpmode::En6)
206 }
207 #[doc = "Allowed"]
208 #[inline(always)]
209 pub fn en7(self) -> &'a mut crate::W<REG> {
210 self.variant(Lpmode::En7)
211 }
212 #[doc = "Allowed"]
213 #[inline(always)]
214 pub fn en8(self) -> &'a mut crate::W<REG> {
215 self.variant(Lpmode::En8)
216 }
217 #[doc = "Allowed"]
218 #[inline(always)]
219 pub fn en9(self) -> &'a mut crate::W<REG> {
220 self.variant(Lpmode::En9)
221 }
222 #[doc = "Allowed"]
223 #[inline(always)]
224 pub fn en10(self) -> &'a mut crate::W<REG> {
225 self.variant(Lpmode::En10)
226 }
227 #[doc = "Allowed"]
228 #[inline(always)]
229 pub fn en11(self) -> &'a mut crate::W<REG> {
230 self.variant(Lpmode::En11)
231 }
232 #[doc = "Allowed"]
233 #[inline(always)]
234 pub fn en12(self) -> &'a mut crate::W<REG> {
235 self.variant(Lpmode::En12)
236 }
237 #[doc = "Allowed"]
238 #[inline(always)]
239 pub fn en13(self) -> &'a mut crate::W<REG> {
240 self.variant(Lpmode::En13)
241 }
242 #[doc = "Allowed"]
243 #[inline(always)]
244 pub fn en14(self) -> &'a mut crate::W<REG> {
245 self.variant(Lpmode::En14)
246 }
247}
248#[doc = "Lock Register\n\nValue on reset: 0"]
249#[cfg_attr(feature = "defmt", derive(defmt::Format))]
250#[derive(Clone, Copy, Debug, PartialEq, Eq)]
251pub enum Lock {
252 #[doc = "0: Allowed"]
253 Disabled = 0,
254 #[doc = "1: Blocked"]
255 Enabled = 1,
256}
257impl From<Lock> for bool {
258 #[inline(always)]
259 fn from(variant: Lock) -> Self {
260 variant as u8 != 0
261 }
262}
263#[doc = "Field `LOCK` reader - Lock Register"]
264pub type LockR = crate::BitReader<Lock>;
265impl LockR {
266 #[doc = "Get enumerated values variant"]
267 #[inline(always)]
268 pub const fn variant(&self) -> Lock {
269 match self.bits {
270 false => Lock::Disabled,
271 true => Lock::Enabled,
272 }
273 }
274 #[doc = "Allowed"]
275 #[inline(always)]
276 pub fn is_disabled(&self) -> bool {
277 *self == Lock::Disabled
278 }
279 #[doc = "Blocked"]
280 #[inline(always)]
281 pub fn is_enabled(&self) -> bool {
282 *self == Lock::Enabled
283 }
284}
285#[doc = "Field `LOCK` writer - Lock Register"]
286pub type LockW<'a, REG> = crate::BitWriter<'a, REG, Lock>;
287impl<'a, REG> LockW<'a, REG>
288where
289 REG: crate::Writable + crate::RegisterSpec,
290{
291 #[doc = "Allowed"]
292 #[inline(always)]
293 pub fn disabled(self) -> &'a mut crate::W<REG> {
294 self.variant(Lock::Disabled)
295 }
296 #[doc = "Blocked"]
297 #[inline(always)]
298 pub fn enabled(self) -> &'a mut crate::W<REG> {
299 self.variant(Lock::Enabled)
300 }
301}
302impl R {
303 #[doc = "Bits 0:3 - Low-Power Mode"]
304 #[inline(always)]
305 pub fn lpmode(&self) -> LpmodeR {
306 LpmodeR::new((self.bits & 0x0f) as u8)
307 }
308 #[doc = "Bit 31 - Lock Register"]
309 #[inline(always)]
310 pub fn lock(&self) -> LockR {
311 LockR::new(((self.bits >> 31) & 1) != 0)
312 }
313}
314#[cfg(feature = "debug")]
315impl core::fmt::Debug for R {
316 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
317 f.debug_struct("PMPROT")
318 .field("lpmode", &self.lpmode())
319 .field("lock", &self.lock())
320 .finish()
321 }
322}
323impl W {
324 #[doc = "Bits 0:3 - Low-Power Mode"]
325 #[inline(always)]
326 pub fn lpmode(&mut self) -> LpmodeW<'_, PmprotSpec> {
327 LpmodeW::new(self, 0)
328 }
329 #[doc = "Bit 31 - Lock Register"]
330 #[inline(always)]
331 pub fn lock(&mut self) -> LockW<'_, PmprotSpec> {
332 LockW::new(self, 31)
333 }
334}
335#[doc = "Power Mode Protection\n\nYou can [`read`](crate::Reg::read) this register and get [`pmprot::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pmprot::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
336pub struct PmprotSpec;
337impl crate::RegisterSpec for PmprotSpec {
338 type Ux = u32;
339}
340#[doc = "`read()` method returns [`pmprot::R`](R) reader structure"]
341impl crate::Readable for PmprotSpec {}
342#[doc = "`write(|w| ..)` method takes [`pmprot::W`](W) writer structure"]
343impl crate::Writable for PmprotSpec {
344 type Safety = crate::Unsafe;
345}
346#[doc = "`reset()` method sets PMPROT to value 0"]
347impl crate::Resettable for PmprotSpec {}