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