nrf52840_pac/lpcomp/
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 `READY_SAMPLE` reader - Shortcut between READY event and SAMPLE task"]
38pub type READY_SAMPLE_R = crate::BitReader<READY_SAMPLE_A>;
39#[doc = "Shortcut between READY event and SAMPLE task\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum READY_SAMPLE_A {
42 #[doc = "0: Disable shortcut"]
43 DISABLED = 0,
44 #[doc = "1: Enable shortcut"]
45 ENABLED = 1,
46}
47impl From<READY_SAMPLE_A> for bool {
48 #[inline(always)]
49 fn from(variant: READY_SAMPLE_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl READY_SAMPLE_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> READY_SAMPLE_A {
57 match self.bits {
58 false => READY_SAMPLE_A::DISABLED,
59 true => READY_SAMPLE_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 == READY_SAMPLE_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 == READY_SAMPLE_A::ENABLED
71 }
72}
73#[doc = "Field `READY_SAMPLE` writer - Shortcut between READY event and SAMPLE task"]
74pub type READY_SAMPLE_W<'a, const O: u8> =
75 crate::BitWriter<'a, u32, SHORTS_SPEC, READY_SAMPLE_A, O>;
76impl<'a, const O: u8> READY_SAMPLE_W<'a, O> {
77 #[doc = "Disable shortcut"]
78 #[inline(always)]
79 pub fn disabled(self) -> &'a mut W {
80 self.variant(READY_SAMPLE_A::DISABLED)
81 }
82 #[doc = "Enable shortcut"]
83 #[inline(always)]
84 pub fn enabled(self) -> &'a mut W {
85 self.variant(READY_SAMPLE_A::ENABLED)
86 }
87}
88#[doc = "Field `READY_STOP` reader - Shortcut between READY event and STOP task"]
89pub type READY_STOP_R = crate::BitReader<READY_STOP_A>;
90#[doc = "Shortcut between READY event and STOP task\n\nValue on reset: 0"]
91#[derive(Clone, Copy, Debug, PartialEq)]
92pub enum READY_STOP_A {
93 #[doc = "0: Disable shortcut"]
94 DISABLED = 0,
95 #[doc = "1: Enable shortcut"]
96 ENABLED = 1,
97}
98impl From<READY_STOP_A> for bool {
99 #[inline(always)]
100 fn from(variant: READY_STOP_A) -> Self {
101 variant as u8 != 0
102 }
103}
104impl READY_STOP_R {
105 #[doc = "Get enumerated values variant"]
106 #[inline(always)]
107 pub fn variant(&self) -> READY_STOP_A {
108 match self.bits {
109 false => READY_STOP_A::DISABLED,
110 true => READY_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 == READY_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 == READY_STOP_A::ENABLED
122 }
123}
124#[doc = "Field `READY_STOP` writer - Shortcut between READY event and STOP task"]
125pub type READY_STOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHORTS_SPEC, READY_STOP_A, O>;
126impl<'a, const O: u8> READY_STOP_W<'a, O> {
127 #[doc = "Disable shortcut"]
128 #[inline(always)]
129 pub fn disabled(self) -> &'a mut W {
130 self.variant(READY_STOP_A::DISABLED)
131 }
132 #[doc = "Enable shortcut"]
133 #[inline(always)]
134 pub fn enabled(self) -> &'a mut W {
135 self.variant(READY_STOP_A::ENABLED)
136 }
137}
138#[doc = "Field `DOWN_STOP` reader - Shortcut between DOWN event and STOP task"]
139pub type DOWN_STOP_R = crate::BitReader<DOWN_STOP_A>;
140#[doc = "Shortcut between DOWN event and STOP task\n\nValue on reset: 0"]
141#[derive(Clone, Copy, Debug, PartialEq)]
142pub enum DOWN_STOP_A {
143 #[doc = "0: Disable shortcut"]
144 DISABLED = 0,
145 #[doc = "1: Enable shortcut"]
146 ENABLED = 1,
147}
148impl From<DOWN_STOP_A> for bool {
149 #[inline(always)]
150 fn from(variant: DOWN_STOP_A) -> Self {
151 variant as u8 != 0
152 }
153}
154impl DOWN_STOP_R {
155 #[doc = "Get enumerated values variant"]
156 #[inline(always)]
157 pub fn variant(&self) -> DOWN_STOP_A {
158 match self.bits {
159 false => DOWN_STOP_A::DISABLED,
160 true => DOWN_STOP_A::ENABLED,
161 }
162 }
163 #[doc = "Checks if the value of the field is `DISABLED`"]
164 #[inline(always)]
165 pub fn is_disabled(&self) -> bool {
166 *self == DOWN_STOP_A::DISABLED
167 }
168 #[doc = "Checks if the value of the field is `ENABLED`"]
169 #[inline(always)]
170 pub fn is_enabled(&self) -> bool {
171 *self == DOWN_STOP_A::ENABLED
172 }
173}
174#[doc = "Field `DOWN_STOP` writer - Shortcut between DOWN event and STOP task"]
175pub type DOWN_STOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHORTS_SPEC, DOWN_STOP_A, O>;
176impl<'a, const O: u8> DOWN_STOP_W<'a, O> {
177 #[doc = "Disable shortcut"]
178 #[inline(always)]
179 pub fn disabled(self) -> &'a mut W {
180 self.variant(DOWN_STOP_A::DISABLED)
181 }
182 #[doc = "Enable shortcut"]
183 #[inline(always)]
184 pub fn enabled(self) -> &'a mut W {
185 self.variant(DOWN_STOP_A::ENABLED)
186 }
187}
188#[doc = "Field `UP_STOP` reader - Shortcut between UP event and STOP task"]
189pub type UP_STOP_R = crate::BitReader<UP_STOP_A>;
190#[doc = "Shortcut between UP event and STOP task\n\nValue on reset: 0"]
191#[derive(Clone, Copy, Debug, PartialEq)]
192pub enum UP_STOP_A {
193 #[doc = "0: Disable shortcut"]
194 DISABLED = 0,
195 #[doc = "1: Enable shortcut"]
196 ENABLED = 1,
197}
198impl From<UP_STOP_A> for bool {
199 #[inline(always)]
200 fn from(variant: UP_STOP_A) -> Self {
201 variant as u8 != 0
202 }
203}
204impl UP_STOP_R {
205 #[doc = "Get enumerated values variant"]
206 #[inline(always)]
207 pub fn variant(&self) -> UP_STOP_A {
208 match self.bits {
209 false => UP_STOP_A::DISABLED,
210 true => UP_STOP_A::ENABLED,
211 }
212 }
213 #[doc = "Checks if the value of the field is `DISABLED`"]
214 #[inline(always)]
215 pub fn is_disabled(&self) -> bool {
216 *self == UP_STOP_A::DISABLED
217 }
218 #[doc = "Checks if the value of the field is `ENABLED`"]
219 #[inline(always)]
220 pub fn is_enabled(&self) -> bool {
221 *self == UP_STOP_A::ENABLED
222 }
223}
224#[doc = "Field `UP_STOP` writer - Shortcut between UP event and STOP task"]
225pub type UP_STOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHORTS_SPEC, UP_STOP_A, O>;
226impl<'a, const O: u8> UP_STOP_W<'a, O> {
227 #[doc = "Disable shortcut"]
228 #[inline(always)]
229 pub fn disabled(self) -> &'a mut W {
230 self.variant(UP_STOP_A::DISABLED)
231 }
232 #[doc = "Enable shortcut"]
233 #[inline(always)]
234 pub fn enabled(self) -> &'a mut W {
235 self.variant(UP_STOP_A::ENABLED)
236 }
237}
238#[doc = "Field `CROSS_STOP` reader - Shortcut between CROSS event and STOP task"]
239pub type CROSS_STOP_R = crate::BitReader<CROSS_STOP_A>;
240#[doc = "Shortcut between CROSS event and STOP task\n\nValue on reset: 0"]
241#[derive(Clone, Copy, Debug, PartialEq)]
242pub enum CROSS_STOP_A {
243 #[doc = "0: Disable shortcut"]
244 DISABLED = 0,
245 #[doc = "1: Enable shortcut"]
246 ENABLED = 1,
247}
248impl From<CROSS_STOP_A> for bool {
249 #[inline(always)]
250 fn from(variant: CROSS_STOP_A) -> Self {
251 variant as u8 != 0
252 }
253}
254impl CROSS_STOP_R {
255 #[doc = "Get enumerated values variant"]
256 #[inline(always)]
257 pub fn variant(&self) -> CROSS_STOP_A {
258 match self.bits {
259 false => CROSS_STOP_A::DISABLED,
260 true => CROSS_STOP_A::ENABLED,
261 }
262 }
263 #[doc = "Checks if the value of the field is `DISABLED`"]
264 #[inline(always)]
265 pub fn is_disabled(&self) -> bool {
266 *self == CROSS_STOP_A::DISABLED
267 }
268 #[doc = "Checks if the value of the field is `ENABLED`"]
269 #[inline(always)]
270 pub fn is_enabled(&self) -> bool {
271 *self == CROSS_STOP_A::ENABLED
272 }
273}
274#[doc = "Field `CROSS_STOP` writer - Shortcut between CROSS event and STOP task"]
275pub type CROSS_STOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHORTS_SPEC, CROSS_STOP_A, O>;
276impl<'a, const O: u8> CROSS_STOP_W<'a, O> {
277 #[doc = "Disable shortcut"]
278 #[inline(always)]
279 pub fn disabled(self) -> &'a mut W {
280 self.variant(CROSS_STOP_A::DISABLED)
281 }
282 #[doc = "Enable shortcut"]
283 #[inline(always)]
284 pub fn enabled(self) -> &'a mut W {
285 self.variant(CROSS_STOP_A::ENABLED)
286 }
287}
288impl R {
289 #[doc = "Bit 0 - Shortcut between READY event and SAMPLE task"]
290 #[inline(always)]
291 pub fn ready_sample(&self) -> READY_SAMPLE_R {
292 READY_SAMPLE_R::new((self.bits & 1) != 0)
293 }
294 #[doc = "Bit 1 - Shortcut between READY event and STOP task"]
295 #[inline(always)]
296 pub fn ready_stop(&self) -> READY_STOP_R {
297 READY_STOP_R::new(((self.bits >> 1) & 1) != 0)
298 }
299 #[doc = "Bit 2 - Shortcut between DOWN event and STOP task"]
300 #[inline(always)]
301 pub fn down_stop(&self) -> DOWN_STOP_R {
302 DOWN_STOP_R::new(((self.bits >> 2) & 1) != 0)
303 }
304 #[doc = "Bit 3 - Shortcut between UP event and STOP task"]
305 #[inline(always)]
306 pub fn up_stop(&self) -> UP_STOP_R {
307 UP_STOP_R::new(((self.bits >> 3) & 1) != 0)
308 }
309 #[doc = "Bit 4 - Shortcut between CROSS event and STOP task"]
310 #[inline(always)]
311 pub fn cross_stop(&self) -> CROSS_STOP_R {
312 CROSS_STOP_R::new(((self.bits >> 4) & 1) != 0)
313 }
314}
315impl W {
316 #[doc = "Bit 0 - Shortcut between READY event and SAMPLE task"]
317 #[inline(always)]
318 pub fn ready_sample(&mut self) -> READY_SAMPLE_W<0> {
319 READY_SAMPLE_W::new(self)
320 }
321 #[doc = "Bit 1 - Shortcut between READY event and STOP task"]
322 #[inline(always)]
323 pub fn ready_stop(&mut self) -> READY_STOP_W<1> {
324 READY_STOP_W::new(self)
325 }
326 #[doc = "Bit 2 - Shortcut between DOWN event and STOP task"]
327 #[inline(always)]
328 pub fn down_stop(&mut self) -> DOWN_STOP_W<2> {
329 DOWN_STOP_W::new(self)
330 }
331 #[doc = "Bit 3 - Shortcut between UP event and STOP task"]
332 #[inline(always)]
333 pub fn up_stop(&mut self) -> UP_STOP_W<3> {
334 UP_STOP_W::new(self)
335 }
336 #[doc = "Bit 4 - Shortcut between CROSS event and STOP task"]
337 #[inline(always)]
338 pub fn cross_stop(&mut self) -> CROSS_STOP_W<4> {
339 CROSS_STOP_W::new(self)
340 }
341 #[doc = "Writes raw bits to the register."]
342 #[inline(always)]
343 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
344 self.0.bits(bits);
345 self
346 }
347}
348#[doc = "Shortcut 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 [shorts](index.html) module"]
349pub struct SHORTS_SPEC;
350impl crate::RegisterSpec for SHORTS_SPEC {
351 type Ux = u32;
352}
353#[doc = "`read()` method returns [shorts::R](R) reader structure"]
354impl crate::Readable for SHORTS_SPEC {
355 type Reader = R;
356}
357#[doc = "`write(|w| ..)` method takes [shorts::W](W) writer structure"]
358impl crate::Writable for SHORTS_SPEC {
359 type Writer = W;
360}
361#[doc = "`reset()` method sets SHORTS to value 0"]
362impl crate::Resettable for SHORTS_SPEC {
363 #[inline(always)]
364 fn reset_value() -> Self::Ux {
365 0
366 }
367}