nrf52840_pac/usbd/
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 `EP0DATADONE_STARTEPIN0` reader - Shortcut between EP0DATADONE event and STARTEPIN\\[0\\]
38task"]
39pub type EP0DATADONE_STARTEPIN0_R = crate::BitReader<EP0DATADONE_STARTEPIN0_A>;
40#[doc = "Shortcut between EP0DATADONE event and STARTEPIN\\[0\\]
41task\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43pub enum EP0DATADONE_STARTEPIN0_A {
44    #[doc = "0: Disable shortcut"]
45    DISABLED = 0,
46    #[doc = "1: Enable shortcut"]
47    ENABLED = 1,
48}
49impl From<EP0DATADONE_STARTEPIN0_A> for bool {
50    #[inline(always)]
51    fn from(variant: EP0DATADONE_STARTEPIN0_A) -> Self {
52        variant as u8 != 0
53    }
54}
55impl EP0DATADONE_STARTEPIN0_R {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub fn variant(&self) -> EP0DATADONE_STARTEPIN0_A {
59        match self.bits {
60            false => EP0DATADONE_STARTEPIN0_A::DISABLED,
61            true => EP0DATADONE_STARTEPIN0_A::ENABLED,
62        }
63    }
64    #[doc = "Checks if the value of the field is `DISABLED`"]
65    #[inline(always)]
66    pub fn is_disabled(&self) -> bool {
67        *self == EP0DATADONE_STARTEPIN0_A::DISABLED
68    }
69    #[doc = "Checks if the value of the field is `ENABLED`"]
70    #[inline(always)]
71    pub fn is_enabled(&self) -> bool {
72        *self == EP0DATADONE_STARTEPIN0_A::ENABLED
73    }
74}
75#[doc = "Field `EP0DATADONE_STARTEPIN0` writer - Shortcut between EP0DATADONE event and STARTEPIN\\[0\\]
76task"]
77pub type EP0DATADONE_STARTEPIN0_W<'a, const O: u8> =
78    crate::BitWriter<'a, u32, SHORTS_SPEC, EP0DATADONE_STARTEPIN0_A, O>;
79impl<'a, const O: u8> EP0DATADONE_STARTEPIN0_W<'a, O> {
80    #[doc = "Disable shortcut"]
81    #[inline(always)]
82    pub fn disabled(self) -> &'a mut W {
83        self.variant(EP0DATADONE_STARTEPIN0_A::DISABLED)
84    }
85    #[doc = "Enable shortcut"]
86    #[inline(always)]
87    pub fn enabled(self) -> &'a mut W {
88        self.variant(EP0DATADONE_STARTEPIN0_A::ENABLED)
89    }
90}
91#[doc = "Field `EP0DATADONE_STARTEPOUT0` reader - Shortcut between EP0DATADONE event and STARTEPOUT\\[0\\]
92task"]
93pub type EP0DATADONE_STARTEPOUT0_R = crate::BitReader<EP0DATADONE_STARTEPOUT0_A>;
94#[doc = "Shortcut between EP0DATADONE event and STARTEPOUT\\[0\\]
95task\n\nValue on reset: 0"]
96#[derive(Clone, Copy, Debug, PartialEq)]
97pub enum EP0DATADONE_STARTEPOUT0_A {
98    #[doc = "0: Disable shortcut"]
99    DISABLED = 0,
100    #[doc = "1: Enable shortcut"]
101    ENABLED = 1,
102}
103impl From<EP0DATADONE_STARTEPOUT0_A> for bool {
104    #[inline(always)]
105    fn from(variant: EP0DATADONE_STARTEPOUT0_A) -> Self {
106        variant as u8 != 0
107    }
108}
109impl EP0DATADONE_STARTEPOUT0_R {
110    #[doc = "Get enumerated values variant"]
111    #[inline(always)]
112    pub fn variant(&self) -> EP0DATADONE_STARTEPOUT0_A {
113        match self.bits {
114            false => EP0DATADONE_STARTEPOUT0_A::DISABLED,
115            true => EP0DATADONE_STARTEPOUT0_A::ENABLED,
116        }
117    }
118    #[doc = "Checks if the value of the field is `DISABLED`"]
119    #[inline(always)]
120    pub fn is_disabled(&self) -> bool {
121        *self == EP0DATADONE_STARTEPOUT0_A::DISABLED
122    }
123    #[doc = "Checks if the value of the field is `ENABLED`"]
124    #[inline(always)]
125    pub fn is_enabled(&self) -> bool {
126        *self == EP0DATADONE_STARTEPOUT0_A::ENABLED
127    }
128}
129#[doc = "Field `EP0DATADONE_STARTEPOUT0` writer - Shortcut between EP0DATADONE event and STARTEPOUT\\[0\\]
130task"]
131pub type EP0DATADONE_STARTEPOUT0_W<'a, const O: u8> =
132    crate::BitWriter<'a, u32, SHORTS_SPEC, EP0DATADONE_STARTEPOUT0_A, O>;
133impl<'a, const O: u8> EP0DATADONE_STARTEPOUT0_W<'a, O> {
134    #[doc = "Disable shortcut"]
135    #[inline(always)]
136    pub fn disabled(self) -> &'a mut W {
137        self.variant(EP0DATADONE_STARTEPOUT0_A::DISABLED)
138    }
139    #[doc = "Enable shortcut"]
140    #[inline(always)]
141    pub fn enabled(self) -> &'a mut W {
142        self.variant(EP0DATADONE_STARTEPOUT0_A::ENABLED)
143    }
144}
145#[doc = "Field `EP0DATADONE_EP0STATUS` reader - Shortcut between EP0DATADONE event and EP0STATUS task"]
146pub type EP0DATADONE_EP0STATUS_R = crate::BitReader<EP0DATADONE_EP0STATUS_A>;
147#[doc = "Shortcut between EP0DATADONE event and EP0STATUS task\n\nValue on reset: 0"]
148#[derive(Clone, Copy, Debug, PartialEq)]
149pub enum EP0DATADONE_EP0STATUS_A {
150    #[doc = "0: Disable shortcut"]
151    DISABLED = 0,
152    #[doc = "1: Enable shortcut"]
153    ENABLED = 1,
154}
155impl From<EP0DATADONE_EP0STATUS_A> for bool {
156    #[inline(always)]
157    fn from(variant: EP0DATADONE_EP0STATUS_A) -> Self {
158        variant as u8 != 0
159    }
160}
161impl EP0DATADONE_EP0STATUS_R {
162    #[doc = "Get enumerated values variant"]
163    #[inline(always)]
164    pub fn variant(&self) -> EP0DATADONE_EP0STATUS_A {
165        match self.bits {
166            false => EP0DATADONE_EP0STATUS_A::DISABLED,
167            true => EP0DATADONE_EP0STATUS_A::ENABLED,
168        }
169    }
170    #[doc = "Checks if the value of the field is `DISABLED`"]
171    #[inline(always)]
172    pub fn is_disabled(&self) -> bool {
173        *self == EP0DATADONE_EP0STATUS_A::DISABLED
174    }
175    #[doc = "Checks if the value of the field is `ENABLED`"]
176    #[inline(always)]
177    pub fn is_enabled(&self) -> bool {
178        *self == EP0DATADONE_EP0STATUS_A::ENABLED
179    }
180}
181#[doc = "Field `EP0DATADONE_EP0STATUS` writer - Shortcut between EP0DATADONE event and EP0STATUS task"]
182pub type EP0DATADONE_EP0STATUS_W<'a, const O: u8> =
183    crate::BitWriter<'a, u32, SHORTS_SPEC, EP0DATADONE_EP0STATUS_A, O>;
184impl<'a, const O: u8> EP0DATADONE_EP0STATUS_W<'a, O> {
185    #[doc = "Disable shortcut"]
186    #[inline(always)]
187    pub fn disabled(self) -> &'a mut W {
188        self.variant(EP0DATADONE_EP0STATUS_A::DISABLED)
189    }
190    #[doc = "Enable shortcut"]
191    #[inline(always)]
192    pub fn enabled(self) -> &'a mut W {
193        self.variant(EP0DATADONE_EP0STATUS_A::ENABLED)
194    }
195}
196#[doc = "Field `ENDEPOUT0_EP0STATUS` reader - Shortcut between ENDEPOUT\\[0\\]
197event and EP0STATUS task"]
198pub type ENDEPOUT0_EP0STATUS_R = crate::BitReader<ENDEPOUT0_EP0STATUS_A>;
199#[doc = "Shortcut between ENDEPOUT\\[0\\]
200event and EP0STATUS task\n\nValue on reset: 0"]
201#[derive(Clone, Copy, Debug, PartialEq)]
202pub enum ENDEPOUT0_EP0STATUS_A {
203    #[doc = "0: Disable shortcut"]
204    DISABLED = 0,
205    #[doc = "1: Enable shortcut"]
206    ENABLED = 1,
207}
208impl From<ENDEPOUT0_EP0STATUS_A> for bool {
209    #[inline(always)]
210    fn from(variant: ENDEPOUT0_EP0STATUS_A) -> Self {
211        variant as u8 != 0
212    }
213}
214impl ENDEPOUT0_EP0STATUS_R {
215    #[doc = "Get enumerated values variant"]
216    #[inline(always)]
217    pub fn variant(&self) -> ENDEPOUT0_EP0STATUS_A {
218        match self.bits {
219            false => ENDEPOUT0_EP0STATUS_A::DISABLED,
220            true => ENDEPOUT0_EP0STATUS_A::ENABLED,
221        }
222    }
223    #[doc = "Checks if the value of the field is `DISABLED`"]
224    #[inline(always)]
225    pub fn is_disabled(&self) -> bool {
226        *self == ENDEPOUT0_EP0STATUS_A::DISABLED
227    }
228    #[doc = "Checks if the value of the field is `ENABLED`"]
229    #[inline(always)]
230    pub fn is_enabled(&self) -> bool {
231        *self == ENDEPOUT0_EP0STATUS_A::ENABLED
232    }
233}
234#[doc = "Field `ENDEPOUT0_EP0STATUS` writer - Shortcut between ENDEPOUT\\[0\\]
235event and EP0STATUS task"]
236pub type ENDEPOUT0_EP0STATUS_W<'a, const O: u8> =
237    crate::BitWriter<'a, u32, SHORTS_SPEC, ENDEPOUT0_EP0STATUS_A, O>;
238impl<'a, const O: u8> ENDEPOUT0_EP0STATUS_W<'a, O> {
239    #[doc = "Disable shortcut"]
240    #[inline(always)]
241    pub fn disabled(self) -> &'a mut W {
242        self.variant(ENDEPOUT0_EP0STATUS_A::DISABLED)
243    }
244    #[doc = "Enable shortcut"]
245    #[inline(always)]
246    pub fn enabled(self) -> &'a mut W {
247        self.variant(ENDEPOUT0_EP0STATUS_A::ENABLED)
248    }
249}
250#[doc = "Field `ENDEPOUT0_EP0RCVOUT` reader - Shortcut between ENDEPOUT\\[0\\]
251event and EP0RCVOUT task"]
252pub type ENDEPOUT0_EP0RCVOUT_R = crate::BitReader<ENDEPOUT0_EP0RCVOUT_A>;
253#[doc = "Shortcut between ENDEPOUT\\[0\\]
254event and EP0RCVOUT task\n\nValue on reset: 0"]
255#[derive(Clone, Copy, Debug, PartialEq)]
256pub enum ENDEPOUT0_EP0RCVOUT_A {
257    #[doc = "0: Disable shortcut"]
258    DISABLED = 0,
259    #[doc = "1: Enable shortcut"]
260    ENABLED = 1,
261}
262impl From<ENDEPOUT0_EP0RCVOUT_A> for bool {
263    #[inline(always)]
264    fn from(variant: ENDEPOUT0_EP0RCVOUT_A) -> Self {
265        variant as u8 != 0
266    }
267}
268impl ENDEPOUT0_EP0RCVOUT_R {
269    #[doc = "Get enumerated values variant"]
270    #[inline(always)]
271    pub fn variant(&self) -> ENDEPOUT0_EP0RCVOUT_A {
272        match self.bits {
273            false => ENDEPOUT0_EP0RCVOUT_A::DISABLED,
274            true => ENDEPOUT0_EP0RCVOUT_A::ENABLED,
275        }
276    }
277    #[doc = "Checks if the value of the field is `DISABLED`"]
278    #[inline(always)]
279    pub fn is_disabled(&self) -> bool {
280        *self == ENDEPOUT0_EP0RCVOUT_A::DISABLED
281    }
282    #[doc = "Checks if the value of the field is `ENABLED`"]
283    #[inline(always)]
284    pub fn is_enabled(&self) -> bool {
285        *self == ENDEPOUT0_EP0RCVOUT_A::ENABLED
286    }
287}
288#[doc = "Field `ENDEPOUT0_EP0RCVOUT` writer - Shortcut between ENDEPOUT\\[0\\]
289event and EP0RCVOUT task"]
290pub type ENDEPOUT0_EP0RCVOUT_W<'a, const O: u8> =
291    crate::BitWriter<'a, u32, SHORTS_SPEC, ENDEPOUT0_EP0RCVOUT_A, O>;
292impl<'a, const O: u8> ENDEPOUT0_EP0RCVOUT_W<'a, O> {
293    #[doc = "Disable shortcut"]
294    #[inline(always)]
295    pub fn disabled(self) -> &'a mut W {
296        self.variant(ENDEPOUT0_EP0RCVOUT_A::DISABLED)
297    }
298    #[doc = "Enable shortcut"]
299    #[inline(always)]
300    pub fn enabled(self) -> &'a mut W {
301        self.variant(ENDEPOUT0_EP0RCVOUT_A::ENABLED)
302    }
303}
304impl R {
305    #[doc = "Bit 0 - Shortcut between EP0DATADONE event and STARTEPIN\\[0\\]
306task"]
307    #[inline(always)]
308    pub fn ep0datadone_startepin0(&self) -> EP0DATADONE_STARTEPIN0_R {
309        EP0DATADONE_STARTEPIN0_R::new((self.bits & 1) != 0)
310    }
311    #[doc = "Bit 1 - Shortcut between EP0DATADONE event and STARTEPOUT\\[0\\]
312task"]
313    #[inline(always)]
314    pub fn ep0datadone_startepout0(&self) -> EP0DATADONE_STARTEPOUT0_R {
315        EP0DATADONE_STARTEPOUT0_R::new(((self.bits >> 1) & 1) != 0)
316    }
317    #[doc = "Bit 2 - Shortcut between EP0DATADONE event and EP0STATUS task"]
318    #[inline(always)]
319    pub fn ep0datadone_ep0status(&self) -> EP0DATADONE_EP0STATUS_R {
320        EP0DATADONE_EP0STATUS_R::new(((self.bits >> 2) & 1) != 0)
321    }
322    #[doc = "Bit 3 - Shortcut between ENDEPOUT\\[0\\]
323event and EP0STATUS task"]
324    #[inline(always)]
325    pub fn endepout0_ep0status(&self) -> ENDEPOUT0_EP0STATUS_R {
326        ENDEPOUT0_EP0STATUS_R::new(((self.bits >> 3) & 1) != 0)
327    }
328    #[doc = "Bit 4 - Shortcut between ENDEPOUT\\[0\\]
329event and EP0RCVOUT task"]
330    #[inline(always)]
331    pub fn endepout0_ep0rcvout(&self) -> ENDEPOUT0_EP0RCVOUT_R {
332        ENDEPOUT0_EP0RCVOUT_R::new(((self.bits >> 4) & 1) != 0)
333    }
334}
335impl W {
336    #[doc = "Bit 0 - Shortcut between EP0DATADONE event and STARTEPIN\\[0\\]
337task"]
338    #[inline(always)]
339    pub fn ep0datadone_startepin0(&mut self) -> EP0DATADONE_STARTEPIN0_W<0> {
340        EP0DATADONE_STARTEPIN0_W::new(self)
341    }
342    #[doc = "Bit 1 - Shortcut between EP0DATADONE event and STARTEPOUT\\[0\\]
343task"]
344    #[inline(always)]
345    pub fn ep0datadone_startepout0(&mut self) -> EP0DATADONE_STARTEPOUT0_W<1> {
346        EP0DATADONE_STARTEPOUT0_W::new(self)
347    }
348    #[doc = "Bit 2 - Shortcut between EP0DATADONE event and EP0STATUS task"]
349    #[inline(always)]
350    pub fn ep0datadone_ep0status(&mut self) -> EP0DATADONE_EP0STATUS_W<2> {
351        EP0DATADONE_EP0STATUS_W::new(self)
352    }
353    #[doc = "Bit 3 - Shortcut between ENDEPOUT\\[0\\]
354event and EP0STATUS task"]
355    #[inline(always)]
356    pub fn endepout0_ep0status(&mut self) -> ENDEPOUT0_EP0STATUS_W<3> {
357        ENDEPOUT0_EP0STATUS_W::new(self)
358    }
359    #[doc = "Bit 4 - Shortcut between ENDEPOUT\\[0\\]
360event and EP0RCVOUT task"]
361    #[inline(always)]
362    pub fn endepout0_ep0rcvout(&mut self) -> ENDEPOUT0_EP0RCVOUT_W<4> {
363        ENDEPOUT0_EP0RCVOUT_W::new(self)
364    }
365    #[doc = "Writes raw bits to the register."]
366    #[inline(always)]
367    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
368        self.0.bits(bits);
369        self
370    }
371}
372#[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"]
373pub struct SHORTS_SPEC;
374impl crate::RegisterSpec for SHORTS_SPEC {
375    type Ux = u32;
376}
377#[doc = "`read()` method returns [shorts::R](R) reader structure"]
378impl crate::Readable for SHORTS_SPEC {
379    type Reader = R;
380}
381#[doc = "`write(|w| ..)` method takes [shorts::W](W) writer structure"]
382impl crate::Writable for SHORTS_SPEC {
383    type Writer = W;
384}
385#[doc = "`reset()` method sets SHORTS to value 0"]
386impl crate::Resettable for SHORTS_SPEC {
387    #[inline(always)]
388    fn reset_value() -> Self::Ux {
389        0
390    }
391}