nrf52840_pac/rtc0/
evten.rs

1#[doc = "Register `EVTEN` reader"]
2pub struct R(crate::R<EVTEN_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<EVTEN_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<EVTEN_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<EVTEN_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `EVTEN` writer"]
17pub struct W(crate::W<EVTEN_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<EVTEN_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<EVTEN_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<EVTEN_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TICK` reader - Enable or disable event routing for TICK event"]
38pub type TICK_R = crate::BitReader<TICK_A>;
39#[doc = "Enable or disable event routing for TICK event\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum TICK_A {
42    #[doc = "0: Disable"]
43    DISABLED = 0,
44    #[doc = "1: Enable"]
45    ENABLED = 1,
46}
47impl From<TICK_A> for bool {
48    #[inline(always)]
49    fn from(variant: TICK_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl TICK_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> TICK_A {
57        match self.bits {
58            false => TICK_A::DISABLED,
59            true => TICK_A::ENABLED,
60        }
61    }
62    #[doc = "Checks if the value of the field is `DISABLED`"]
63    #[inline(always)]
64    pub fn is_disabled(&self) -> bool {
65        *self == TICK_A::DISABLED
66    }
67    #[doc = "Checks if the value of the field is `ENABLED`"]
68    #[inline(always)]
69    pub fn is_enabled(&self) -> bool {
70        *self == TICK_A::ENABLED
71    }
72}
73#[doc = "Field `TICK` writer - Enable or disable event routing for TICK event"]
74pub type TICK_W<'a, const O: u8> = crate::BitWriter<'a, u32, EVTEN_SPEC, TICK_A, O>;
75impl<'a, const O: u8> TICK_W<'a, O> {
76    #[doc = "Disable"]
77    #[inline(always)]
78    pub fn disabled(self) -> &'a mut W {
79        self.variant(TICK_A::DISABLED)
80    }
81    #[doc = "Enable"]
82    #[inline(always)]
83    pub fn enabled(self) -> &'a mut W {
84        self.variant(TICK_A::ENABLED)
85    }
86}
87#[doc = "Field `OVRFLW` reader - Enable or disable event routing for OVRFLW event"]
88pub type OVRFLW_R = crate::BitReader<OVRFLW_A>;
89#[doc = "Enable or disable event routing for OVRFLW event\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum OVRFLW_A {
92    #[doc = "0: Disable"]
93    DISABLED = 0,
94    #[doc = "1: Enable"]
95    ENABLED = 1,
96}
97impl From<OVRFLW_A> for bool {
98    #[inline(always)]
99    fn from(variant: OVRFLW_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl OVRFLW_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> OVRFLW_A {
107        match self.bits {
108            false => OVRFLW_A::DISABLED,
109            true => OVRFLW_A::ENABLED,
110        }
111    }
112    #[doc = "Checks if the value of the field is `DISABLED`"]
113    #[inline(always)]
114    pub fn is_disabled(&self) -> bool {
115        *self == OVRFLW_A::DISABLED
116    }
117    #[doc = "Checks if the value of the field is `ENABLED`"]
118    #[inline(always)]
119    pub fn is_enabled(&self) -> bool {
120        *self == OVRFLW_A::ENABLED
121    }
122}
123#[doc = "Field `OVRFLW` writer - Enable or disable event routing for OVRFLW event"]
124pub type OVRFLW_W<'a, const O: u8> = crate::BitWriter<'a, u32, EVTEN_SPEC, OVRFLW_A, O>;
125impl<'a, const O: u8> OVRFLW_W<'a, O> {
126    #[doc = "Disable"]
127    #[inline(always)]
128    pub fn disabled(self) -> &'a mut W {
129        self.variant(OVRFLW_A::DISABLED)
130    }
131    #[doc = "Enable"]
132    #[inline(always)]
133    pub fn enabled(self) -> &'a mut W {
134        self.variant(OVRFLW_A::ENABLED)
135    }
136}
137#[doc = "Field `COMPARE0` reader - Enable or disable event routing for COMPARE\\[0\\]
138event"]
139pub type COMPARE0_R = crate::BitReader<COMPARE0_A>;
140#[doc = "Enable or disable event routing for COMPARE\\[0\\]
141event\n\nValue on reset: 0"]
142#[derive(Clone, Copy, Debug, PartialEq)]
143pub enum COMPARE0_A {
144    #[doc = "0: Disable"]
145    DISABLED = 0,
146    #[doc = "1: Enable"]
147    ENABLED = 1,
148}
149impl From<COMPARE0_A> for bool {
150    #[inline(always)]
151    fn from(variant: COMPARE0_A) -> Self {
152        variant as u8 != 0
153    }
154}
155impl COMPARE0_R {
156    #[doc = "Get enumerated values variant"]
157    #[inline(always)]
158    pub fn variant(&self) -> COMPARE0_A {
159        match self.bits {
160            false => COMPARE0_A::DISABLED,
161            true => COMPARE0_A::ENABLED,
162        }
163    }
164    #[doc = "Checks if the value of the field is `DISABLED`"]
165    #[inline(always)]
166    pub fn is_disabled(&self) -> bool {
167        *self == COMPARE0_A::DISABLED
168    }
169    #[doc = "Checks if the value of the field is `ENABLED`"]
170    #[inline(always)]
171    pub fn is_enabled(&self) -> bool {
172        *self == COMPARE0_A::ENABLED
173    }
174}
175#[doc = "Field `COMPARE0` writer - Enable or disable event routing for COMPARE\\[0\\]
176event"]
177pub type COMPARE0_W<'a, const O: u8> = crate::BitWriter<'a, u32, EVTEN_SPEC, COMPARE0_A, O>;
178impl<'a, const O: u8> COMPARE0_W<'a, O> {
179    #[doc = "Disable"]
180    #[inline(always)]
181    pub fn disabled(self) -> &'a mut W {
182        self.variant(COMPARE0_A::DISABLED)
183    }
184    #[doc = "Enable"]
185    #[inline(always)]
186    pub fn enabled(self) -> &'a mut W {
187        self.variant(COMPARE0_A::ENABLED)
188    }
189}
190#[doc = "Field `COMPARE1` reader - Enable or disable event routing for COMPARE\\[1\\]
191event"]
192pub type COMPARE1_R = crate::BitReader<COMPARE1_A>;
193#[doc = "Enable or disable event routing for COMPARE\\[1\\]
194event\n\nValue on reset: 0"]
195#[derive(Clone, Copy, Debug, PartialEq)]
196pub enum COMPARE1_A {
197    #[doc = "0: Disable"]
198    DISABLED = 0,
199    #[doc = "1: Enable"]
200    ENABLED = 1,
201}
202impl From<COMPARE1_A> for bool {
203    #[inline(always)]
204    fn from(variant: COMPARE1_A) -> Self {
205        variant as u8 != 0
206    }
207}
208impl COMPARE1_R {
209    #[doc = "Get enumerated values variant"]
210    #[inline(always)]
211    pub fn variant(&self) -> COMPARE1_A {
212        match self.bits {
213            false => COMPARE1_A::DISABLED,
214            true => COMPARE1_A::ENABLED,
215        }
216    }
217    #[doc = "Checks if the value of the field is `DISABLED`"]
218    #[inline(always)]
219    pub fn is_disabled(&self) -> bool {
220        *self == COMPARE1_A::DISABLED
221    }
222    #[doc = "Checks if the value of the field is `ENABLED`"]
223    #[inline(always)]
224    pub fn is_enabled(&self) -> bool {
225        *self == COMPARE1_A::ENABLED
226    }
227}
228#[doc = "Field `COMPARE1` writer - Enable or disable event routing for COMPARE\\[1\\]
229event"]
230pub type COMPARE1_W<'a, const O: u8> = crate::BitWriter<'a, u32, EVTEN_SPEC, COMPARE1_A, O>;
231impl<'a, const O: u8> COMPARE1_W<'a, O> {
232    #[doc = "Disable"]
233    #[inline(always)]
234    pub fn disabled(self) -> &'a mut W {
235        self.variant(COMPARE1_A::DISABLED)
236    }
237    #[doc = "Enable"]
238    #[inline(always)]
239    pub fn enabled(self) -> &'a mut W {
240        self.variant(COMPARE1_A::ENABLED)
241    }
242}
243#[doc = "Field `COMPARE2` reader - Enable or disable event routing for COMPARE\\[2\\]
244event"]
245pub type COMPARE2_R = crate::BitReader<COMPARE2_A>;
246#[doc = "Enable or disable event routing for COMPARE\\[2\\]
247event\n\nValue on reset: 0"]
248#[derive(Clone, Copy, Debug, PartialEq)]
249pub enum COMPARE2_A {
250    #[doc = "0: Disable"]
251    DISABLED = 0,
252    #[doc = "1: Enable"]
253    ENABLED = 1,
254}
255impl From<COMPARE2_A> for bool {
256    #[inline(always)]
257    fn from(variant: COMPARE2_A) -> Self {
258        variant as u8 != 0
259    }
260}
261impl COMPARE2_R {
262    #[doc = "Get enumerated values variant"]
263    #[inline(always)]
264    pub fn variant(&self) -> COMPARE2_A {
265        match self.bits {
266            false => COMPARE2_A::DISABLED,
267            true => COMPARE2_A::ENABLED,
268        }
269    }
270    #[doc = "Checks if the value of the field is `DISABLED`"]
271    #[inline(always)]
272    pub fn is_disabled(&self) -> bool {
273        *self == COMPARE2_A::DISABLED
274    }
275    #[doc = "Checks if the value of the field is `ENABLED`"]
276    #[inline(always)]
277    pub fn is_enabled(&self) -> bool {
278        *self == COMPARE2_A::ENABLED
279    }
280}
281#[doc = "Field `COMPARE2` writer - Enable or disable event routing for COMPARE\\[2\\]
282event"]
283pub type COMPARE2_W<'a, const O: u8> = crate::BitWriter<'a, u32, EVTEN_SPEC, COMPARE2_A, O>;
284impl<'a, const O: u8> COMPARE2_W<'a, O> {
285    #[doc = "Disable"]
286    #[inline(always)]
287    pub fn disabled(self) -> &'a mut W {
288        self.variant(COMPARE2_A::DISABLED)
289    }
290    #[doc = "Enable"]
291    #[inline(always)]
292    pub fn enabled(self) -> &'a mut W {
293        self.variant(COMPARE2_A::ENABLED)
294    }
295}
296#[doc = "Field `COMPARE3` reader - Enable or disable event routing for COMPARE\\[3\\]
297event"]
298pub type COMPARE3_R = crate::BitReader<COMPARE3_A>;
299#[doc = "Enable or disable event routing for COMPARE\\[3\\]
300event\n\nValue on reset: 0"]
301#[derive(Clone, Copy, Debug, PartialEq)]
302pub enum COMPARE3_A {
303    #[doc = "0: Disable"]
304    DISABLED = 0,
305    #[doc = "1: Enable"]
306    ENABLED = 1,
307}
308impl From<COMPARE3_A> for bool {
309    #[inline(always)]
310    fn from(variant: COMPARE3_A) -> Self {
311        variant as u8 != 0
312    }
313}
314impl COMPARE3_R {
315    #[doc = "Get enumerated values variant"]
316    #[inline(always)]
317    pub fn variant(&self) -> COMPARE3_A {
318        match self.bits {
319            false => COMPARE3_A::DISABLED,
320            true => COMPARE3_A::ENABLED,
321        }
322    }
323    #[doc = "Checks if the value of the field is `DISABLED`"]
324    #[inline(always)]
325    pub fn is_disabled(&self) -> bool {
326        *self == COMPARE3_A::DISABLED
327    }
328    #[doc = "Checks if the value of the field is `ENABLED`"]
329    #[inline(always)]
330    pub fn is_enabled(&self) -> bool {
331        *self == COMPARE3_A::ENABLED
332    }
333}
334#[doc = "Field `COMPARE3` writer - Enable or disable event routing for COMPARE\\[3\\]
335event"]
336pub type COMPARE3_W<'a, const O: u8> = crate::BitWriter<'a, u32, EVTEN_SPEC, COMPARE3_A, O>;
337impl<'a, const O: u8> COMPARE3_W<'a, O> {
338    #[doc = "Disable"]
339    #[inline(always)]
340    pub fn disabled(self) -> &'a mut W {
341        self.variant(COMPARE3_A::DISABLED)
342    }
343    #[doc = "Enable"]
344    #[inline(always)]
345    pub fn enabled(self) -> &'a mut W {
346        self.variant(COMPARE3_A::ENABLED)
347    }
348}
349impl R {
350    #[doc = "Bit 0 - Enable or disable event routing for TICK event"]
351    #[inline(always)]
352    pub fn tick(&self) -> TICK_R {
353        TICK_R::new((self.bits & 1) != 0)
354    }
355    #[doc = "Bit 1 - Enable or disable event routing for OVRFLW event"]
356    #[inline(always)]
357    pub fn ovrflw(&self) -> OVRFLW_R {
358        OVRFLW_R::new(((self.bits >> 1) & 1) != 0)
359    }
360    #[doc = "Bit 16 - Enable or disable event routing for COMPARE\\[0\\]
361event"]
362    #[inline(always)]
363    pub fn compare0(&self) -> COMPARE0_R {
364        COMPARE0_R::new(((self.bits >> 16) & 1) != 0)
365    }
366    #[doc = "Bit 17 - Enable or disable event routing for COMPARE\\[1\\]
367event"]
368    #[inline(always)]
369    pub fn compare1(&self) -> COMPARE1_R {
370        COMPARE1_R::new(((self.bits >> 17) & 1) != 0)
371    }
372    #[doc = "Bit 18 - Enable or disable event routing for COMPARE\\[2\\]
373event"]
374    #[inline(always)]
375    pub fn compare2(&self) -> COMPARE2_R {
376        COMPARE2_R::new(((self.bits >> 18) & 1) != 0)
377    }
378    #[doc = "Bit 19 - Enable or disable event routing for COMPARE\\[3\\]
379event"]
380    #[inline(always)]
381    pub fn compare3(&self) -> COMPARE3_R {
382        COMPARE3_R::new(((self.bits >> 19) & 1) != 0)
383    }
384}
385impl W {
386    #[doc = "Bit 0 - Enable or disable event routing for TICK event"]
387    #[inline(always)]
388    pub fn tick(&mut self) -> TICK_W<0> {
389        TICK_W::new(self)
390    }
391    #[doc = "Bit 1 - Enable or disable event routing for OVRFLW event"]
392    #[inline(always)]
393    pub fn ovrflw(&mut self) -> OVRFLW_W<1> {
394        OVRFLW_W::new(self)
395    }
396    #[doc = "Bit 16 - Enable or disable event routing for COMPARE\\[0\\]
397event"]
398    #[inline(always)]
399    pub fn compare0(&mut self) -> COMPARE0_W<16> {
400        COMPARE0_W::new(self)
401    }
402    #[doc = "Bit 17 - Enable or disable event routing for COMPARE\\[1\\]
403event"]
404    #[inline(always)]
405    pub fn compare1(&mut self) -> COMPARE1_W<17> {
406        COMPARE1_W::new(self)
407    }
408    #[doc = "Bit 18 - Enable or disable event routing for COMPARE\\[2\\]
409event"]
410    #[inline(always)]
411    pub fn compare2(&mut self) -> COMPARE2_W<18> {
412        COMPARE2_W::new(self)
413    }
414    #[doc = "Bit 19 - Enable or disable event routing for COMPARE\\[3\\]
415event"]
416    #[inline(always)]
417    pub fn compare3(&mut self) -> COMPARE3_W<19> {
418        COMPARE3_W::new(self)
419    }
420    #[doc = "Writes raw bits to the register."]
421    #[inline(always)]
422    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
423        self.0.bits(bits);
424        self
425    }
426}
427#[doc = "Enable or disable event routing\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 [evten](index.html) module"]
428pub struct EVTEN_SPEC;
429impl crate::RegisterSpec for EVTEN_SPEC {
430    type Ux = u32;
431}
432#[doc = "`read()` method returns [evten::R](R) reader structure"]
433impl crate::Readable for EVTEN_SPEC {
434    type Reader = R;
435}
436#[doc = "`write(|w| ..)` method takes [evten::W](W) writer structure"]
437impl crate::Writable for EVTEN_SPEC {
438    type Writer = W;
439}
440#[doc = "`reset()` method sets EVTEN to value 0"]
441impl crate::Resettable for EVTEN_SPEC {
442    #[inline(always)]
443    fn reset_value() -> Self::Ux {
444        0
445    }
446}