1#[doc = "Reader of register RXTYPE3"]
2pub type R = crate::R<u8, super::RXTYPE3>;
3#[doc = "Writer for register RXTYPE3"]
4pub type W = crate::W<u8, super::RXTYPE3>;
5#[doc = "Register RXTYPE3 `reset()`'s with value 0"]
6impl crate::ResetValue for super::RXTYPE3 {
7 type Type = u8;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `TEP`"]
14pub type TEP_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `TEP`"]
16pub struct TEP_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> TEP_W<'a> {
20 #[doc = r"Writes raw bits to the field"]
21 #[inline(always)]
22 pub unsafe fn bits(self, value: u8) -> &'a mut W {
23 self.w.bits = (self.w.bits & !0x0f) | ((value as u8) & 0x0f);
24 self.w
25 }
26}
27#[doc = "Protocol\n\nValue on reset: 0"]
28#[derive(Clone, Copy, Debug, PartialEq)]
29#[repr(u8)]
30pub enum PROTO_A {
31 #[doc = "0: Control"]
32 CTRL = 0,
33 #[doc = "1: Isochronous"]
34 ISOC = 1,
35 #[doc = "2: Bulk"]
36 BULK = 2,
37 #[doc = "3: Interrupt"]
38 INT = 3,
39}
40impl From<PROTO_A> for u8 {
41 #[inline(always)]
42 fn from(variant: PROTO_A) -> Self {
43 variant as _
44 }
45}
46#[doc = "Reader of field `PROTO`"]
47pub type PROTO_R = crate::R<u8, PROTO_A>;
48impl PROTO_R {
49 #[doc = r"Get enumerated values variant"]
50 #[inline(always)]
51 pub fn variant(&self) -> PROTO_A {
52 match self.bits {
53 0 => PROTO_A::CTRL,
54 1 => PROTO_A::ISOC,
55 2 => PROTO_A::BULK,
56 3 => PROTO_A::INT,
57 _ => unreachable!(),
58 }
59 }
60 #[doc = "Checks if the value of the field is `CTRL`"]
61 #[inline(always)]
62 pub fn is_ctrl(&self) -> bool {
63 *self == PROTO_A::CTRL
64 }
65 #[doc = "Checks if the value of the field is `ISOC`"]
66 #[inline(always)]
67 pub fn is_isoc(&self) -> bool {
68 *self == PROTO_A::ISOC
69 }
70 #[doc = "Checks if the value of the field is `BULK`"]
71 #[inline(always)]
72 pub fn is_bulk(&self) -> bool {
73 *self == PROTO_A::BULK
74 }
75 #[doc = "Checks if the value of the field is `INT`"]
76 #[inline(always)]
77 pub fn is_int(&self) -> bool {
78 *self == PROTO_A::INT
79 }
80}
81#[doc = "Write proxy for field `PROTO`"]
82pub struct PROTO_W<'a> {
83 w: &'a mut W,
84}
85impl<'a> PROTO_W<'a> {
86 #[doc = r"Writes `variant` to the field"]
87 #[inline(always)]
88 pub fn variant(self, variant: PROTO_A) -> &'a mut W {
89 {
90 self.bits(variant.into())
91 }
92 }
93 #[doc = "Control"]
94 #[inline(always)]
95 pub fn ctrl(self) -> &'a mut W {
96 self.variant(PROTO_A::CTRL)
97 }
98 #[doc = "Isochronous"]
99 #[inline(always)]
100 pub fn isoc(self) -> &'a mut W {
101 self.variant(PROTO_A::ISOC)
102 }
103 #[doc = "Bulk"]
104 #[inline(always)]
105 pub fn bulk(self) -> &'a mut W {
106 self.variant(PROTO_A::BULK)
107 }
108 #[doc = "Interrupt"]
109 #[inline(always)]
110 pub fn int(self) -> &'a mut W {
111 self.variant(PROTO_A::INT)
112 }
113 #[doc = r"Writes raw bits to the field"]
114 #[inline(always)]
115 pub fn bits(self, value: u8) -> &'a mut W {
116 self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u8) & 0x03) << 4);
117 self.w
118 }
119}
120#[doc = "Operating Speed\n\nValue on reset: 0"]
121#[derive(Clone, Copy, Debug, PartialEq)]
122#[repr(u8)]
123pub enum SPEED_A {
124 #[doc = "0: Default"]
125 DFLT = 0,
126 #[doc = "2: Full"]
127 FULL = 2,
128 #[doc = "3: Low"]
129 LOW = 3,
130}
131impl From<SPEED_A> for u8 {
132 #[inline(always)]
133 fn from(variant: SPEED_A) -> Self {
134 variant as _
135 }
136}
137#[doc = "Reader of field `SPEED`"]
138pub type SPEED_R = crate::R<u8, SPEED_A>;
139impl SPEED_R {
140 #[doc = r"Get enumerated values variant"]
141 #[inline(always)]
142 pub fn variant(&self) -> crate::Variant<u8, SPEED_A> {
143 use crate::Variant::*;
144 match self.bits {
145 0 => Val(SPEED_A::DFLT),
146 2 => Val(SPEED_A::FULL),
147 3 => Val(SPEED_A::LOW),
148 i => Res(i),
149 }
150 }
151 #[doc = "Checks if the value of the field is `DFLT`"]
152 #[inline(always)]
153 pub fn is_dflt(&self) -> bool {
154 *self == SPEED_A::DFLT
155 }
156 #[doc = "Checks if the value of the field is `FULL`"]
157 #[inline(always)]
158 pub fn is_full(&self) -> bool {
159 *self == SPEED_A::FULL
160 }
161 #[doc = "Checks if the value of the field is `LOW`"]
162 #[inline(always)]
163 pub fn is_low(&self) -> bool {
164 *self == SPEED_A::LOW
165 }
166}
167#[doc = "Write proxy for field `SPEED`"]
168pub struct SPEED_W<'a> {
169 w: &'a mut W,
170}
171impl<'a> SPEED_W<'a> {
172 #[doc = r"Writes `variant` to the field"]
173 #[inline(always)]
174 pub fn variant(self, variant: SPEED_A) -> &'a mut W {
175 unsafe { self.bits(variant.into()) }
176 }
177 #[doc = "Default"]
178 #[inline(always)]
179 pub fn dflt(self) -> &'a mut W {
180 self.variant(SPEED_A::DFLT)
181 }
182 #[doc = "Full"]
183 #[inline(always)]
184 pub fn full(self) -> &'a mut W {
185 self.variant(SPEED_A::FULL)
186 }
187 #[doc = "Low"]
188 #[inline(always)]
189 pub fn low(self) -> &'a mut W {
190 self.variant(SPEED_A::LOW)
191 }
192 #[doc = r"Writes raw bits to the field"]
193 #[inline(always)]
194 pub unsafe fn bits(self, value: u8) -> &'a mut W {
195 self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u8) & 0x03) << 6);
196 self.w
197 }
198}
199impl R {
200 #[doc = "Bits 0:3 - Target Endpoint Number"]
201 #[inline(always)]
202 pub fn tep(&self) -> TEP_R {
203 TEP_R::new((self.bits & 0x0f) as u8)
204 }
205 #[doc = "Bits 4:5 - Protocol"]
206 #[inline(always)]
207 pub fn proto(&self) -> PROTO_R {
208 PROTO_R::new(((self.bits >> 4) & 0x03) as u8)
209 }
210 #[doc = "Bits 6:7 - Operating Speed"]
211 #[inline(always)]
212 pub fn speed(&self) -> SPEED_R {
213 SPEED_R::new(((self.bits >> 6) & 0x03) as u8)
214 }
215}
216impl W {
217 #[doc = "Bits 0:3 - Target Endpoint Number"]
218 #[inline(always)]
219 pub fn tep(&mut self) -> TEP_W {
220 TEP_W { w: self }
221 }
222 #[doc = "Bits 4:5 - Protocol"]
223 #[inline(always)]
224 pub fn proto(&mut self) -> PROTO_W {
225 PROTO_W { w: self }
226 }
227 #[doc = "Bits 6:7 - Operating Speed"]
228 #[inline(always)]
229 pub fn speed(&mut self) -> SPEED_W {
230 SPEED_W { w: self }
231 }
232}