nrf5340_net_pac/rtc0_ns/
subscribe_capture.rs

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