atsam4ls8a_pac/ast/
wer.rs

1#[doc = "Register `WER` reader"]
2pub struct R(crate::R<WER_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<WER_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<WER_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<WER_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `WER` writer"]
17pub struct W(crate::W<WER_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<WER_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<WER_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<WER_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `OVF` reader - Overflow"]
38pub type OVF_R = crate::BitReader<OVFSELECT_A>;
39#[doc = "Overflow\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum OVFSELECT_A {
42    #[doc = "0: The corresponing event will not wake up the CPU from sleep mode"]
43    _0 = 0,
44    #[doc = "1: The corresponding event will wake up the CPU from sleep mode"]
45    _1 = 1,
46}
47impl From<OVFSELECT_A> for bool {
48    #[inline(always)]
49    fn from(variant: OVFSELECT_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl OVF_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> OVFSELECT_A {
57        match self.bits {
58            false => OVFSELECT_A::_0,
59            true => OVFSELECT_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == OVFSELECT_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == OVFSELECT_A::_1
71    }
72}
73#[doc = "Field `OVF` writer - Overflow"]
74pub type OVF_W<'a, const O: u8> = crate::BitWriter<'a, u32, WER_SPEC, OVFSELECT_A, O>;
75impl<'a, const O: u8> OVF_W<'a, O> {
76    #[doc = "The corresponing event will not wake up the CPU from sleep mode"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(OVFSELECT_A::_0)
80    }
81    #[doc = "The corresponding event will wake up the CPU from sleep mode"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(OVFSELECT_A::_1)
85    }
86}
87#[doc = "Field `ALARM0` reader - Alarm 0"]
88pub type ALARM0_R = crate::BitReader<ALARM0SELECT_A>;
89#[doc = "Alarm 0\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum ALARM0SELECT_A {
92    #[doc = "0: The corresponing event will not wake up the CPU from sleep mode"]
93    _0 = 0,
94    #[doc = "1: The corresponding event will wake up the CPU from sleep mode"]
95    _1 = 1,
96}
97impl From<ALARM0SELECT_A> for bool {
98    #[inline(always)]
99    fn from(variant: ALARM0SELECT_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl ALARM0_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> ALARM0SELECT_A {
107        match self.bits {
108            false => ALARM0SELECT_A::_0,
109            true => ALARM0SELECT_A::_1,
110        }
111    }
112    #[doc = "Checks if the value of the field is `_0`"]
113    #[inline(always)]
114    pub fn is_0(&self) -> bool {
115        *self == ALARM0SELECT_A::_0
116    }
117    #[doc = "Checks if the value of the field is `_1`"]
118    #[inline(always)]
119    pub fn is_1(&self) -> bool {
120        *self == ALARM0SELECT_A::_1
121    }
122}
123#[doc = "Field `ALARM0` writer - Alarm 0"]
124pub type ALARM0_W<'a, const O: u8> = crate::BitWriter<'a, u32, WER_SPEC, ALARM0SELECT_A, O>;
125impl<'a, const O: u8> ALARM0_W<'a, O> {
126    #[doc = "The corresponing event will not wake up the CPU from sleep mode"]
127    #[inline(always)]
128    pub fn _0(self) -> &'a mut W {
129        self.variant(ALARM0SELECT_A::_0)
130    }
131    #[doc = "The corresponding event will wake up the CPU from sleep mode"]
132    #[inline(always)]
133    pub fn _1(self) -> &'a mut W {
134        self.variant(ALARM0SELECT_A::_1)
135    }
136}
137#[doc = "Field `ALARM1` reader - Alarm 1"]
138pub type ALARM1_R = crate::BitReader<ALARM1SELECT_A>;
139#[doc = "Alarm 1\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum ALARM1SELECT_A {
142    #[doc = "0: The corresponing event will not wake up the CPU from sleep mode"]
143    _0 = 0,
144    #[doc = "1: The corresponding event will wake up the CPU from sleep mode"]
145    _1 = 1,
146}
147impl From<ALARM1SELECT_A> for bool {
148    #[inline(always)]
149    fn from(variant: ALARM1SELECT_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl ALARM1_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> ALARM1SELECT_A {
157        match self.bits {
158            false => ALARM1SELECT_A::_0,
159            true => ALARM1SELECT_A::_1,
160        }
161    }
162    #[doc = "Checks if the value of the field is `_0`"]
163    #[inline(always)]
164    pub fn is_0(&self) -> bool {
165        *self == ALARM1SELECT_A::_0
166    }
167    #[doc = "Checks if the value of the field is `_1`"]
168    #[inline(always)]
169    pub fn is_1(&self) -> bool {
170        *self == ALARM1SELECT_A::_1
171    }
172}
173#[doc = "Field `ALARM1` writer - Alarm 1"]
174pub type ALARM1_W<'a, const O: u8> = crate::BitWriter<'a, u32, WER_SPEC, ALARM1SELECT_A, O>;
175impl<'a, const O: u8> ALARM1_W<'a, O> {
176    #[doc = "The corresponing event will not wake up the CPU from sleep mode"]
177    #[inline(always)]
178    pub fn _0(self) -> &'a mut W {
179        self.variant(ALARM1SELECT_A::_0)
180    }
181    #[doc = "The corresponding event will wake up the CPU from sleep mode"]
182    #[inline(always)]
183    pub fn _1(self) -> &'a mut W {
184        self.variant(ALARM1SELECT_A::_1)
185    }
186}
187#[doc = "Field `PER0` reader - Periodic 0"]
188pub type PER0_R = crate::BitReader<PER0SELECT_A>;
189#[doc = "Periodic 0\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum PER0SELECT_A {
192    #[doc = "0: The corresponing event will not wake up the CPU from sleep mode"]
193    _0 = 0,
194    #[doc = "1: The corresponding event will wake up the CPU from sleep mode"]
195    _1 = 1,
196}
197impl From<PER0SELECT_A> for bool {
198    #[inline(always)]
199    fn from(variant: PER0SELECT_A) -> Self {
200        variant as u8 != 0
201    }
202}
203impl PER0_R {
204    #[doc = "Get enumerated values variant"]
205    #[inline(always)]
206    pub fn variant(&self) -> PER0SELECT_A {
207        match self.bits {
208            false => PER0SELECT_A::_0,
209            true => PER0SELECT_A::_1,
210        }
211    }
212    #[doc = "Checks if the value of the field is `_0`"]
213    #[inline(always)]
214    pub fn is_0(&self) -> bool {
215        *self == PER0SELECT_A::_0
216    }
217    #[doc = "Checks if the value of the field is `_1`"]
218    #[inline(always)]
219    pub fn is_1(&self) -> bool {
220        *self == PER0SELECT_A::_1
221    }
222}
223#[doc = "Field `PER0` writer - Periodic 0"]
224pub type PER0_W<'a, const O: u8> = crate::BitWriter<'a, u32, WER_SPEC, PER0SELECT_A, O>;
225impl<'a, const O: u8> PER0_W<'a, O> {
226    #[doc = "The corresponing event will not wake up the CPU from sleep mode"]
227    #[inline(always)]
228    pub fn _0(self) -> &'a mut W {
229        self.variant(PER0SELECT_A::_0)
230    }
231    #[doc = "The corresponding event will wake up the CPU from sleep mode"]
232    #[inline(always)]
233    pub fn _1(self) -> &'a mut W {
234        self.variant(PER0SELECT_A::_1)
235    }
236}
237#[doc = "Field `PER1` reader - Periodic 1"]
238pub type PER1_R = crate::BitReader<PER1SELECT_A>;
239#[doc = "Periodic 1\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq, Eq)]
241pub enum PER1SELECT_A {
242    #[doc = "0: The corresponing event will not wake up the CPU from sleep mode"]
243    _0 = 0,
244    #[doc = "1: The corresponding event will wake up the CPU from sleep mode"]
245    _1 = 1,
246}
247impl From<PER1SELECT_A> for bool {
248    #[inline(always)]
249    fn from(variant: PER1SELECT_A) -> Self {
250        variant as u8 != 0
251    }
252}
253impl PER1_R {
254    #[doc = "Get enumerated values variant"]
255    #[inline(always)]
256    pub fn variant(&self) -> PER1SELECT_A {
257        match self.bits {
258            false => PER1SELECT_A::_0,
259            true => PER1SELECT_A::_1,
260        }
261    }
262    #[doc = "Checks if the value of the field is `_0`"]
263    #[inline(always)]
264    pub fn is_0(&self) -> bool {
265        *self == PER1SELECT_A::_0
266    }
267    #[doc = "Checks if the value of the field is `_1`"]
268    #[inline(always)]
269    pub fn is_1(&self) -> bool {
270        *self == PER1SELECT_A::_1
271    }
272}
273#[doc = "Field `PER1` writer - Periodic 1"]
274pub type PER1_W<'a, const O: u8> = crate::BitWriter<'a, u32, WER_SPEC, PER1SELECT_A, O>;
275impl<'a, const O: u8> PER1_W<'a, O> {
276    #[doc = "The corresponing event will not wake up the CPU from sleep mode"]
277    #[inline(always)]
278    pub fn _0(self) -> &'a mut W {
279        self.variant(PER1SELECT_A::_0)
280    }
281    #[doc = "The corresponding event will wake up the CPU from sleep mode"]
282    #[inline(always)]
283    pub fn _1(self) -> &'a mut W {
284        self.variant(PER1SELECT_A::_1)
285    }
286}
287impl R {
288    #[doc = "Bit 0 - Overflow"]
289    #[inline(always)]
290    pub fn ovf(&self) -> OVF_R {
291        OVF_R::new((self.bits & 1) != 0)
292    }
293    #[doc = "Bit 8 - Alarm 0"]
294    #[inline(always)]
295    pub fn alarm0(&self) -> ALARM0_R {
296        ALARM0_R::new(((self.bits >> 8) & 1) != 0)
297    }
298    #[doc = "Bit 9 - Alarm 1"]
299    #[inline(always)]
300    pub fn alarm1(&self) -> ALARM1_R {
301        ALARM1_R::new(((self.bits >> 9) & 1) != 0)
302    }
303    #[doc = "Bit 16 - Periodic 0"]
304    #[inline(always)]
305    pub fn per0(&self) -> PER0_R {
306        PER0_R::new(((self.bits >> 16) & 1) != 0)
307    }
308    #[doc = "Bit 17 - Periodic 1"]
309    #[inline(always)]
310    pub fn per1(&self) -> PER1_R {
311        PER1_R::new(((self.bits >> 17) & 1) != 0)
312    }
313}
314impl W {
315    #[doc = "Bit 0 - Overflow"]
316    #[inline(always)]
317    #[must_use]
318    pub fn ovf(&mut self) -> OVF_W<0> {
319        OVF_W::new(self)
320    }
321    #[doc = "Bit 8 - Alarm 0"]
322    #[inline(always)]
323    #[must_use]
324    pub fn alarm0(&mut self) -> ALARM0_W<8> {
325        ALARM0_W::new(self)
326    }
327    #[doc = "Bit 9 - Alarm 1"]
328    #[inline(always)]
329    #[must_use]
330    pub fn alarm1(&mut self) -> ALARM1_W<9> {
331        ALARM1_W::new(self)
332    }
333    #[doc = "Bit 16 - Periodic 0"]
334    #[inline(always)]
335    #[must_use]
336    pub fn per0(&mut self) -> PER0_W<16> {
337        PER0_W::new(self)
338    }
339    #[doc = "Bit 17 - Periodic 1"]
340    #[inline(always)]
341    #[must_use]
342    pub fn per1(&mut self) -> PER1_W<17> {
343        PER1_W::new(self)
344    }
345    #[doc = "Writes raw bits to the register."]
346    #[inline(always)]
347    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
348        self.0.bits(bits);
349        self
350    }
351}
352#[doc = "Wake Enable Register\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 [wer](index.html) module"]
353pub struct WER_SPEC;
354impl crate::RegisterSpec for WER_SPEC {
355    type Ux = u32;
356}
357#[doc = "`read()` method returns [wer::R](R) reader structure"]
358impl crate::Readable for WER_SPEC {
359    type Reader = R;
360}
361#[doc = "`write(|w| ..)` method takes [wer::W](W) writer structure"]
362impl crate::Writable for WER_SPEC {
363    type Writer = W;
364    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
365    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
366}
367#[doc = "`reset()` method sets WER to value 0"]
368impl crate::Resettable for WER_SPEC {
369    const RESET_VALUE: Self::Ux = 0;
370}