nrf51_pac/timer0/
intenclr.rs

1#[doc = "Register `INTENCLR` reader"]
2pub struct R(crate::R<INTENCLR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<INTENCLR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<INTENCLR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<INTENCLR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `INTENCLR` writer"]
17pub struct W(crate::W<INTENCLR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<INTENCLR_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<INTENCLR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<INTENCLR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `COMPARE0` reader - Disable interrupt on COMPARE\\[0\\]"]
38pub type COMPARE0_R = crate::BitReader<COMPARE0_A>;
39#[doc = "Disable interrupt on COMPARE\\[0\\]\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum COMPARE0_A {
42    #[doc = "0: Interrupt disabled."]
43    DISABLED = 0,
44    #[doc = "1: Interrupt enabled."]
45    ENABLED = 1,
46}
47impl From<COMPARE0_A> for bool {
48    #[inline(always)]
49    fn from(variant: COMPARE0_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl COMPARE0_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> COMPARE0_A {
57        match self.bits {
58            false => COMPARE0_A::DISABLED,
59            true => COMPARE0_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 == COMPARE0_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 == COMPARE0_A::ENABLED
71    }
72}
73#[doc = "Disable interrupt on COMPARE\\[0\\]\n\nValue on reset: 0"]
74#[derive(Clone, Copy, Debug, PartialEq)]
75pub enum COMPARE0_AW {
76    #[doc = "1: Disable interrupt on write."]
77    CLEAR = 1,
78}
79impl From<COMPARE0_AW> for bool {
80    #[inline(always)]
81    fn from(variant: COMPARE0_AW) -> Self {
82        variant as u8 != 0
83    }
84}
85#[doc = "Field `COMPARE0` writer - Disable interrupt on COMPARE\\[0\\]"]
86pub type COMPARE0_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTENCLR_SPEC, COMPARE0_AW, O>;
87impl<'a, const O: u8> COMPARE0_W<'a, O> {
88    #[doc = "Disable interrupt on write."]
89    #[inline(always)]
90    pub fn clear(self) -> &'a mut W {
91        self.variant(COMPARE0_AW::CLEAR)
92    }
93}
94#[doc = "Field `COMPARE1` reader - Disable interrupt on COMPARE\\[1\\]"]
95pub type COMPARE1_R = crate::BitReader<COMPARE1_A>;
96#[doc = "Disable interrupt on COMPARE\\[1\\]\n\nValue on reset: 0"]
97#[derive(Clone, Copy, Debug, PartialEq)]
98pub enum COMPARE1_A {
99    #[doc = "0: Interrupt disabled."]
100    DISABLED = 0,
101    #[doc = "1: Interrupt enabled."]
102    ENABLED = 1,
103}
104impl From<COMPARE1_A> for bool {
105    #[inline(always)]
106    fn from(variant: COMPARE1_A) -> Self {
107        variant as u8 != 0
108    }
109}
110impl COMPARE1_R {
111    #[doc = "Get enumerated values variant"]
112    #[inline(always)]
113    pub fn variant(&self) -> COMPARE1_A {
114        match self.bits {
115            false => COMPARE1_A::DISABLED,
116            true => COMPARE1_A::ENABLED,
117        }
118    }
119    #[doc = "Checks if the value of the field is `DISABLED`"]
120    #[inline(always)]
121    pub fn is_disabled(&self) -> bool {
122        *self == COMPARE1_A::DISABLED
123    }
124    #[doc = "Checks if the value of the field is `ENABLED`"]
125    #[inline(always)]
126    pub fn is_enabled(&self) -> bool {
127        *self == COMPARE1_A::ENABLED
128    }
129}
130#[doc = "Disable interrupt on COMPARE\\[1\\]\n\nValue on reset: 0"]
131#[derive(Clone, Copy, Debug, PartialEq)]
132pub enum COMPARE1_AW {
133    #[doc = "1: Disable interrupt on write."]
134    CLEAR = 1,
135}
136impl From<COMPARE1_AW> for bool {
137    #[inline(always)]
138    fn from(variant: COMPARE1_AW) -> Self {
139        variant as u8 != 0
140    }
141}
142#[doc = "Field `COMPARE1` writer - Disable interrupt on COMPARE\\[1\\]"]
143pub type COMPARE1_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTENCLR_SPEC, COMPARE1_AW, O>;
144impl<'a, const O: u8> COMPARE1_W<'a, O> {
145    #[doc = "Disable interrupt on write."]
146    #[inline(always)]
147    pub fn clear(self) -> &'a mut W {
148        self.variant(COMPARE1_AW::CLEAR)
149    }
150}
151#[doc = "Field `COMPARE2` reader - Disable interrupt on COMPARE\\[2\\]"]
152pub type COMPARE2_R = crate::BitReader<COMPARE2_A>;
153#[doc = "Disable interrupt on COMPARE\\[2\\]\n\nValue on reset: 0"]
154#[derive(Clone, Copy, Debug, PartialEq)]
155pub enum COMPARE2_A {
156    #[doc = "0: Interrupt disabled."]
157    DISABLED = 0,
158    #[doc = "1: Interrupt enabled."]
159    ENABLED = 1,
160}
161impl From<COMPARE2_A> for bool {
162    #[inline(always)]
163    fn from(variant: COMPARE2_A) -> Self {
164        variant as u8 != 0
165    }
166}
167impl COMPARE2_R {
168    #[doc = "Get enumerated values variant"]
169    #[inline(always)]
170    pub fn variant(&self) -> COMPARE2_A {
171        match self.bits {
172            false => COMPARE2_A::DISABLED,
173            true => COMPARE2_A::ENABLED,
174        }
175    }
176    #[doc = "Checks if the value of the field is `DISABLED`"]
177    #[inline(always)]
178    pub fn is_disabled(&self) -> bool {
179        *self == COMPARE2_A::DISABLED
180    }
181    #[doc = "Checks if the value of the field is `ENABLED`"]
182    #[inline(always)]
183    pub fn is_enabled(&self) -> bool {
184        *self == COMPARE2_A::ENABLED
185    }
186}
187#[doc = "Disable interrupt on COMPARE\\[2\\]\n\nValue on reset: 0"]
188#[derive(Clone, Copy, Debug, PartialEq)]
189pub enum COMPARE2_AW {
190    #[doc = "1: Disable interrupt on write."]
191    CLEAR = 1,
192}
193impl From<COMPARE2_AW> for bool {
194    #[inline(always)]
195    fn from(variant: COMPARE2_AW) -> Self {
196        variant as u8 != 0
197    }
198}
199#[doc = "Field `COMPARE2` writer - Disable interrupt on COMPARE\\[2\\]"]
200pub type COMPARE2_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTENCLR_SPEC, COMPARE2_AW, O>;
201impl<'a, const O: u8> COMPARE2_W<'a, O> {
202    #[doc = "Disable interrupt on write."]
203    #[inline(always)]
204    pub fn clear(self) -> &'a mut W {
205        self.variant(COMPARE2_AW::CLEAR)
206    }
207}
208#[doc = "Field `COMPARE3` reader - Disable interrupt on COMPARE\\[3\\]"]
209pub type COMPARE3_R = crate::BitReader<COMPARE3_A>;
210#[doc = "Disable interrupt on COMPARE\\[3\\]\n\nValue on reset: 0"]
211#[derive(Clone, Copy, Debug, PartialEq)]
212pub enum COMPARE3_A {
213    #[doc = "0: Interrupt disabled."]
214    DISABLED = 0,
215    #[doc = "1: Interrupt enabled."]
216    ENABLED = 1,
217}
218impl From<COMPARE3_A> for bool {
219    #[inline(always)]
220    fn from(variant: COMPARE3_A) -> Self {
221        variant as u8 != 0
222    }
223}
224impl COMPARE3_R {
225    #[doc = "Get enumerated values variant"]
226    #[inline(always)]
227    pub fn variant(&self) -> COMPARE3_A {
228        match self.bits {
229            false => COMPARE3_A::DISABLED,
230            true => COMPARE3_A::ENABLED,
231        }
232    }
233    #[doc = "Checks if the value of the field is `DISABLED`"]
234    #[inline(always)]
235    pub fn is_disabled(&self) -> bool {
236        *self == COMPARE3_A::DISABLED
237    }
238    #[doc = "Checks if the value of the field is `ENABLED`"]
239    #[inline(always)]
240    pub fn is_enabled(&self) -> bool {
241        *self == COMPARE3_A::ENABLED
242    }
243}
244#[doc = "Disable interrupt on COMPARE\\[3\\]\n\nValue on reset: 0"]
245#[derive(Clone, Copy, Debug, PartialEq)]
246pub enum COMPARE3_AW {
247    #[doc = "1: Disable interrupt on write."]
248    CLEAR = 1,
249}
250impl From<COMPARE3_AW> for bool {
251    #[inline(always)]
252    fn from(variant: COMPARE3_AW) -> Self {
253        variant as u8 != 0
254    }
255}
256#[doc = "Field `COMPARE3` writer - Disable interrupt on COMPARE\\[3\\]"]
257pub type COMPARE3_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTENCLR_SPEC, COMPARE3_AW, O>;
258impl<'a, const O: u8> COMPARE3_W<'a, O> {
259    #[doc = "Disable interrupt on write."]
260    #[inline(always)]
261    pub fn clear(self) -> &'a mut W {
262        self.variant(COMPARE3_AW::CLEAR)
263    }
264}
265impl R {
266    #[doc = "Bit 16 - Disable interrupt on COMPARE\\[0\\]"]
267    #[inline(always)]
268    pub fn compare0(&self) -> COMPARE0_R {
269        COMPARE0_R::new(((self.bits >> 16) & 1) != 0)
270    }
271    #[doc = "Bit 17 - Disable interrupt on COMPARE\\[1\\]"]
272    #[inline(always)]
273    pub fn compare1(&self) -> COMPARE1_R {
274        COMPARE1_R::new(((self.bits >> 17) & 1) != 0)
275    }
276    #[doc = "Bit 18 - Disable interrupt on COMPARE\\[2\\]"]
277    #[inline(always)]
278    pub fn compare2(&self) -> COMPARE2_R {
279        COMPARE2_R::new(((self.bits >> 18) & 1) != 0)
280    }
281    #[doc = "Bit 19 - Disable interrupt on COMPARE\\[3\\]"]
282    #[inline(always)]
283    pub fn compare3(&self) -> COMPARE3_R {
284        COMPARE3_R::new(((self.bits >> 19) & 1) != 0)
285    }
286}
287impl W {
288    #[doc = "Bit 16 - Disable interrupt on COMPARE\\[0\\]"]
289    #[inline(always)]
290    pub fn compare0(&mut self) -> COMPARE0_W<16> {
291        COMPARE0_W::new(self)
292    }
293    #[doc = "Bit 17 - Disable interrupt on COMPARE\\[1\\]"]
294    #[inline(always)]
295    pub fn compare1(&mut self) -> COMPARE1_W<17> {
296        COMPARE1_W::new(self)
297    }
298    #[doc = "Bit 18 - Disable interrupt on COMPARE\\[2\\]"]
299    #[inline(always)]
300    pub fn compare2(&mut self) -> COMPARE2_W<18> {
301        COMPARE2_W::new(self)
302    }
303    #[doc = "Bit 19 - Disable interrupt on COMPARE\\[3\\]"]
304    #[inline(always)]
305    pub fn compare3(&mut self) -> COMPARE3_W<19> {
306        COMPARE3_W::new(self)
307    }
308    #[doc = "Writes raw bits to the register."]
309    #[inline(always)]
310    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
311        self.0.bits(bits);
312        self
313    }
314}
315#[doc = "Interrupt enable clear register.\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 [intenclr](index.html) module"]
316pub struct INTENCLR_SPEC;
317impl crate::RegisterSpec for INTENCLR_SPEC {
318    type Ux = u32;
319}
320#[doc = "`read()` method returns [intenclr::R](R) reader structure"]
321impl crate::Readable for INTENCLR_SPEC {
322    type Reader = R;
323}
324#[doc = "`write(|w| ..)` method takes [intenclr::W](W) writer structure"]
325impl crate::Writable for INTENCLR_SPEC {
326    type Writer = W;
327}
328#[doc = "`reset()` method sets INTENCLR to value 0"]
329impl crate::Resettable for INTENCLR_SPEC {
330    #[inline(always)]
331    fn reset_value() -> Self::Ux {
332        0
333    }
334}