1#[doc = "Register `PIPE%sCTR` reader"]
2pub struct R(crate::R<PIPECTR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PIPECTR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PIPECTR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PIPECTR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PIPE%sCTR` writer"]
17pub struct W(crate::W<PIPECTR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PIPECTR_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<PIPECTR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PIPECTR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `PID` reader - Response PID"]
38pub type PID_R = crate::FieldReader<u8, PID_A>;
39#[doc = "Response PID\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum PID_A {
43 #[doc = "0: NAK response"]
44 _00 = 0,
45 #[doc = "1: BUF response (depends buffer state)"]
46 _01 = 1,
47 #[doc = "2: STALL response"]
48 _10 = 2,
49 #[doc = "3: STALL response"]
50 _11 = 3,
51}
52impl From<PID_A> for u8 {
53 #[inline(always)]
54 fn from(variant: PID_A) -> Self {
55 variant as _
56 }
57}
58impl PID_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> PID_A {
62 match self.bits {
63 0 => PID_A::_00,
64 1 => PID_A::_01,
65 2 => PID_A::_10,
66 3 => PID_A::_11,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `_00`"]
71 #[inline(always)]
72 pub fn is_00(&self) -> bool {
73 *self == PID_A::_00
74 }
75 #[doc = "Checks if the value of the field is `_01`"]
76 #[inline(always)]
77 pub fn is_01(&self) -> bool {
78 *self == PID_A::_01
79 }
80 #[doc = "Checks if the value of the field is `_10`"]
81 #[inline(always)]
82 pub fn is_10(&self) -> bool {
83 *self == PID_A::_10
84 }
85 #[doc = "Checks if the value of the field is `_11`"]
86 #[inline(always)]
87 pub fn is_11(&self) -> bool {
88 *self == PID_A::_11
89 }
90}
91#[doc = "Field `PID` writer - Response PID"]
92pub type PID_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u16, PIPECTR_SPEC, u8, PID_A, 2, O>;
93impl<'a, const O: u8> PID_W<'a, O> {
94 #[doc = "NAK response"]
95 #[inline(always)]
96 pub fn _00(self) -> &'a mut W {
97 self.variant(PID_A::_00)
98 }
99 #[doc = "BUF response (depends buffer state)"]
100 #[inline(always)]
101 pub fn _01(self) -> &'a mut W {
102 self.variant(PID_A::_01)
103 }
104 #[doc = "STALL response"]
105 #[inline(always)]
106 pub fn _10(self) -> &'a mut W {
107 self.variant(PID_A::_10)
108 }
109 #[doc = "STALL response"]
110 #[inline(always)]
111 pub fn _11(self) -> &'a mut W {
112 self.variant(PID_A::_11)
113 }
114}
115#[doc = "Field `PBUSY` reader - Pipe Busy"]
116pub type PBUSY_R = crate::BitReader<PBUSY_A>;
117#[doc = "Pipe Busy\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119pub enum PBUSY_A {
120 #[doc = "0: Pipe n not in use for the transaction"]
121 _0 = 0,
122 #[doc = "1: Pipe n in use for the transaction"]
123 _1 = 1,
124}
125impl From<PBUSY_A> for bool {
126 #[inline(always)]
127 fn from(variant: PBUSY_A) -> Self {
128 variant as u8 != 0
129 }
130}
131impl PBUSY_R {
132 #[doc = "Get enumerated values variant"]
133 #[inline(always)]
134 pub fn variant(&self) -> PBUSY_A {
135 match self.bits {
136 false => PBUSY_A::_0,
137 true => PBUSY_A::_1,
138 }
139 }
140 #[doc = "Checks if the value of the field is `_0`"]
141 #[inline(always)]
142 pub fn is_0(&self) -> bool {
143 *self == PBUSY_A::_0
144 }
145 #[doc = "Checks if the value of the field is `_1`"]
146 #[inline(always)]
147 pub fn is_1(&self) -> bool {
148 *self == PBUSY_A::_1
149 }
150}
151#[doc = "Field `SQMON` reader - Sequence Toggle Bit Confirmation"]
152pub type SQMON_R = crate::BitReader<SQMON_A>;
153#[doc = "Sequence Toggle Bit Confirmation\n\nValue on reset: 0"]
154#[derive(Clone, Copy, Debug, PartialEq, Eq)]
155pub enum SQMON_A {
156 #[doc = "0: DATA0"]
157 _0 = 0,
158 #[doc = "1: DATA1"]
159 _1 = 1,
160}
161impl From<SQMON_A> for bool {
162 #[inline(always)]
163 fn from(variant: SQMON_A) -> Self {
164 variant as u8 != 0
165 }
166}
167impl SQMON_R {
168 #[doc = "Get enumerated values variant"]
169 #[inline(always)]
170 pub fn variant(&self) -> SQMON_A {
171 match self.bits {
172 false => SQMON_A::_0,
173 true => SQMON_A::_1,
174 }
175 }
176 #[doc = "Checks if the value of the field is `_0`"]
177 #[inline(always)]
178 pub fn is_0(&self) -> bool {
179 *self == SQMON_A::_0
180 }
181 #[doc = "Checks if the value of the field is `_1`"]
182 #[inline(always)]
183 pub fn is_1(&self) -> bool {
184 *self == SQMON_A::_1
185 }
186}
187#[doc = "Field `SQSET` reader - Sequence Toggle Bit Set"]
188pub type SQSET_R = crate::BitReader<SQSET_A>;
189#[doc = "Sequence Toggle Bit Set\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum SQSET_A {
192 #[doc = "0: Invalid (writing 0 has no effect)"]
193 _0 = 0,
194 #[doc = "1: Set the expected value for the next transaction to DATA1"]
195 _1 = 1,
196}
197impl From<SQSET_A> for bool {
198 #[inline(always)]
199 fn from(variant: SQSET_A) -> Self {
200 variant as u8 != 0
201 }
202}
203impl SQSET_R {
204 #[doc = "Get enumerated values variant"]
205 #[inline(always)]
206 pub fn variant(&self) -> SQSET_A {
207 match self.bits {
208 false => SQSET_A::_0,
209 true => SQSET_A::_1,
210 }
211 }
212 #[doc = "Checks if the value of the field is `_0`"]
213 #[inline(always)]
214 pub fn is_0(&self) -> bool {
215 *self == SQSET_A::_0
216 }
217 #[doc = "Checks if the value of the field is `_1`"]
218 #[inline(always)]
219 pub fn is_1(&self) -> bool {
220 *self == SQSET_A::_1
221 }
222}
223#[doc = "Field `SQSET` writer - Sequence Toggle Bit Set"]
224pub type SQSET_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECTR_SPEC, SQSET_A, O>;
225impl<'a, const O: u8> SQSET_W<'a, O> {
226 #[doc = "Invalid (writing 0 has no effect)"]
227 #[inline(always)]
228 pub fn _0(self) -> &'a mut W {
229 self.variant(SQSET_A::_0)
230 }
231 #[doc = "Set the expected value for the next transaction to DATA1"]
232 #[inline(always)]
233 pub fn _1(self) -> &'a mut W {
234 self.variant(SQSET_A::_1)
235 }
236}
237#[doc = "Field `SQCLR` reader - Sequence Toggle Bit Clear"]
238pub type SQCLR_R = crate::BitReader<SQCLR_A>;
239#[doc = "Sequence Toggle Bit Clear\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq, Eq)]
241pub enum SQCLR_A {
242 #[doc = "0: Invalid (writing 0 has no effect)"]
243 _0 = 0,
244 #[doc = "1: Clear the expected value for the next transaction to DATA0"]
245 _1 = 1,
246}
247impl From<SQCLR_A> for bool {
248 #[inline(always)]
249 fn from(variant: SQCLR_A) -> Self {
250 variant as u8 != 0
251 }
252}
253impl SQCLR_R {
254 #[doc = "Get enumerated values variant"]
255 #[inline(always)]
256 pub fn variant(&self) -> SQCLR_A {
257 match self.bits {
258 false => SQCLR_A::_0,
259 true => SQCLR_A::_1,
260 }
261 }
262 #[doc = "Checks if the value of the field is `_0`"]
263 #[inline(always)]
264 pub fn is_0(&self) -> bool {
265 *self == SQCLR_A::_0
266 }
267 #[doc = "Checks if the value of the field is `_1`"]
268 #[inline(always)]
269 pub fn is_1(&self) -> bool {
270 *self == SQCLR_A::_1
271 }
272}
273#[doc = "Field `SQCLR` writer - Sequence Toggle Bit Clear"]
274pub type SQCLR_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECTR_SPEC, SQCLR_A, O>;
275impl<'a, const O: u8> SQCLR_W<'a, O> {
276 #[doc = "Invalid (writing 0 has no effect)"]
277 #[inline(always)]
278 pub fn _0(self) -> &'a mut W {
279 self.variant(SQCLR_A::_0)
280 }
281 #[doc = "Clear the expected value for the next transaction to DATA0"]
282 #[inline(always)]
283 pub fn _1(self) -> &'a mut W {
284 self.variant(SQCLR_A::_1)
285 }
286}
287#[doc = "Field `ACLRM` reader - Auto Buffer Clear Mode"]
288pub type ACLRM_R = crate::BitReader<ACLRM_A>;
289#[doc = "Auto Buffer Clear Mode\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq, Eq)]
291pub enum ACLRM_A {
292 #[doc = "0: Disable"]
293 _0 = 0,
294 #[doc = "1: Enable (initialize all buffers)"]
295 _1 = 1,
296}
297impl From<ACLRM_A> for bool {
298 #[inline(always)]
299 fn from(variant: ACLRM_A) -> Self {
300 variant as u8 != 0
301 }
302}
303impl ACLRM_R {
304 #[doc = "Get enumerated values variant"]
305 #[inline(always)]
306 pub fn variant(&self) -> ACLRM_A {
307 match self.bits {
308 false => ACLRM_A::_0,
309 true => ACLRM_A::_1,
310 }
311 }
312 #[doc = "Checks if the value of the field is `_0`"]
313 #[inline(always)]
314 pub fn is_0(&self) -> bool {
315 *self == ACLRM_A::_0
316 }
317 #[doc = "Checks if the value of the field is `_1`"]
318 #[inline(always)]
319 pub fn is_1(&self) -> bool {
320 *self == ACLRM_A::_1
321 }
322}
323#[doc = "Field `ACLRM` writer - Auto Buffer Clear Mode"]
324pub type ACLRM_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECTR_SPEC, ACLRM_A, O>;
325impl<'a, const O: u8> ACLRM_W<'a, O> {
326 #[doc = "Disable"]
327 #[inline(always)]
328 pub fn _0(self) -> &'a mut W {
329 self.variant(ACLRM_A::_0)
330 }
331 #[doc = "Enable (initialize all buffers)"]
332 #[inline(always)]
333 pub fn _1(self) -> &'a mut W {
334 self.variant(ACLRM_A::_1)
335 }
336}
337#[doc = "Field `ATREPM` reader - Auto Response Mode"]
338pub type ATREPM_R = crate::BitReader<ATREPM_A>;
339#[doc = "Auto Response Mode\n\nValue on reset: 0"]
340#[derive(Clone, Copy, Debug, PartialEq, Eq)]
341pub enum ATREPM_A {
342 #[doc = "0: Disable auto response mode"]
343 _0 = 0,
344 #[doc = "1: Enable auto response mode"]
345 _1 = 1,
346}
347impl From<ATREPM_A> for bool {
348 #[inline(always)]
349 fn from(variant: ATREPM_A) -> Self {
350 variant as u8 != 0
351 }
352}
353impl ATREPM_R {
354 #[doc = "Get enumerated values variant"]
355 #[inline(always)]
356 pub fn variant(&self) -> ATREPM_A {
357 match self.bits {
358 false => ATREPM_A::_0,
359 true => ATREPM_A::_1,
360 }
361 }
362 #[doc = "Checks if the value of the field is `_0`"]
363 #[inline(always)]
364 pub fn is_0(&self) -> bool {
365 *self == ATREPM_A::_0
366 }
367 #[doc = "Checks if the value of the field is `_1`"]
368 #[inline(always)]
369 pub fn is_1(&self) -> bool {
370 *self == ATREPM_A::_1
371 }
372}
373#[doc = "Field `ATREPM` writer - Auto Response Mode"]
374pub type ATREPM_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECTR_SPEC, ATREPM_A, O>;
375impl<'a, const O: u8> ATREPM_W<'a, O> {
376 #[doc = "Disable auto response mode"]
377 #[inline(always)]
378 pub fn _0(self) -> &'a mut W {
379 self.variant(ATREPM_A::_0)
380 }
381 #[doc = "Enable auto response mode"]
382 #[inline(always)]
383 pub fn _1(self) -> &'a mut W {
384 self.variant(ATREPM_A::_1)
385 }
386}
387#[doc = "Field `INBUFM` reader - Transmit Buffer Monitor"]
388pub type INBUFM_R = crate::BitReader<INBUFM_A>;
389#[doc = "Transmit Buffer Monitor\n\nValue on reset: 0"]
390#[derive(Clone, Copy, Debug, PartialEq, Eq)]
391pub enum INBUFM_A {
392 #[doc = "0: No data to be transmitted is in the FIFO buffer"]
393 _0 = 0,
394 #[doc = "1: Data to be transmitted is in the FIFO buffer"]
395 _1 = 1,
396}
397impl From<INBUFM_A> for bool {
398 #[inline(always)]
399 fn from(variant: INBUFM_A) -> Self {
400 variant as u8 != 0
401 }
402}
403impl INBUFM_R {
404 #[doc = "Get enumerated values variant"]
405 #[inline(always)]
406 pub fn variant(&self) -> INBUFM_A {
407 match self.bits {
408 false => INBUFM_A::_0,
409 true => INBUFM_A::_1,
410 }
411 }
412 #[doc = "Checks if the value of the field is `_0`"]
413 #[inline(always)]
414 pub fn is_0(&self) -> bool {
415 *self == INBUFM_A::_0
416 }
417 #[doc = "Checks if the value of the field is `_1`"]
418 #[inline(always)]
419 pub fn is_1(&self) -> bool {
420 *self == INBUFM_A::_1
421 }
422}
423#[doc = "Field `BSTS` reader - Buffer Status"]
424pub type BSTS_R = crate::BitReader<BSTS_A>;
425#[doc = "Buffer Status\n\nValue on reset: 0"]
426#[derive(Clone, Copy, Debug, PartialEq, Eq)]
427pub enum BSTS_A {
428 #[doc = "0: Buffer access by the CPU disabled"]
429 _0 = 0,
430 #[doc = "1: Buffer access by the CPU enabled"]
431 _1 = 1,
432}
433impl From<BSTS_A> for bool {
434 #[inline(always)]
435 fn from(variant: BSTS_A) -> Self {
436 variant as u8 != 0
437 }
438}
439impl BSTS_R {
440 #[doc = "Get enumerated values variant"]
441 #[inline(always)]
442 pub fn variant(&self) -> BSTS_A {
443 match self.bits {
444 false => BSTS_A::_0,
445 true => BSTS_A::_1,
446 }
447 }
448 #[doc = "Checks if the value of the field is `_0`"]
449 #[inline(always)]
450 pub fn is_0(&self) -> bool {
451 *self == BSTS_A::_0
452 }
453 #[doc = "Checks if the value of the field is `_1`"]
454 #[inline(always)]
455 pub fn is_1(&self) -> bool {
456 *self == BSTS_A::_1
457 }
458}
459impl R {
460 #[doc = "Bits 0:1 - Response PID"]
461 #[inline(always)]
462 pub fn pid(&self) -> PID_R {
463 PID_R::new((self.bits & 3) as u8)
464 }
465 #[doc = "Bit 5 - Pipe Busy"]
466 #[inline(always)]
467 pub fn pbusy(&self) -> PBUSY_R {
468 PBUSY_R::new(((self.bits >> 5) & 1) != 0)
469 }
470 #[doc = "Bit 6 - Sequence Toggle Bit Confirmation"]
471 #[inline(always)]
472 pub fn sqmon(&self) -> SQMON_R {
473 SQMON_R::new(((self.bits >> 6) & 1) != 0)
474 }
475 #[doc = "Bit 7 - Sequence Toggle Bit Set"]
476 #[inline(always)]
477 pub fn sqset(&self) -> SQSET_R {
478 SQSET_R::new(((self.bits >> 7) & 1) != 0)
479 }
480 #[doc = "Bit 8 - Sequence Toggle Bit Clear"]
481 #[inline(always)]
482 pub fn sqclr(&self) -> SQCLR_R {
483 SQCLR_R::new(((self.bits >> 8) & 1) != 0)
484 }
485 #[doc = "Bit 9 - Auto Buffer Clear Mode"]
486 #[inline(always)]
487 pub fn aclrm(&self) -> ACLRM_R {
488 ACLRM_R::new(((self.bits >> 9) & 1) != 0)
489 }
490 #[doc = "Bit 10 - Auto Response Mode"]
491 #[inline(always)]
492 pub fn atrepm(&self) -> ATREPM_R {
493 ATREPM_R::new(((self.bits >> 10) & 1) != 0)
494 }
495 #[doc = "Bit 14 - Transmit Buffer Monitor"]
496 #[inline(always)]
497 pub fn inbufm(&self) -> INBUFM_R {
498 INBUFM_R::new(((self.bits >> 14) & 1) != 0)
499 }
500 #[doc = "Bit 15 - Buffer Status"]
501 #[inline(always)]
502 pub fn bsts(&self) -> BSTS_R {
503 BSTS_R::new(((self.bits >> 15) & 1) != 0)
504 }
505}
506impl W {
507 #[doc = "Bits 0:1 - Response PID"]
508 #[inline(always)]
509 #[must_use]
510 pub fn pid(&mut self) -> PID_W<0> {
511 PID_W::new(self)
512 }
513 #[doc = "Bit 7 - Sequence Toggle Bit Set"]
514 #[inline(always)]
515 #[must_use]
516 pub fn sqset(&mut self) -> SQSET_W<7> {
517 SQSET_W::new(self)
518 }
519 #[doc = "Bit 8 - Sequence Toggle Bit Clear"]
520 #[inline(always)]
521 #[must_use]
522 pub fn sqclr(&mut self) -> SQCLR_W<8> {
523 SQCLR_W::new(self)
524 }
525 #[doc = "Bit 9 - Auto Buffer Clear Mode"]
526 #[inline(always)]
527 #[must_use]
528 pub fn aclrm(&mut self) -> ACLRM_W<9> {
529 ACLRM_W::new(self)
530 }
531 #[doc = "Bit 10 - Auto Response Mode"]
532 #[inline(always)]
533 #[must_use]
534 pub fn atrepm(&mut self) -> ATREPM_W<10> {
535 ATREPM_W::new(self)
536 }
537 #[doc = "Writes raw bits to the register."]
538 #[inline(always)]
539 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
540 self.0.bits(bits);
541 self
542 }
543}
544#[doc = "PIPE%s Control Registers\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 [pipectr](index.html) module"]
545pub struct PIPECTR_SPEC;
546impl crate::RegisterSpec for PIPECTR_SPEC {
547 type Ux = u16;
548}
549#[doc = "`read()` method returns [pipectr::R](R) reader structure"]
550impl crate::Readable for PIPECTR_SPEC {
551 type Reader = R;
552}
553#[doc = "`write(|w| ..)` method takes [pipectr::W](W) writer structure"]
554impl crate::Writable for PIPECTR_SPEC {
555 type Writer = W;
556 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
557 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
558}
559#[doc = "`reset()` method sets PIPE%sCTR to value 0"]
560impl crate::Resettable for PIPECTR_SPEC {
561 const RESET_VALUE: Self::Ux = 0;
562}