nrf52840_pac/pwm0/
inten.rs

1#[doc = "Register `INTEN` reader"]
2pub struct R(crate::R<INTEN_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<INTEN_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<INTEN_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<INTEN_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `INTEN` writer"]
17pub struct W(crate::W<INTEN_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<INTEN_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<INTEN_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<INTEN_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `STOPPED` reader - Enable or disable interrupt for STOPPED event"]
38pub type STOPPED_R = crate::BitReader<STOPPED_A>;
39#[doc = "Enable or disable interrupt for STOPPED event\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum STOPPED_A {
42    #[doc = "0: Disable"]
43    DISABLED = 0,
44    #[doc = "1: Enable"]
45    ENABLED = 1,
46}
47impl From<STOPPED_A> for bool {
48    #[inline(always)]
49    fn from(variant: STOPPED_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl STOPPED_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> STOPPED_A {
57        match self.bits {
58            false => STOPPED_A::DISABLED,
59            true => STOPPED_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 == STOPPED_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 == STOPPED_A::ENABLED
71    }
72}
73#[doc = "Field `STOPPED` writer - Enable or disable interrupt for STOPPED event"]
74pub type STOPPED_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTEN_SPEC, STOPPED_A, O>;
75impl<'a, const O: u8> STOPPED_W<'a, O> {
76    #[doc = "Disable"]
77    #[inline(always)]
78    pub fn disabled(self) -> &'a mut W {
79        self.variant(STOPPED_A::DISABLED)
80    }
81    #[doc = "Enable"]
82    #[inline(always)]
83    pub fn enabled(self) -> &'a mut W {
84        self.variant(STOPPED_A::ENABLED)
85    }
86}
87#[doc = "Field `SEQSTARTED0` reader - Enable or disable interrupt for SEQSTARTED\\[0\\]
88event"]
89pub type SEQSTARTED0_R = crate::BitReader<SEQSTARTED0_A>;
90#[doc = "Enable or disable interrupt for SEQSTARTED\\[0\\]
91event\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq)]
93pub enum SEQSTARTED0_A {
94    #[doc = "0: Disable"]
95    DISABLED = 0,
96    #[doc = "1: Enable"]
97    ENABLED = 1,
98}
99impl From<SEQSTARTED0_A> for bool {
100    #[inline(always)]
101    fn from(variant: SEQSTARTED0_A) -> Self {
102        variant as u8 != 0
103    }
104}
105impl SEQSTARTED0_R {
106    #[doc = "Get enumerated values variant"]
107    #[inline(always)]
108    pub fn variant(&self) -> SEQSTARTED0_A {
109        match self.bits {
110            false => SEQSTARTED0_A::DISABLED,
111            true => SEQSTARTED0_A::ENABLED,
112        }
113    }
114    #[doc = "Checks if the value of the field is `DISABLED`"]
115    #[inline(always)]
116    pub fn is_disabled(&self) -> bool {
117        *self == SEQSTARTED0_A::DISABLED
118    }
119    #[doc = "Checks if the value of the field is `ENABLED`"]
120    #[inline(always)]
121    pub fn is_enabled(&self) -> bool {
122        *self == SEQSTARTED0_A::ENABLED
123    }
124}
125#[doc = "Field `SEQSTARTED0` writer - Enable or disable interrupt for SEQSTARTED\\[0\\]
126event"]
127pub type SEQSTARTED0_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTEN_SPEC, SEQSTARTED0_A, O>;
128impl<'a, const O: u8> SEQSTARTED0_W<'a, O> {
129    #[doc = "Disable"]
130    #[inline(always)]
131    pub fn disabled(self) -> &'a mut W {
132        self.variant(SEQSTARTED0_A::DISABLED)
133    }
134    #[doc = "Enable"]
135    #[inline(always)]
136    pub fn enabled(self) -> &'a mut W {
137        self.variant(SEQSTARTED0_A::ENABLED)
138    }
139}
140#[doc = "Field `SEQSTARTED1` reader - Enable or disable interrupt for SEQSTARTED\\[1\\]
141event"]
142pub type SEQSTARTED1_R = crate::BitReader<SEQSTARTED1_A>;
143#[doc = "Enable or disable interrupt for SEQSTARTED\\[1\\]
144event\n\nValue on reset: 0"]
145#[derive(Clone, Copy, Debug, PartialEq)]
146pub enum SEQSTARTED1_A {
147    #[doc = "0: Disable"]
148    DISABLED = 0,
149    #[doc = "1: Enable"]
150    ENABLED = 1,
151}
152impl From<SEQSTARTED1_A> for bool {
153    #[inline(always)]
154    fn from(variant: SEQSTARTED1_A) -> Self {
155        variant as u8 != 0
156    }
157}
158impl SEQSTARTED1_R {
159    #[doc = "Get enumerated values variant"]
160    #[inline(always)]
161    pub fn variant(&self) -> SEQSTARTED1_A {
162        match self.bits {
163            false => SEQSTARTED1_A::DISABLED,
164            true => SEQSTARTED1_A::ENABLED,
165        }
166    }
167    #[doc = "Checks if the value of the field is `DISABLED`"]
168    #[inline(always)]
169    pub fn is_disabled(&self) -> bool {
170        *self == SEQSTARTED1_A::DISABLED
171    }
172    #[doc = "Checks if the value of the field is `ENABLED`"]
173    #[inline(always)]
174    pub fn is_enabled(&self) -> bool {
175        *self == SEQSTARTED1_A::ENABLED
176    }
177}
178#[doc = "Field `SEQSTARTED1` writer - Enable or disable interrupt for SEQSTARTED\\[1\\]
179event"]
180pub type SEQSTARTED1_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTEN_SPEC, SEQSTARTED1_A, O>;
181impl<'a, const O: u8> SEQSTARTED1_W<'a, O> {
182    #[doc = "Disable"]
183    #[inline(always)]
184    pub fn disabled(self) -> &'a mut W {
185        self.variant(SEQSTARTED1_A::DISABLED)
186    }
187    #[doc = "Enable"]
188    #[inline(always)]
189    pub fn enabled(self) -> &'a mut W {
190        self.variant(SEQSTARTED1_A::ENABLED)
191    }
192}
193#[doc = "Field `SEQEND0` reader - Enable or disable interrupt for SEQEND\\[0\\]
194event"]
195pub type SEQEND0_R = crate::BitReader<SEQEND0_A>;
196#[doc = "Enable or disable interrupt for SEQEND\\[0\\]
197event\n\nValue on reset: 0"]
198#[derive(Clone, Copy, Debug, PartialEq)]
199pub enum SEQEND0_A {
200    #[doc = "0: Disable"]
201    DISABLED = 0,
202    #[doc = "1: Enable"]
203    ENABLED = 1,
204}
205impl From<SEQEND0_A> for bool {
206    #[inline(always)]
207    fn from(variant: SEQEND0_A) -> Self {
208        variant as u8 != 0
209    }
210}
211impl SEQEND0_R {
212    #[doc = "Get enumerated values variant"]
213    #[inline(always)]
214    pub fn variant(&self) -> SEQEND0_A {
215        match self.bits {
216            false => SEQEND0_A::DISABLED,
217            true => SEQEND0_A::ENABLED,
218        }
219    }
220    #[doc = "Checks if the value of the field is `DISABLED`"]
221    #[inline(always)]
222    pub fn is_disabled(&self) -> bool {
223        *self == SEQEND0_A::DISABLED
224    }
225    #[doc = "Checks if the value of the field is `ENABLED`"]
226    #[inline(always)]
227    pub fn is_enabled(&self) -> bool {
228        *self == SEQEND0_A::ENABLED
229    }
230}
231#[doc = "Field `SEQEND0` writer - Enable or disable interrupt for SEQEND\\[0\\]
232event"]
233pub type SEQEND0_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTEN_SPEC, SEQEND0_A, O>;
234impl<'a, const O: u8> SEQEND0_W<'a, O> {
235    #[doc = "Disable"]
236    #[inline(always)]
237    pub fn disabled(self) -> &'a mut W {
238        self.variant(SEQEND0_A::DISABLED)
239    }
240    #[doc = "Enable"]
241    #[inline(always)]
242    pub fn enabled(self) -> &'a mut W {
243        self.variant(SEQEND0_A::ENABLED)
244    }
245}
246#[doc = "Field `SEQEND1` reader - Enable or disable interrupt for SEQEND\\[1\\]
247event"]
248pub type SEQEND1_R = crate::BitReader<SEQEND1_A>;
249#[doc = "Enable or disable interrupt for SEQEND\\[1\\]
250event\n\nValue on reset: 0"]
251#[derive(Clone, Copy, Debug, PartialEq)]
252pub enum SEQEND1_A {
253    #[doc = "0: Disable"]
254    DISABLED = 0,
255    #[doc = "1: Enable"]
256    ENABLED = 1,
257}
258impl From<SEQEND1_A> for bool {
259    #[inline(always)]
260    fn from(variant: SEQEND1_A) -> Self {
261        variant as u8 != 0
262    }
263}
264impl SEQEND1_R {
265    #[doc = "Get enumerated values variant"]
266    #[inline(always)]
267    pub fn variant(&self) -> SEQEND1_A {
268        match self.bits {
269            false => SEQEND1_A::DISABLED,
270            true => SEQEND1_A::ENABLED,
271        }
272    }
273    #[doc = "Checks if the value of the field is `DISABLED`"]
274    #[inline(always)]
275    pub fn is_disabled(&self) -> bool {
276        *self == SEQEND1_A::DISABLED
277    }
278    #[doc = "Checks if the value of the field is `ENABLED`"]
279    #[inline(always)]
280    pub fn is_enabled(&self) -> bool {
281        *self == SEQEND1_A::ENABLED
282    }
283}
284#[doc = "Field `SEQEND1` writer - Enable or disable interrupt for SEQEND\\[1\\]
285event"]
286pub type SEQEND1_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTEN_SPEC, SEQEND1_A, O>;
287impl<'a, const O: u8> SEQEND1_W<'a, O> {
288    #[doc = "Disable"]
289    #[inline(always)]
290    pub fn disabled(self) -> &'a mut W {
291        self.variant(SEQEND1_A::DISABLED)
292    }
293    #[doc = "Enable"]
294    #[inline(always)]
295    pub fn enabled(self) -> &'a mut W {
296        self.variant(SEQEND1_A::ENABLED)
297    }
298}
299#[doc = "Field `PWMPERIODEND` reader - Enable or disable interrupt for PWMPERIODEND event"]
300pub type PWMPERIODEND_R = crate::BitReader<PWMPERIODEND_A>;
301#[doc = "Enable or disable interrupt for PWMPERIODEND event\n\nValue on reset: 0"]
302#[derive(Clone, Copy, Debug, PartialEq)]
303pub enum PWMPERIODEND_A {
304    #[doc = "0: Disable"]
305    DISABLED = 0,
306    #[doc = "1: Enable"]
307    ENABLED = 1,
308}
309impl From<PWMPERIODEND_A> for bool {
310    #[inline(always)]
311    fn from(variant: PWMPERIODEND_A) -> Self {
312        variant as u8 != 0
313    }
314}
315impl PWMPERIODEND_R {
316    #[doc = "Get enumerated values variant"]
317    #[inline(always)]
318    pub fn variant(&self) -> PWMPERIODEND_A {
319        match self.bits {
320            false => PWMPERIODEND_A::DISABLED,
321            true => PWMPERIODEND_A::ENABLED,
322        }
323    }
324    #[doc = "Checks if the value of the field is `DISABLED`"]
325    #[inline(always)]
326    pub fn is_disabled(&self) -> bool {
327        *self == PWMPERIODEND_A::DISABLED
328    }
329    #[doc = "Checks if the value of the field is `ENABLED`"]
330    #[inline(always)]
331    pub fn is_enabled(&self) -> bool {
332        *self == PWMPERIODEND_A::ENABLED
333    }
334}
335#[doc = "Field `PWMPERIODEND` writer - Enable or disable interrupt for PWMPERIODEND event"]
336pub type PWMPERIODEND_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTEN_SPEC, PWMPERIODEND_A, O>;
337impl<'a, const O: u8> PWMPERIODEND_W<'a, O> {
338    #[doc = "Disable"]
339    #[inline(always)]
340    pub fn disabled(self) -> &'a mut W {
341        self.variant(PWMPERIODEND_A::DISABLED)
342    }
343    #[doc = "Enable"]
344    #[inline(always)]
345    pub fn enabled(self) -> &'a mut W {
346        self.variant(PWMPERIODEND_A::ENABLED)
347    }
348}
349#[doc = "Field `LOOPSDONE` reader - Enable or disable interrupt for LOOPSDONE event"]
350pub type LOOPSDONE_R = crate::BitReader<LOOPSDONE_A>;
351#[doc = "Enable or disable interrupt for LOOPSDONE event\n\nValue on reset: 0"]
352#[derive(Clone, Copy, Debug, PartialEq)]
353pub enum LOOPSDONE_A {
354    #[doc = "0: Disable"]
355    DISABLED = 0,
356    #[doc = "1: Enable"]
357    ENABLED = 1,
358}
359impl From<LOOPSDONE_A> for bool {
360    #[inline(always)]
361    fn from(variant: LOOPSDONE_A) -> Self {
362        variant as u8 != 0
363    }
364}
365impl LOOPSDONE_R {
366    #[doc = "Get enumerated values variant"]
367    #[inline(always)]
368    pub fn variant(&self) -> LOOPSDONE_A {
369        match self.bits {
370            false => LOOPSDONE_A::DISABLED,
371            true => LOOPSDONE_A::ENABLED,
372        }
373    }
374    #[doc = "Checks if the value of the field is `DISABLED`"]
375    #[inline(always)]
376    pub fn is_disabled(&self) -> bool {
377        *self == LOOPSDONE_A::DISABLED
378    }
379    #[doc = "Checks if the value of the field is `ENABLED`"]
380    #[inline(always)]
381    pub fn is_enabled(&self) -> bool {
382        *self == LOOPSDONE_A::ENABLED
383    }
384}
385#[doc = "Field `LOOPSDONE` writer - Enable or disable interrupt for LOOPSDONE event"]
386pub type LOOPSDONE_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTEN_SPEC, LOOPSDONE_A, O>;
387impl<'a, const O: u8> LOOPSDONE_W<'a, O> {
388    #[doc = "Disable"]
389    #[inline(always)]
390    pub fn disabled(self) -> &'a mut W {
391        self.variant(LOOPSDONE_A::DISABLED)
392    }
393    #[doc = "Enable"]
394    #[inline(always)]
395    pub fn enabled(self) -> &'a mut W {
396        self.variant(LOOPSDONE_A::ENABLED)
397    }
398}
399impl R {
400    #[doc = "Bit 1 - Enable or disable interrupt for STOPPED event"]
401    #[inline(always)]
402    pub fn stopped(&self) -> STOPPED_R {
403        STOPPED_R::new(((self.bits >> 1) & 1) != 0)
404    }
405    #[doc = "Bit 2 - Enable or disable interrupt for SEQSTARTED\\[0\\]
406event"]
407    #[inline(always)]
408    pub fn seqstarted0(&self) -> SEQSTARTED0_R {
409        SEQSTARTED0_R::new(((self.bits >> 2) & 1) != 0)
410    }
411    #[doc = "Bit 3 - Enable or disable interrupt for SEQSTARTED\\[1\\]
412event"]
413    #[inline(always)]
414    pub fn seqstarted1(&self) -> SEQSTARTED1_R {
415        SEQSTARTED1_R::new(((self.bits >> 3) & 1) != 0)
416    }
417    #[doc = "Bit 4 - Enable or disable interrupt for SEQEND\\[0\\]
418event"]
419    #[inline(always)]
420    pub fn seqend0(&self) -> SEQEND0_R {
421        SEQEND0_R::new(((self.bits >> 4) & 1) != 0)
422    }
423    #[doc = "Bit 5 - Enable or disable interrupt for SEQEND\\[1\\]
424event"]
425    #[inline(always)]
426    pub fn seqend1(&self) -> SEQEND1_R {
427        SEQEND1_R::new(((self.bits >> 5) & 1) != 0)
428    }
429    #[doc = "Bit 6 - Enable or disable interrupt for PWMPERIODEND event"]
430    #[inline(always)]
431    pub fn pwmperiodend(&self) -> PWMPERIODEND_R {
432        PWMPERIODEND_R::new(((self.bits >> 6) & 1) != 0)
433    }
434    #[doc = "Bit 7 - Enable or disable interrupt for LOOPSDONE event"]
435    #[inline(always)]
436    pub fn loopsdone(&self) -> LOOPSDONE_R {
437        LOOPSDONE_R::new(((self.bits >> 7) & 1) != 0)
438    }
439}
440impl W {
441    #[doc = "Bit 1 - Enable or disable interrupt for STOPPED event"]
442    #[inline(always)]
443    pub fn stopped(&mut self) -> STOPPED_W<1> {
444        STOPPED_W::new(self)
445    }
446    #[doc = "Bit 2 - Enable or disable interrupt for SEQSTARTED\\[0\\]
447event"]
448    #[inline(always)]
449    pub fn seqstarted0(&mut self) -> SEQSTARTED0_W<2> {
450        SEQSTARTED0_W::new(self)
451    }
452    #[doc = "Bit 3 - Enable or disable interrupt for SEQSTARTED\\[1\\]
453event"]
454    #[inline(always)]
455    pub fn seqstarted1(&mut self) -> SEQSTARTED1_W<3> {
456        SEQSTARTED1_W::new(self)
457    }
458    #[doc = "Bit 4 - Enable or disable interrupt for SEQEND\\[0\\]
459event"]
460    #[inline(always)]
461    pub fn seqend0(&mut self) -> SEQEND0_W<4> {
462        SEQEND0_W::new(self)
463    }
464    #[doc = "Bit 5 - Enable or disable interrupt for SEQEND\\[1\\]
465event"]
466    #[inline(always)]
467    pub fn seqend1(&mut self) -> SEQEND1_W<5> {
468        SEQEND1_W::new(self)
469    }
470    #[doc = "Bit 6 - Enable or disable interrupt for PWMPERIODEND event"]
471    #[inline(always)]
472    pub fn pwmperiodend(&mut self) -> PWMPERIODEND_W<6> {
473        PWMPERIODEND_W::new(self)
474    }
475    #[doc = "Bit 7 - Enable or disable interrupt for LOOPSDONE event"]
476    #[inline(always)]
477    pub fn loopsdone(&mut self) -> LOOPSDONE_W<7> {
478        LOOPSDONE_W::new(self)
479    }
480    #[doc = "Writes raw bits to the register."]
481    #[inline(always)]
482    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
483        self.0.bits(bits);
484        self
485    }
486}
487#[doc = "Enable or disable interrupt\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 [inten](index.html) module"]
488pub struct INTEN_SPEC;
489impl crate::RegisterSpec for INTEN_SPEC {
490    type Ux = u32;
491}
492#[doc = "`read()` method returns [inten::R](R) reader structure"]
493impl crate::Readable for INTEN_SPEC {
494    type Reader = R;
495}
496#[doc = "`write(|w| ..)` method takes [inten::W](W) writer structure"]
497impl crate::Writable for INTEN_SPEC {
498    type Writer = W;
499}
500#[doc = "`reset()` method sets INTEN to value 0"]
501impl crate::Resettable for INTEN_SPEC {
502    #[inline(always)]
503    fn reset_value() -> Self::Ux {
504        0
505    }
506}