atsam4ls2b_pac/ast/
parameter.rs

1#[doc = "Register `PARAMETER` reader"]
2pub struct R(crate::R<PARAMETER_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PARAMETER_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PARAMETER_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PARAMETER_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `DT` reader - Digital Tuner"]
17pub type DT_R = crate::BitReader<DTSELECT_A>;
18#[doc = "Digital Tuner\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum DTSELECT_A {
21    #[doc = "0: Digital tuner off"]
22    OFF = 0,
23    #[doc = "1: Digital tuner on"]
24    ON = 1,
25}
26impl From<DTSELECT_A> for bool {
27    #[inline(always)]
28    fn from(variant: DTSELECT_A) -> Self {
29        variant as u8 != 0
30    }
31}
32impl DT_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> DTSELECT_A {
36        match self.bits {
37            false => DTSELECT_A::OFF,
38            true => DTSELECT_A::ON,
39        }
40    }
41    #[doc = "Checks if the value of the field is `OFF`"]
42    #[inline(always)]
43    pub fn is_off(&self) -> bool {
44        *self == DTSELECT_A::OFF
45    }
46    #[doc = "Checks if the value of the field is `ON`"]
47    #[inline(always)]
48    pub fn is_on(&self) -> bool {
49        *self == DTSELECT_A::ON
50    }
51}
52#[doc = "Field `DTEXPWA` reader - Digital Tuner Exponent Writeable"]
53pub type DTEXPWA_R = crate::BitReader<DTEXPWASELECT_A>;
54#[doc = "Digital Tuner Exponent Writeable\n\nValue on reset: 0"]
55#[derive(Clone, Copy, Debug, PartialEq, Eq)]
56pub enum DTEXPWASELECT_A {
57    #[doc = "0: Digital tuner exponent is a constant value. Writes to EXP bitfield in DTR will be discarded."]
58    _0 = 0,
59    #[doc = "1: Digital tuner exponent is chosen by writing to EXP bitfield in DTR"]
60    _1 = 1,
61}
62impl From<DTEXPWASELECT_A> for bool {
63    #[inline(always)]
64    fn from(variant: DTEXPWASELECT_A) -> Self {
65        variant as u8 != 0
66    }
67}
68impl DTEXPWA_R {
69    #[doc = "Get enumerated values variant"]
70    #[inline(always)]
71    pub fn variant(&self) -> DTEXPWASELECT_A {
72        match self.bits {
73            false => DTEXPWASELECT_A::_0,
74            true => DTEXPWASELECT_A::_1,
75        }
76    }
77    #[doc = "Checks if the value of the field is `_0`"]
78    #[inline(always)]
79    pub fn is_0(&self) -> bool {
80        *self == DTEXPWASELECT_A::_0
81    }
82    #[doc = "Checks if the value of the field is `_1`"]
83    #[inline(always)]
84    pub fn is_1(&self) -> bool {
85        *self == DTEXPWASELECT_A::_1
86    }
87}
88#[doc = "Field `DTEXPVALUE` reader - Digital Tuner Exponent Value"]
89pub type DTEXPVALUE_R = crate::FieldReader<u8, u8>;
90#[doc = "Field `NUMAR` reader - Number of alarm comparators"]
91pub type NUMAR_R = crate::FieldReader<u8, NUMARSELECT_A>;
92#[doc = "Number of alarm comparators\n\nValue on reset: 0"]
93#[derive(Clone, Copy, Debug, PartialEq, Eq)]
94#[repr(u8)]
95pub enum NUMARSELECT_A {
96    #[doc = "0: No alarm comparators"]
97    ZERO = 0,
98    #[doc = "1: One alarm comparator"]
99    ONE = 1,
100    #[doc = "2: Two alarm comparators"]
101    TWO = 2,
102}
103impl From<NUMARSELECT_A> for u8 {
104    #[inline(always)]
105    fn from(variant: NUMARSELECT_A) -> Self {
106        variant as _
107    }
108}
109impl NUMAR_R {
110    #[doc = "Get enumerated values variant"]
111    #[inline(always)]
112    pub fn variant(&self) -> Option<NUMARSELECT_A> {
113        match self.bits {
114            0 => Some(NUMARSELECT_A::ZERO),
115            1 => Some(NUMARSELECT_A::ONE),
116            2 => Some(NUMARSELECT_A::TWO),
117            _ => None,
118        }
119    }
120    #[doc = "Checks if the value of the field is `ZERO`"]
121    #[inline(always)]
122    pub fn is_zero(&self) -> bool {
123        *self == NUMARSELECT_A::ZERO
124    }
125    #[doc = "Checks if the value of the field is `ONE`"]
126    #[inline(always)]
127    pub fn is_one(&self) -> bool {
128        *self == NUMARSELECT_A::ONE
129    }
130    #[doc = "Checks if the value of the field is `TWO`"]
131    #[inline(always)]
132    pub fn is_two(&self) -> bool {
133        *self == NUMARSELECT_A::TWO
134    }
135}
136#[doc = "Field `NUMPIR` reader - Number of periodic comparators"]
137pub type NUMPIR_R = crate::BitReader<NUMPIRSELECT_A>;
138#[doc = "Number of periodic comparators\n\nValue on reset: 0"]
139#[derive(Clone, Copy, Debug, PartialEq, Eq)]
140pub enum NUMPIRSELECT_A {
141    #[doc = "0: One periodic comparator"]
142    ONE = 0,
143    #[doc = "1: Two periodic comparators"]
144    TWO = 1,
145}
146impl From<NUMPIRSELECT_A> for bool {
147    #[inline(always)]
148    fn from(variant: NUMPIRSELECT_A) -> Self {
149        variant as u8 != 0
150    }
151}
152impl NUMPIR_R {
153    #[doc = "Get enumerated values variant"]
154    #[inline(always)]
155    pub fn variant(&self) -> NUMPIRSELECT_A {
156        match self.bits {
157            false => NUMPIRSELECT_A::ONE,
158            true => NUMPIRSELECT_A::TWO,
159        }
160    }
161    #[doc = "Checks if the value of the field is `ONE`"]
162    #[inline(always)]
163    pub fn is_one(&self) -> bool {
164        *self == NUMPIRSELECT_A::ONE
165    }
166    #[doc = "Checks if the value of the field is `TWO`"]
167    #[inline(always)]
168    pub fn is_two(&self) -> bool {
169        *self == NUMPIRSELECT_A::TWO
170    }
171}
172#[doc = "Field `PIR0WA` reader - Periodic Interval 0 Writeable"]
173pub type PIR0WA_R = crate::BitReader<PIR0WASELECT_A>;
174#[doc = "Periodic Interval 0 Writeable\n\nValue on reset: 0"]
175#[derive(Clone, Copy, Debug, PartialEq, Eq)]
176pub enum PIR0WASELECT_A {
177    #[doc = "0: Periodic alarm prescaler 0 tapping is a constant value. Writes to INSEL bitfield in PIR0 will be discarded."]
178    _0 = 0,
179    #[doc = "1: Periodic alarm prescaler 0 tapping is chosen by writing to INSEL bitfield in PIR0"]
180    _1 = 1,
181}
182impl From<PIR0WASELECT_A> for bool {
183    #[inline(always)]
184    fn from(variant: PIR0WASELECT_A) -> Self {
185        variant as u8 != 0
186    }
187}
188impl PIR0WA_R {
189    #[doc = "Get enumerated values variant"]
190    #[inline(always)]
191    pub fn variant(&self) -> PIR0WASELECT_A {
192        match self.bits {
193            false => PIR0WASELECT_A::_0,
194            true => PIR0WASELECT_A::_1,
195        }
196    }
197    #[doc = "Checks if the value of the field is `_0`"]
198    #[inline(always)]
199    pub fn is_0(&self) -> bool {
200        *self == PIR0WASELECT_A::_0
201    }
202    #[doc = "Checks if the value of the field is `_1`"]
203    #[inline(always)]
204    pub fn is_1(&self) -> bool {
205        *self == PIR0WASELECT_A::_1
206    }
207}
208#[doc = "Field `PIR1WA` reader - Periodic Interval 1 Writeable"]
209pub type PIR1WA_R = crate::BitReader<PIR1WASELECT_A>;
210#[doc = "Periodic Interval 1 Writeable\n\nValue on reset: 0"]
211#[derive(Clone, Copy, Debug, PartialEq, Eq)]
212pub enum PIR1WASELECT_A {
213    #[doc = "0: Writes to PIR1 will be discarded"]
214    _0 = 0,
215    #[doc = "1: PIR1 can be written"]
216    _1 = 1,
217}
218impl From<PIR1WASELECT_A> for bool {
219    #[inline(always)]
220    fn from(variant: PIR1WASELECT_A) -> Self {
221        variant as u8 != 0
222    }
223}
224impl PIR1WA_R {
225    #[doc = "Get enumerated values variant"]
226    #[inline(always)]
227    pub fn variant(&self) -> PIR1WASELECT_A {
228        match self.bits {
229            false => PIR1WASELECT_A::_0,
230            true => PIR1WASELECT_A::_1,
231        }
232    }
233    #[doc = "Checks if the value of the field is `_0`"]
234    #[inline(always)]
235    pub fn is_0(&self) -> bool {
236        *self == PIR1WASELECT_A::_0
237    }
238    #[doc = "Checks if the value of the field is `_1`"]
239    #[inline(always)]
240    pub fn is_1(&self) -> bool {
241        *self == PIR1WASELECT_A::_1
242    }
243}
244#[doc = "Field `PER0VALUE` reader - Periodic Interval 0 Value"]
245pub type PER0VALUE_R = crate::FieldReader<u8, u8>;
246#[doc = "Field `PER1VALUE` reader - Periodic Interval 1 Value"]
247pub type PER1VALUE_R = crate::FieldReader<u8, u8>;
248impl R {
249    #[doc = "Bit 0 - Digital Tuner"]
250    #[inline(always)]
251    pub fn dt(&self) -> DT_R {
252        DT_R::new((self.bits & 1) != 0)
253    }
254    #[doc = "Bit 1 - Digital Tuner Exponent Writeable"]
255    #[inline(always)]
256    pub fn dtexpwa(&self) -> DTEXPWA_R {
257        DTEXPWA_R::new(((self.bits >> 1) & 1) != 0)
258    }
259    #[doc = "Bits 2:6 - Digital Tuner Exponent Value"]
260    #[inline(always)]
261    pub fn dtexpvalue(&self) -> DTEXPVALUE_R {
262        DTEXPVALUE_R::new(((self.bits >> 2) & 0x1f) as u8)
263    }
264    #[doc = "Bits 8:9 - Number of alarm comparators"]
265    #[inline(always)]
266    pub fn numar(&self) -> NUMAR_R {
267        NUMAR_R::new(((self.bits >> 8) & 3) as u8)
268    }
269    #[doc = "Bit 12 - Number of periodic comparators"]
270    #[inline(always)]
271    pub fn numpir(&self) -> NUMPIR_R {
272        NUMPIR_R::new(((self.bits >> 12) & 1) != 0)
273    }
274    #[doc = "Bit 14 - Periodic Interval 0 Writeable"]
275    #[inline(always)]
276    pub fn pir0wa(&self) -> PIR0WA_R {
277        PIR0WA_R::new(((self.bits >> 14) & 1) != 0)
278    }
279    #[doc = "Bit 15 - Periodic Interval 1 Writeable"]
280    #[inline(always)]
281    pub fn pir1wa(&self) -> PIR1WA_R {
282        PIR1WA_R::new(((self.bits >> 15) & 1) != 0)
283    }
284    #[doc = "Bits 16:20 - Periodic Interval 0 Value"]
285    #[inline(always)]
286    pub fn per0value(&self) -> PER0VALUE_R {
287        PER0VALUE_R::new(((self.bits >> 16) & 0x1f) as u8)
288    }
289    #[doc = "Bits 24:28 - Periodic Interval 1 Value"]
290    #[inline(always)]
291    pub fn per1value(&self) -> PER1VALUE_R {
292        PER1VALUE_R::new(((self.bits >> 24) & 0x1f) as u8)
293    }
294}
295#[doc = "Parameter Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [parameter](index.html) module"]
296pub struct PARAMETER_SPEC;
297impl crate::RegisterSpec for PARAMETER_SPEC {
298    type Ux = u32;
299}
300#[doc = "`read()` method returns [parameter::R](R) reader structure"]
301impl crate::Readable for PARAMETER_SPEC {
302    type Reader = R;
303}
304#[doc = "`reset()` method sets PARAMETER to value 0"]
305impl crate::Resettable for PARAMETER_SPEC {
306    const RESET_VALUE: Self::Ux = 0;
307}