nrf52840_pac/usbd/
brequest.rs
1#[doc = "Register `BREQUEST` reader"]
2pub struct R(crate::R<BREQUEST_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<BREQUEST_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<BREQUEST_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<BREQUEST_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `BREQUEST` reader - SETUP data, byte 1, bRequest. Values provided for standard requests only, user must implement class and vendor values."]
17pub type BREQUEST_R = crate::FieldReader<u8, BREQUEST_A>;
18#[doc = "SETUP data, byte 1, bRequest. Values provided for standard requests only, user must implement class and vendor values.\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq)]
20#[repr(u8)]
21pub enum BREQUEST_A {
22 #[doc = "0: Standard request GET_STATUS"]
23 STD_GET_STATUS = 0,
24 #[doc = "1: Standard request CLEAR_FEATURE"]
25 STD_CLEAR_FEATURE = 1,
26 #[doc = "3: Standard request SET_FEATURE"]
27 STD_SET_FEATURE = 3,
28 #[doc = "5: Standard request SET_ADDRESS"]
29 STD_SET_ADDRESS = 5,
30 #[doc = "6: Standard request GET_DESCRIPTOR"]
31 STD_GET_DESCRIPTOR = 6,
32 #[doc = "7: Standard request SET_DESCRIPTOR"]
33 STD_SET_DESCRIPTOR = 7,
34 #[doc = "8: Standard request GET_CONFIGURATION"]
35 STD_GET_CONFIGURATION = 8,
36 #[doc = "9: Standard request SET_CONFIGURATION"]
37 STD_SET_CONFIGURATION = 9,
38 #[doc = "10: Standard request GET_INTERFACE"]
39 STD_GET_INTERFACE = 10,
40 #[doc = "11: Standard request SET_INTERFACE"]
41 STD_SET_INTERFACE = 11,
42 #[doc = "12: Standard request SYNCH_FRAME"]
43 STD_SYNCH_FRAME = 12,
44}
45impl From<BREQUEST_A> for u8 {
46 #[inline(always)]
47 fn from(variant: BREQUEST_A) -> Self {
48 variant as _
49 }
50}
51impl BREQUEST_R {
52 #[doc = "Get enumerated values variant"]
53 #[inline(always)]
54 pub fn variant(&self) -> Option<BREQUEST_A> {
55 match self.bits {
56 0 => Some(BREQUEST_A::STD_GET_STATUS),
57 1 => Some(BREQUEST_A::STD_CLEAR_FEATURE),
58 3 => Some(BREQUEST_A::STD_SET_FEATURE),
59 5 => Some(BREQUEST_A::STD_SET_ADDRESS),
60 6 => Some(BREQUEST_A::STD_GET_DESCRIPTOR),
61 7 => Some(BREQUEST_A::STD_SET_DESCRIPTOR),
62 8 => Some(BREQUEST_A::STD_GET_CONFIGURATION),
63 9 => Some(BREQUEST_A::STD_SET_CONFIGURATION),
64 10 => Some(BREQUEST_A::STD_GET_INTERFACE),
65 11 => Some(BREQUEST_A::STD_SET_INTERFACE),
66 12 => Some(BREQUEST_A::STD_SYNCH_FRAME),
67 _ => None,
68 }
69 }
70 #[doc = "Checks if the value of the field is `STD_GET_STATUS`"]
71 #[inline(always)]
72 pub fn is_std_get_status(&self) -> bool {
73 *self == BREQUEST_A::STD_GET_STATUS
74 }
75 #[doc = "Checks if the value of the field is `STD_CLEAR_FEATURE`"]
76 #[inline(always)]
77 pub fn is_std_clear_feature(&self) -> bool {
78 *self == BREQUEST_A::STD_CLEAR_FEATURE
79 }
80 #[doc = "Checks if the value of the field is `STD_SET_FEATURE`"]
81 #[inline(always)]
82 pub fn is_std_set_feature(&self) -> bool {
83 *self == BREQUEST_A::STD_SET_FEATURE
84 }
85 #[doc = "Checks if the value of the field is `STD_SET_ADDRESS`"]
86 #[inline(always)]
87 pub fn is_std_set_address(&self) -> bool {
88 *self == BREQUEST_A::STD_SET_ADDRESS
89 }
90 #[doc = "Checks if the value of the field is `STD_GET_DESCRIPTOR`"]
91 #[inline(always)]
92 pub fn is_std_get_descriptor(&self) -> bool {
93 *self == BREQUEST_A::STD_GET_DESCRIPTOR
94 }
95 #[doc = "Checks if the value of the field is `STD_SET_DESCRIPTOR`"]
96 #[inline(always)]
97 pub fn is_std_set_descriptor(&self) -> bool {
98 *self == BREQUEST_A::STD_SET_DESCRIPTOR
99 }
100 #[doc = "Checks if the value of the field is `STD_GET_CONFIGURATION`"]
101 #[inline(always)]
102 pub fn is_std_get_configuration(&self) -> bool {
103 *self == BREQUEST_A::STD_GET_CONFIGURATION
104 }
105 #[doc = "Checks if the value of the field is `STD_SET_CONFIGURATION`"]
106 #[inline(always)]
107 pub fn is_std_set_configuration(&self) -> bool {
108 *self == BREQUEST_A::STD_SET_CONFIGURATION
109 }
110 #[doc = "Checks if the value of the field is `STD_GET_INTERFACE`"]
111 #[inline(always)]
112 pub fn is_std_get_interface(&self) -> bool {
113 *self == BREQUEST_A::STD_GET_INTERFACE
114 }
115 #[doc = "Checks if the value of the field is `STD_SET_INTERFACE`"]
116 #[inline(always)]
117 pub fn is_std_set_interface(&self) -> bool {
118 *self == BREQUEST_A::STD_SET_INTERFACE
119 }
120 #[doc = "Checks if the value of the field is `STD_SYNCH_FRAME`"]
121 #[inline(always)]
122 pub fn is_std_synch_frame(&self) -> bool {
123 *self == BREQUEST_A::STD_SYNCH_FRAME
124 }
125}
126impl R {
127 #[doc = "Bits 0:7 - SETUP data, byte 1, bRequest. Values provided for standard requests only, user must implement class and vendor values."]
128 #[inline(always)]
129 pub fn brequest(&self) -> BREQUEST_R {
130 BREQUEST_R::new((self.bits & 0xff) as u8)
131 }
132}
133#[doc = "SETUP data, byte 1, bRequest\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [brequest](index.html) module"]
134pub struct BREQUEST_SPEC;
135impl crate::RegisterSpec for BREQUEST_SPEC {
136 type Ux = u32;
137}
138#[doc = "`read()` method returns [brequest::R](R) reader structure"]
139impl crate::Readable for BREQUEST_SPEC {
140 type Reader = R;
141}
142#[doc = "`reset()` method sets BREQUEST to value 0"]
143impl crate::Resettable for BREQUEST_SPEC {
144 #[inline(always)]
145 fn reset_value() -> Self::Ux {
146 0
147 }
148}