atsamd11c/nvmctrl/
param.rs

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