nrf9160_pac/pwm0_ns/
subscribe_nextstep.rs

1#[doc = "Register `SUBSCRIBE_NEXTSTEP` reader"]
2pub struct R(crate::R<SUBSCRIBE_NEXTSTEP_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SUBSCRIBE_NEXTSTEP_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SUBSCRIBE_NEXTSTEP_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SUBSCRIBE_NEXTSTEP_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SUBSCRIBE_NEXTSTEP` writer"]
17pub struct W(crate::W<SUBSCRIBE_NEXTSTEP_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SUBSCRIBE_NEXTSTEP_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<SUBSCRIBE_NEXTSTEP_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SUBSCRIBE_NEXTSTEP_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CHIDX` reader - Channel that task NEXTSTEP will subscribe to"]
38pub type CHIDX_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `CHIDX` writer - Channel that task NEXTSTEP will subscribe to"]
40pub type CHIDX_W<'a, const O: u8> =
41    crate::FieldWriter<'a, u32, SUBSCRIBE_NEXTSTEP_SPEC, u8, u8, 4, O>;
42#[doc = "Field `EN` reader - "]
43pub type EN_R = crate::BitReader<EN_A>;
44#[doc = "\n\nValue on reset: 0"]
45#[derive(Clone, Copy, Debug, PartialEq)]
46pub enum EN_A {
47    #[doc = "0: Disable subscription"]
48    DISABLED = 0,
49    #[doc = "1: Enable subscription"]
50    ENABLED = 1,
51}
52impl From<EN_A> for bool {
53    #[inline(always)]
54    fn from(variant: EN_A) -> Self {
55        variant as u8 != 0
56    }
57}
58impl EN_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> EN_A {
62        match self.bits {
63            false => EN_A::DISABLED,
64            true => EN_A::ENABLED,
65        }
66    }
67    #[doc = "Checks if the value of the field is `DISABLED`"]
68    #[inline(always)]
69    pub fn is_disabled(&self) -> bool {
70        *self == EN_A::DISABLED
71    }
72    #[doc = "Checks if the value of the field is `ENABLED`"]
73    #[inline(always)]
74    pub fn is_enabled(&self) -> bool {
75        *self == EN_A::ENABLED
76    }
77}
78#[doc = "Field `EN` writer - "]
79pub type EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, SUBSCRIBE_NEXTSTEP_SPEC, EN_A, O>;
80impl<'a, const O: u8> EN_W<'a, O> {
81    #[doc = "Disable subscription"]
82    #[inline(always)]
83    pub fn disabled(self) -> &'a mut W {
84        self.variant(EN_A::DISABLED)
85    }
86    #[doc = "Enable subscription"]
87    #[inline(always)]
88    pub fn enabled(self) -> &'a mut W {
89        self.variant(EN_A::ENABLED)
90    }
91}
92impl R {
93    #[doc = "Bits 0:3 - Channel that task NEXTSTEP will subscribe to"]
94    #[inline(always)]
95    pub fn chidx(&self) -> CHIDX_R {
96        CHIDX_R::new((self.bits & 0x0f) as u8)
97    }
98    #[doc = "Bit 31"]
99    #[inline(always)]
100    pub fn en(&self) -> EN_R {
101        EN_R::new(((self.bits >> 31) & 1) != 0)
102    }
103}
104impl W {
105    #[doc = "Bits 0:3 - Channel that task NEXTSTEP will subscribe to"]
106    #[inline(always)]
107    pub fn chidx(&mut self) -> CHIDX_W<0> {
108        CHIDX_W::new(self)
109    }
110    #[doc = "Bit 31"]
111    #[inline(always)]
112    pub fn en(&mut self) -> EN_W<31> {
113        EN_W::new(self)
114    }
115    #[doc = "Writes raw bits to the register."]
116    #[inline(always)]
117    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
118        self.0.bits(bits);
119        self
120    }
121}
122#[doc = "Subscribe configuration for task NEXTSTEP\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 [subscribe_nextstep](index.html) module"]
123pub struct SUBSCRIBE_NEXTSTEP_SPEC;
124impl crate::RegisterSpec for SUBSCRIBE_NEXTSTEP_SPEC {
125    type Ux = u32;
126}
127#[doc = "`read()` method returns [subscribe_nextstep::R](R) reader structure"]
128impl crate::Readable for SUBSCRIBE_NEXTSTEP_SPEC {
129    type Reader = R;
130}
131#[doc = "`write(|w| ..)` method takes [subscribe_nextstep::W](W) writer structure"]
132impl crate::Writable for SUBSCRIBE_NEXTSTEP_SPEC {
133    type Writer = W;
134}
135#[doc = "`reset()` method sets SUBSCRIBE_NEXTSTEP to value 0"]
136impl crate::Resettable for SUBSCRIBE_NEXTSTEP_SPEC {
137    #[inline(always)]
138    fn reset_value() -> Self::Ux {
139        0
140    }
141}