1#[doc = "Register `UPCFG2` reader"]
2pub struct R(crate::R<UPCFG2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<UPCFG2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<UPCFG2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<UPCFG2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `UPCFG2` writer"]
17pub struct W(crate::W<UPCFG2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<UPCFG2_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<UPCFG2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<UPCFG2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `PBK` reader - Pipe Banks"]
38pub type PBK_R = crate::BitReader<PBKSELECT_A>;
39#[doc = "Pipe Banks\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum PBKSELECT_A {
42 #[doc = "0: `0`"]
43 SINGLE = 0,
44 #[doc = "1: `1`"]
45 DOUBLE = 1,
46}
47impl From<PBKSELECT_A> for bool {
48 #[inline(always)]
49 fn from(variant: PBKSELECT_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl PBK_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> PBKSELECT_A {
57 match self.bits {
58 false => PBKSELECT_A::SINGLE,
59 true => PBKSELECT_A::DOUBLE,
60 }
61 }
62 #[doc = "Checks if the value of the field is `SINGLE`"]
63 #[inline(always)]
64 pub fn is_single(&self) -> bool {
65 *self == PBKSELECT_A::SINGLE
66 }
67 #[doc = "Checks if the value of the field is `DOUBLE`"]
68 #[inline(always)]
69 pub fn is_double(&self) -> bool {
70 *self == PBKSELECT_A::DOUBLE
71 }
72}
73#[doc = "Field `PBK` writer - Pipe Banks"]
74pub type PBK_W<'a, const O: u8> = crate::BitWriter<'a, u32, UPCFG2_SPEC, PBKSELECT_A, O>;
75impl<'a, const O: u8> PBK_W<'a, O> {
76 #[doc = "`0`"]
77 #[inline(always)]
78 pub fn single(self) -> &'a mut W {
79 self.variant(PBKSELECT_A::SINGLE)
80 }
81 #[doc = "`1`"]
82 #[inline(always)]
83 pub fn double(self) -> &'a mut W {
84 self.variant(PBKSELECT_A::DOUBLE)
85 }
86}
87#[doc = "Field `PSIZE` reader - Pipe Size"]
88pub type PSIZE_R = crate::FieldReader<u8, PSIZESELECT_A>;
89#[doc = "Pipe Size\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91#[repr(u8)]
92pub enum PSIZESELECT_A {
93 #[doc = "0: `0`"]
94 _8 = 0,
95 #[doc = "1: `1`"]
96 _16 = 1,
97 #[doc = "2: `10`"]
98 _32 = 2,
99 #[doc = "3: `11`"]
100 _64 = 3,
101 #[doc = "4: `100`"]
102 _128 = 4,
103 #[doc = "5: `101`"]
104 _256 = 5,
105 #[doc = "6: `110`"]
106 _512 = 6,
107 #[doc = "7: `111`"]
108 _1024 = 7,
109}
110impl From<PSIZESELECT_A> for u8 {
111 #[inline(always)]
112 fn from(variant: PSIZESELECT_A) -> Self {
113 variant as _
114 }
115}
116impl PSIZE_R {
117 #[doc = "Get enumerated values variant"]
118 #[inline(always)]
119 pub fn variant(&self) -> PSIZESELECT_A {
120 match self.bits {
121 0 => PSIZESELECT_A::_8,
122 1 => PSIZESELECT_A::_16,
123 2 => PSIZESELECT_A::_32,
124 3 => PSIZESELECT_A::_64,
125 4 => PSIZESELECT_A::_128,
126 5 => PSIZESELECT_A::_256,
127 6 => PSIZESELECT_A::_512,
128 7 => PSIZESELECT_A::_1024,
129 _ => unreachable!(),
130 }
131 }
132 #[doc = "Checks if the value of the field is `_8`"]
133 #[inline(always)]
134 pub fn is_8(&self) -> bool {
135 *self == PSIZESELECT_A::_8
136 }
137 #[doc = "Checks if the value of the field is `_16`"]
138 #[inline(always)]
139 pub fn is_16(&self) -> bool {
140 *self == PSIZESELECT_A::_16
141 }
142 #[doc = "Checks if the value of the field is `_32`"]
143 #[inline(always)]
144 pub fn is_32(&self) -> bool {
145 *self == PSIZESELECT_A::_32
146 }
147 #[doc = "Checks if the value of the field is `_64`"]
148 #[inline(always)]
149 pub fn is_64(&self) -> bool {
150 *self == PSIZESELECT_A::_64
151 }
152 #[doc = "Checks if the value of the field is `_128`"]
153 #[inline(always)]
154 pub fn is_128(&self) -> bool {
155 *self == PSIZESELECT_A::_128
156 }
157 #[doc = "Checks if the value of the field is `_256`"]
158 #[inline(always)]
159 pub fn is_256(&self) -> bool {
160 *self == PSIZESELECT_A::_256
161 }
162 #[doc = "Checks if the value of the field is `_512`"]
163 #[inline(always)]
164 pub fn is_512(&self) -> bool {
165 *self == PSIZESELECT_A::_512
166 }
167 #[doc = "Checks if the value of the field is `_1024`"]
168 #[inline(always)]
169 pub fn is_1024(&self) -> bool {
170 *self == PSIZESELECT_A::_1024
171 }
172}
173#[doc = "Field `PSIZE` writer - Pipe Size"]
174pub type PSIZE_W<'a, const O: u8> =
175 crate::FieldWriterSafe<'a, u32, UPCFG2_SPEC, u8, PSIZESELECT_A, 3, O>;
176impl<'a, const O: u8> PSIZE_W<'a, O> {
177 #[doc = "`0`"]
178 #[inline(always)]
179 pub fn _8(self) -> &'a mut W {
180 self.variant(PSIZESELECT_A::_8)
181 }
182 #[doc = "`1`"]
183 #[inline(always)]
184 pub fn _16(self) -> &'a mut W {
185 self.variant(PSIZESELECT_A::_16)
186 }
187 #[doc = "`10`"]
188 #[inline(always)]
189 pub fn _32(self) -> &'a mut W {
190 self.variant(PSIZESELECT_A::_32)
191 }
192 #[doc = "`11`"]
193 #[inline(always)]
194 pub fn _64(self) -> &'a mut W {
195 self.variant(PSIZESELECT_A::_64)
196 }
197 #[doc = "`100`"]
198 #[inline(always)]
199 pub fn _128(self) -> &'a mut W {
200 self.variant(PSIZESELECT_A::_128)
201 }
202 #[doc = "`101`"]
203 #[inline(always)]
204 pub fn _256(self) -> &'a mut W {
205 self.variant(PSIZESELECT_A::_256)
206 }
207 #[doc = "`110`"]
208 #[inline(always)]
209 pub fn _512(self) -> &'a mut W {
210 self.variant(PSIZESELECT_A::_512)
211 }
212 #[doc = "`111`"]
213 #[inline(always)]
214 pub fn _1024(self) -> &'a mut W {
215 self.variant(PSIZESELECT_A::_1024)
216 }
217}
218#[doc = "Field `PTOKEN` reader - Pipe Token"]
219pub type PTOKEN_R = crate::FieldReader<u8, PTOKENSELECT_A>;
220#[doc = "Pipe Token\n\nValue on reset: 0"]
221#[derive(Clone, Copy, Debug, PartialEq, Eq)]
222#[repr(u8)]
223pub enum PTOKENSELECT_A {
224 #[doc = "0: `0`"]
225 SETUP = 0,
226 #[doc = "1: `1`"]
227 IN = 1,
228 #[doc = "2: `10`"]
229 OUT = 2,
230}
231impl From<PTOKENSELECT_A> for u8 {
232 #[inline(always)]
233 fn from(variant: PTOKENSELECT_A) -> Self {
234 variant as _
235 }
236}
237impl PTOKEN_R {
238 #[doc = "Get enumerated values variant"]
239 #[inline(always)]
240 pub fn variant(&self) -> Option<PTOKENSELECT_A> {
241 match self.bits {
242 0 => Some(PTOKENSELECT_A::SETUP),
243 1 => Some(PTOKENSELECT_A::IN),
244 2 => Some(PTOKENSELECT_A::OUT),
245 _ => None,
246 }
247 }
248 #[doc = "Checks if the value of the field is `SETUP`"]
249 #[inline(always)]
250 pub fn is_setup(&self) -> bool {
251 *self == PTOKENSELECT_A::SETUP
252 }
253 #[doc = "Checks if the value of the field is `IN`"]
254 #[inline(always)]
255 pub fn is_in(&self) -> bool {
256 *self == PTOKENSELECT_A::IN
257 }
258 #[doc = "Checks if the value of the field is `OUT`"]
259 #[inline(always)]
260 pub fn is_out(&self) -> bool {
261 *self == PTOKENSELECT_A::OUT
262 }
263}
264#[doc = "Field `PTOKEN` writer - Pipe Token"]
265pub type PTOKEN_W<'a, const O: u8> =
266 crate::FieldWriter<'a, u32, UPCFG2_SPEC, u8, PTOKENSELECT_A, 2, O>;
267impl<'a, const O: u8> PTOKEN_W<'a, O> {
268 #[doc = "`0`"]
269 #[inline(always)]
270 pub fn setup(self) -> &'a mut W {
271 self.variant(PTOKENSELECT_A::SETUP)
272 }
273 #[doc = "`1`"]
274 #[inline(always)]
275 pub fn in_(self) -> &'a mut W {
276 self.variant(PTOKENSELECT_A::IN)
277 }
278 #[doc = "`10`"]
279 #[inline(always)]
280 pub fn out(self) -> &'a mut W {
281 self.variant(PTOKENSELECT_A::OUT)
282 }
283}
284#[doc = "Field `PTYPE` reader - Pipe Type"]
285pub type PTYPE_R = crate::FieldReader<u8, PTYPESELECT_A>;
286#[doc = "Pipe Type\n\nValue on reset: 0"]
287#[derive(Clone, Copy, Debug, PartialEq, Eq)]
288#[repr(u8)]
289pub enum PTYPESELECT_A {
290 #[doc = "0: `0`"]
291 CONTROL = 0,
292 #[doc = "1: `1`"]
293 ISOCHRONOUS = 1,
294 #[doc = "2: `10`"]
295 BULK = 2,
296 #[doc = "3: `11`"]
297 INTERRUPT = 3,
298}
299impl From<PTYPESELECT_A> for u8 {
300 #[inline(always)]
301 fn from(variant: PTYPESELECT_A) -> Self {
302 variant as _
303 }
304}
305impl PTYPE_R {
306 #[doc = "Get enumerated values variant"]
307 #[inline(always)]
308 pub fn variant(&self) -> PTYPESELECT_A {
309 match self.bits {
310 0 => PTYPESELECT_A::CONTROL,
311 1 => PTYPESELECT_A::ISOCHRONOUS,
312 2 => PTYPESELECT_A::BULK,
313 3 => PTYPESELECT_A::INTERRUPT,
314 _ => unreachable!(),
315 }
316 }
317 #[doc = "Checks if the value of the field is `CONTROL`"]
318 #[inline(always)]
319 pub fn is_control(&self) -> bool {
320 *self == PTYPESELECT_A::CONTROL
321 }
322 #[doc = "Checks if the value of the field is `ISOCHRONOUS`"]
323 #[inline(always)]
324 pub fn is_isochronous(&self) -> bool {
325 *self == PTYPESELECT_A::ISOCHRONOUS
326 }
327 #[doc = "Checks if the value of the field is `BULK`"]
328 #[inline(always)]
329 pub fn is_bulk(&self) -> bool {
330 *self == PTYPESELECT_A::BULK
331 }
332 #[doc = "Checks if the value of the field is `INTERRUPT`"]
333 #[inline(always)]
334 pub fn is_interrupt(&self) -> bool {
335 *self == PTYPESELECT_A::INTERRUPT
336 }
337}
338#[doc = "Field `PTYPE` writer - Pipe Type"]
339pub type PTYPE_W<'a, const O: u8> =
340 crate::FieldWriterSafe<'a, u32, UPCFG2_SPEC, u8, PTYPESELECT_A, 2, O>;
341impl<'a, const O: u8> PTYPE_W<'a, O> {
342 #[doc = "`0`"]
343 #[inline(always)]
344 pub fn control(self) -> &'a mut W {
345 self.variant(PTYPESELECT_A::CONTROL)
346 }
347 #[doc = "`1`"]
348 #[inline(always)]
349 pub fn isochronous(self) -> &'a mut W {
350 self.variant(PTYPESELECT_A::ISOCHRONOUS)
351 }
352 #[doc = "`10`"]
353 #[inline(always)]
354 pub fn bulk(self) -> &'a mut W {
355 self.variant(PTYPESELECT_A::BULK)
356 }
357 #[doc = "`11`"]
358 #[inline(always)]
359 pub fn interrupt(self) -> &'a mut W {
360 self.variant(PTYPESELECT_A::INTERRUPT)
361 }
362}
363#[doc = "Field `PINGEN` reader - Ping Enable"]
364pub type PINGEN_R = crate::BitReader<bool>;
365#[doc = "Field `PINGEN` writer - Ping Enable"]
366pub type PINGEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, UPCFG2_SPEC, bool, O>;
367#[doc = "Field `BINTERVAL` reader - binterval parameter"]
368pub type BINTERVAL_R = crate::FieldReader<u8, u8>;
369#[doc = "Field `BINTERVAL` writer - binterval parameter"]
370pub type BINTERVAL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, UPCFG2_SPEC, u8, u8, 8, O>;
371impl R {
372 #[doc = "Bit 2 - Pipe Banks"]
373 #[inline(always)]
374 pub fn pbk(&self) -> PBK_R {
375 PBK_R::new(((self.bits >> 2) & 1) != 0)
376 }
377 #[doc = "Bits 4:6 - Pipe Size"]
378 #[inline(always)]
379 pub fn psize(&self) -> PSIZE_R {
380 PSIZE_R::new(((self.bits >> 4) & 7) as u8)
381 }
382 #[doc = "Bits 8:9 - Pipe Token"]
383 #[inline(always)]
384 pub fn ptoken(&self) -> PTOKEN_R {
385 PTOKEN_R::new(((self.bits >> 8) & 3) as u8)
386 }
387 #[doc = "Bits 12:13 - Pipe Type"]
388 #[inline(always)]
389 pub fn ptype(&self) -> PTYPE_R {
390 PTYPE_R::new(((self.bits >> 12) & 3) as u8)
391 }
392 #[doc = "Bit 20 - Ping Enable"]
393 #[inline(always)]
394 pub fn pingen(&self) -> PINGEN_R {
395 PINGEN_R::new(((self.bits >> 20) & 1) != 0)
396 }
397 #[doc = "Bits 24:31 - binterval parameter"]
398 #[inline(always)]
399 pub fn binterval(&self) -> BINTERVAL_R {
400 BINTERVAL_R::new(((self.bits >> 24) & 0xff) as u8)
401 }
402}
403impl W {
404 #[doc = "Bit 2 - Pipe Banks"]
405 #[inline(always)]
406 #[must_use]
407 pub fn pbk(&mut self) -> PBK_W<2> {
408 PBK_W::new(self)
409 }
410 #[doc = "Bits 4:6 - Pipe Size"]
411 #[inline(always)]
412 #[must_use]
413 pub fn psize(&mut self) -> PSIZE_W<4> {
414 PSIZE_W::new(self)
415 }
416 #[doc = "Bits 8:9 - Pipe Token"]
417 #[inline(always)]
418 #[must_use]
419 pub fn ptoken(&mut self) -> PTOKEN_W<8> {
420 PTOKEN_W::new(self)
421 }
422 #[doc = "Bits 12:13 - Pipe Type"]
423 #[inline(always)]
424 #[must_use]
425 pub fn ptype(&mut self) -> PTYPE_W<12> {
426 PTYPE_W::new(self)
427 }
428 #[doc = "Bit 20 - Ping Enable"]
429 #[inline(always)]
430 #[must_use]
431 pub fn pingen(&mut self) -> PINGEN_W<20> {
432 PINGEN_W::new(self)
433 }
434 #[doc = "Bits 24:31 - binterval parameter"]
435 #[inline(always)]
436 #[must_use]
437 pub fn binterval(&mut self) -> BINTERVAL_W<24> {
438 BINTERVAL_W::new(self)
439 }
440 #[doc = "Writes raw bits to the register."]
441 #[inline(always)]
442 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
443 self.0.bits(bits);
444 self
445 }
446}
447#[doc = "Pipe Configuration 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 [upcfg2](index.html) module"]
448pub struct UPCFG2_SPEC;
449impl crate::RegisterSpec for UPCFG2_SPEC {
450 type Ux = u32;
451}
452#[doc = "`read()` method returns [upcfg2::R](R) reader structure"]
453impl crate::Readable for UPCFG2_SPEC {
454 type Reader = R;
455}
456#[doc = "`write(|w| ..)` method takes [upcfg2::W](W) writer structure"]
457impl crate::Writable for UPCFG2_SPEC {
458 type Writer = W;
459 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
460 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
461}
462#[doc = "`reset()` method sets UPCFG2 to value 0"]
463impl crate::Resettable for UPCFG2_SPEC {
464 const RESET_VALUE: Self::Ux = 0;
465}