nrf51_pac/qdec/
shorts.rs

1#[doc = "Register `SHORTS` reader"]
2pub struct R(crate::R<SHORTS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SHORTS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SHORTS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SHORTS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SHORTS` writer"]
17pub struct W(crate::W<SHORTS_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SHORTS_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<SHORTS_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SHORTS_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `REPORTRDY_READCLRACC` reader - Shortcut between REPORTRDY event and READCLRACC task."]
38pub type REPORTRDY_READCLRACC_R = crate::BitReader<REPORTRDY_READCLRACC_A>;
39#[doc = "Shortcut between REPORTRDY event and READCLRACC task.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum REPORTRDY_READCLRACC_A {
42    #[doc = "0: Shortcut disabled."]
43    DISABLED = 0,
44    #[doc = "1: Shortcut enabled."]
45    ENABLED = 1,
46}
47impl From<REPORTRDY_READCLRACC_A> for bool {
48    #[inline(always)]
49    fn from(variant: REPORTRDY_READCLRACC_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl REPORTRDY_READCLRACC_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> REPORTRDY_READCLRACC_A {
57        match self.bits {
58            false => REPORTRDY_READCLRACC_A::DISABLED,
59            true => REPORTRDY_READCLRACC_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 == REPORTRDY_READCLRACC_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 == REPORTRDY_READCLRACC_A::ENABLED
71    }
72}
73#[doc = "Field `REPORTRDY_READCLRACC` writer - Shortcut between REPORTRDY event and READCLRACC task."]
74pub type REPORTRDY_READCLRACC_W<'a, const O: u8> =
75    crate::BitWriter<'a, u32, SHORTS_SPEC, REPORTRDY_READCLRACC_A, O>;
76impl<'a, const O: u8> REPORTRDY_READCLRACC_W<'a, O> {
77    #[doc = "Shortcut disabled."]
78    #[inline(always)]
79    pub fn disabled(self) -> &'a mut W {
80        self.variant(REPORTRDY_READCLRACC_A::DISABLED)
81    }
82    #[doc = "Shortcut enabled."]
83    #[inline(always)]
84    pub fn enabled(self) -> &'a mut W {
85        self.variant(REPORTRDY_READCLRACC_A::ENABLED)
86    }
87}
88#[doc = "Field `SAMPLERDY_STOP` reader - Shortcut between SAMPLERDY event and STOP task."]
89pub type SAMPLERDY_STOP_R = crate::BitReader<SAMPLERDY_STOP_A>;
90#[doc = "Shortcut between SAMPLERDY event and STOP task.\n\nValue on reset: 0"]
91#[derive(Clone, Copy, Debug, PartialEq)]
92pub enum SAMPLERDY_STOP_A {
93    #[doc = "0: Shortcut disabled."]
94    DISABLED = 0,
95    #[doc = "1: Shortcut enabled."]
96    ENABLED = 1,
97}
98impl From<SAMPLERDY_STOP_A> for bool {
99    #[inline(always)]
100    fn from(variant: SAMPLERDY_STOP_A) -> Self {
101        variant as u8 != 0
102    }
103}
104impl SAMPLERDY_STOP_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> SAMPLERDY_STOP_A {
108        match self.bits {
109            false => SAMPLERDY_STOP_A::DISABLED,
110            true => SAMPLERDY_STOP_A::ENABLED,
111        }
112    }
113    #[doc = "Checks if the value of the field is `DISABLED`"]
114    #[inline(always)]
115    pub fn is_disabled(&self) -> bool {
116        *self == SAMPLERDY_STOP_A::DISABLED
117    }
118    #[doc = "Checks if the value of the field is `ENABLED`"]
119    #[inline(always)]
120    pub fn is_enabled(&self) -> bool {
121        *self == SAMPLERDY_STOP_A::ENABLED
122    }
123}
124#[doc = "Field `SAMPLERDY_STOP` writer - Shortcut between SAMPLERDY event and STOP task."]
125pub type SAMPLERDY_STOP_W<'a, const O: u8> =
126    crate::BitWriter<'a, u32, SHORTS_SPEC, SAMPLERDY_STOP_A, O>;
127impl<'a, const O: u8> SAMPLERDY_STOP_W<'a, O> {
128    #[doc = "Shortcut disabled."]
129    #[inline(always)]
130    pub fn disabled(self) -> &'a mut W {
131        self.variant(SAMPLERDY_STOP_A::DISABLED)
132    }
133    #[doc = "Shortcut enabled."]
134    #[inline(always)]
135    pub fn enabled(self) -> &'a mut W {
136        self.variant(SAMPLERDY_STOP_A::ENABLED)
137    }
138}
139impl R {
140    #[doc = "Bit 0 - Shortcut between REPORTRDY event and READCLRACC task."]
141    #[inline(always)]
142    pub fn reportrdy_readclracc(&self) -> REPORTRDY_READCLRACC_R {
143        REPORTRDY_READCLRACC_R::new((self.bits & 1) != 0)
144    }
145    #[doc = "Bit 1 - Shortcut between SAMPLERDY event and STOP task."]
146    #[inline(always)]
147    pub fn samplerdy_stop(&self) -> SAMPLERDY_STOP_R {
148        SAMPLERDY_STOP_R::new(((self.bits >> 1) & 1) != 0)
149    }
150}
151impl W {
152    #[doc = "Bit 0 - Shortcut between REPORTRDY event and READCLRACC task."]
153    #[inline(always)]
154    pub fn reportrdy_readclracc(&mut self) -> REPORTRDY_READCLRACC_W<0> {
155        REPORTRDY_READCLRACC_W::new(self)
156    }
157    #[doc = "Bit 1 - Shortcut between SAMPLERDY event and STOP task."]
158    #[inline(always)]
159    pub fn samplerdy_stop(&mut self) -> SAMPLERDY_STOP_W<1> {
160        SAMPLERDY_STOP_W::new(self)
161    }
162    #[doc = "Writes raw bits to the register."]
163    #[inline(always)]
164    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
165        self.0.bits(bits);
166        self
167    }
168}
169#[doc = "Shortcuts for the QDEC.\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 [shorts](index.html) module"]
170pub struct SHORTS_SPEC;
171impl crate::RegisterSpec for SHORTS_SPEC {
172    type Ux = u32;
173}
174#[doc = "`read()` method returns [shorts::R](R) reader structure"]
175impl crate::Readable for SHORTS_SPEC {
176    type Reader = R;
177}
178#[doc = "`write(|w| ..)` method takes [shorts::W](W) writer structure"]
179impl crate::Writable for SHORTS_SPEC {
180    type Writer = W;
181}
182#[doc = "`reset()` method sets SHORTS to value 0"]
183impl crate::Resettable for SHORTS_SPEC {
184    #[inline(always)]
185    fn reset_value() -> Self::Ux {
186        0
187    }
188}