nrf52840_pac/pwm0/
intenset.rs

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