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 (depending on the 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 (depending on the 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: The relevant pipe is not used for the transaction."]
121 _0 = 0,
122 #[doc = "1: The relevant pipe is used 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 = "Sequence Toggle Bit Set\n\nValue on reset: 0"]
188#[derive(Clone, Copy, Debug, PartialEq, Eq)]
189pub enum SQSET_AW {
190 #[doc = "0: Write disabled"]
191 _0 = 0,
192 #[doc = "1: Specifies DATA1."]
193 _1 = 1,
194}
195impl From<SQSET_AW> for bool {
196 #[inline(always)]
197 fn from(variant: SQSET_AW) -> Self {
198 variant as u8 != 0
199 }
200}
201#[doc = "Field `SQSET` writer - Sequence Toggle Bit Set"]
202pub type SQSET_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECTR_SPEC, SQSET_AW, O>;
203impl<'a, const O: u8> SQSET_W<'a, O> {
204 #[doc = "Write disabled"]
205 #[inline(always)]
206 pub fn _0(self) -> &'a mut W {
207 self.variant(SQSET_AW::_0)
208 }
209 #[doc = "Specifies DATA1."]
210 #[inline(always)]
211 pub fn _1(self) -> &'a mut W {
212 self.variant(SQSET_AW::_1)
213 }
214}
215#[doc = "Sequence Toggle Bit Clear\n\nValue on reset: 0"]
216#[derive(Clone, Copy, Debug, PartialEq, Eq)]
217pub enum SQCLR_AW {
218 #[doc = "0: Write disabled"]
219 _0 = 0,
220 #[doc = "1: Specifies DATA0."]
221 _1 = 1,
222}
223impl From<SQCLR_AW> for bool {
224 #[inline(always)]
225 fn from(variant: SQCLR_AW) -> Self {
226 variant as u8 != 0
227 }
228}
229#[doc = "Field `SQCLR` writer - Sequence Toggle Bit Clear"]
230pub type SQCLR_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECTR_SPEC, SQCLR_AW, O>;
231impl<'a, const O: u8> SQCLR_W<'a, O> {
232 #[doc = "Write disabled"]
233 #[inline(always)]
234 pub fn _0(self) -> &'a mut W {
235 self.variant(SQCLR_AW::_0)
236 }
237 #[doc = "Specifies DATA0."]
238 #[inline(always)]
239 pub fn _1(self) -> &'a mut W {
240 self.variant(SQCLR_AW::_1)
241 }
242}
243#[doc = "Field `ACLRM` reader - Auto Buffer Clear Mode"]
244pub type ACLRM_R = crate::BitReader<ACLRM_A>;
245#[doc = "Auto Buffer Clear Mode\n\nValue on reset: 0"]
246#[derive(Clone, Copy, Debug, PartialEq, Eq)]
247pub enum ACLRM_A {
248 #[doc = "0: Disabled"]
249 _0 = 0,
250 #[doc = "1: Enabled (all buffers are initialized)"]
251 _1 = 1,
252}
253impl From<ACLRM_A> for bool {
254 #[inline(always)]
255 fn from(variant: ACLRM_A) -> Self {
256 variant as u8 != 0
257 }
258}
259impl ACLRM_R {
260 #[doc = "Get enumerated values variant"]
261 #[inline(always)]
262 pub fn variant(&self) -> ACLRM_A {
263 match self.bits {
264 false => ACLRM_A::_0,
265 true => ACLRM_A::_1,
266 }
267 }
268 #[doc = "Checks if the value of the field is `_0`"]
269 #[inline(always)]
270 pub fn is_0(&self) -> bool {
271 *self == ACLRM_A::_0
272 }
273 #[doc = "Checks if the value of the field is `_1`"]
274 #[inline(always)]
275 pub fn is_1(&self) -> bool {
276 *self == ACLRM_A::_1
277 }
278}
279#[doc = "Field `ACLRM` writer - Auto Buffer Clear Mode"]
280pub type ACLRM_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECTR_SPEC, ACLRM_A, O>;
281impl<'a, const O: u8> ACLRM_W<'a, O> {
282 #[doc = "Disabled"]
283 #[inline(always)]
284 pub fn _0(self) -> &'a mut W {
285 self.variant(ACLRM_A::_0)
286 }
287 #[doc = "Enabled (all buffers are initialized)"]
288 #[inline(always)]
289 pub fn _1(self) -> &'a mut W {
290 self.variant(ACLRM_A::_1)
291 }
292}
293#[doc = "Field `ATREPM` reader - Auto Response Mode"]
294pub type ATREPM_R = crate::BitReader<ATREPM_A>;
295#[doc = "Auto Response Mode\n\nValue on reset: 0"]
296#[derive(Clone, Copy, Debug, PartialEq, Eq)]
297pub enum ATREPM_A {
298 #[doc = "0: Auto response is disabled."]
299 _0 = 0,
300 #[doc = "1: Auto response is enabled."]
301 _1 = 1,
302}
303impl From<ATREPM_A> for bool {
304 #[inline(always)]
305 fn from(variant: ATREPM_A) -> Self {
306 variant as u8 != 0
307 }
308}
309impl ATREPM_R {
310 #[doc = "Get enumerated values variant"]
311 #[inline(always)]
312 pub fn variant(&self) -> ATREPM_A {
313 match self.bits {
314 false => ATREPM_A::_0,
315 true => ATREPM_A::_1,
316 }
317 }
318 #[doc = "Checks if the value of the field is `_0`"]
319 #[inline(always)]
320 pub fn is_0(&self) -> bool {
321 *self == ATREPM_A::_0
322 }
323 #[doc = "Checks if the value of the field is `_1`"]
324 #[inline(always)]
325 pub fn is_1(&self) -> bool {
326 *self == ATREPM_A::_1
327 }
328}
329#[doc = "Field `ATREPM` writer - Auto Response Mode"]
330pub type ATREPM_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECTR_SPEC, ATREPM_A, O>;
331impl<'a, const O: u8> ATREPM_W<'a, O> {
332 #[doc = "Auto response is disabled."]
333 #[inline(always)]
334 pub fn _0(self) -> &'a mut W {
335 self.variant(ATREPM_A::_0)
336 }
337 #[doc = "Auto response is enabled."]
338 #[inline(always)]
339 pub fn _1(self) -> &'a mut W {
340 self.variant(ATREPM_A::_1)
341 }
342}
343#[doc = "Field `INBUFM` reader - Transmit Buffer Monitor"]
344pub type INBUFM_R = crate::BitReader<INBUFM_A>;
345#[doc = "Transmit Buffer Monitor\n\nValue on reset: 0"]
346#[derive(Clone, Copy, Debug, PartialEq, Eq)]
347pub enum INBUFM_A {
348 #[doc = "0: No data to be transmitted is in the FIFO buffer"]
349 _0 = 0,
350 #[doc = "1: Data to be transmitted is in the FIFO buffer"]
351 _1 = 1,
352}
353impl From<INBUFM_A> for bool {
354 #[inline(always)]
355 fn from(variant: INBUFM_A) -> Self {
356 variant as u8 != 0
357 }
358}
359impl INBUFM_R {
360 #[doc = "Get enumerated values variant"]
361 #[inline(always)]
362 pub fn variant(&self) -> INBUFM_A {
363 match self.bits {
364 false => INBUFM_A::_0,
365 true => INBUFM_A::_1,
366 }
367 }
368 #[doc = "Checks if the value of the field is `_0`"]
369 #[inline(always)]
370 pub fn is_0(&self) -> bool {
371 *self == INBUFM_A::_0
372 }
373 #[doc = "Checks if the value of the field is `_1`"]
374 #[inline(always)]
375 pub fn is_1(&self) -> bool {
376 *self == INBUFM_A::_1
377 }
378}
379#[doc = "Field `BSTS` reader - Buffer Status"]
380pub type BSTS_R = crate::BitReader<BSTS_A>;
381#[doc = "Buffer Status\n\nValue on reset: 0"]
382#[derive(Clone, Copy, Debug, PartialEq, Eq)]
383pub enum BSTS_A {
384 #[doc = "0: Buffer access by the CPU is disabled."]
385 _0 = 0,
386 #[doc = "1: Buffer access by the CPU is enabled."]
387 _1 = 1,
388}
389impl From<BSTS_A> for bool {
390 #[inline(always)]
391 fn from(variant: BSTS_A) -> Self {
392 variant as u8 != 0
393 }
394}
395impl BSTS_R {
396 #[doc = "Get enumerated values variant"]
397 #[inline(always)]
398 pub fn variant(&self) -> BSTS_A {
399 match self.bits {
400 false => BSTS_A::_0,
401 true => BSTS_A::_1,
402 }
403 }
404 #[doc = "Checks if the value of the field is `_0`"]
405 #[inline(always)]
406 pub fn is_0(&self) -> bool {
407 *self == BSTS_A::_0
408 }
409 #[doc = "Checks if the value of the field is `_1`"]
410 #[inline(always)]
411 pub fn is_1(&self) -> bool {
412 *self == BSTS_A::_1
413 }
414}
415impl R {
416 #[doc = "Bits 0:1 - Response PID"]
417 #[inline(always)]
418 pub fn pid(&self) -> PID_R {
419 PID_R::new((self.bits & 3) as u8)
420 }
421 #[doc = "Bit 5 - Pipe Busy"]
422 #[inline(always)]
423 pub fn pbusy(&self) -> PBUSY_R {
424 PBUSY_R::new(((self.bits >> 5) & 1) != 0)
425 }
426 #[doc = "Bit 6 - Sequence Toggle Bit Confirmation"]
427 #[inline(always)]
428 pub fn sqmon(&self) -> SQMON_R {
429 SQMON_R::new(((self.bits >> 6) & 1) != 0)
430 }
431 #[doc = "Bit 9 - Auto Buffer Clear Mode"]
432 #[inline(always)]
433 pub fn aclrm(&self) -> ACLRM_R {
434 ACLRM_R::new(((self.bits >> 9) & 1) != 0)
435 }
436 #[doc = "Bit 10 - Auto Response Mode"]
437 #[inline(always)]
438 pub fn atrepm(&self) -> ATREPM_R {
439 ATREPM_R::new(((self.bits >> 10) & 1) != 0)
440 }
441 #[doc = "Bit 14 - Transmit Buffer Monitor"]
442 #[inline(always)]
443 pub fn inbufm(&self) -> INBUFM_R {
444 INBUFM_R::new(((self.bits >> 14) & 1) != 0)
445 }
446 #[doc = "Bit 15 - Buffer Status"]
447 #[inline(always)]
448 pub fn bsts(&self) -> BSTS_R {
449 BSTS_R::new(((self.bits >> 15) & 1) != 0)
450 }
451}
452impl W {
453 #[doc = "Bits 0:1 - Response PID"]
454 #[inline(always)]
455 #[must_use]
456 pub fn pid(&mut self) -> PID_W<0> {
457 PID_W::new(self)
458 }
459 #[doc = "Bit 7 - Sequence Toggle Bit Set"]
460 #[inline(always)]
461 #[must_use]
462 pub fn sqset(&mut self) -> SQSET_W<7> {
463 SQSET_W::new(self)
464 }
465 #[doc = "Bit 8 - Sequence Toggle Bit Clear"]
466 #[inline(always)]
467 #[must_use]
468 pub fn sqclr(&mut self) -> SQCLR_W<8> {
469 SQCLR_W::new(self)
470 }
471 #[doc = "Bit 9 - Auto Buffer Clear Mode"]
472 #[inline(always)]
473 #[must_use]
474 pub fn aclrm(&mut self) -> ACLRM_W<9> {
475 ACLRM_W::new(self)
476 }
477 #[doc = "Bit 10 - Auto Response Mode"]
478 #[inline(always)]
479 #[must_use]
480 pub fn atrepm(&mut self) -> ATREPM_W<10> {
481 ATREPM_W::new(self)
482 }
483 #[doc = "Writes raw bits to the register."]
484 #[inline(always)]
485 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
486 self.0.bits(bits);
487 self
488 }
489}
490#[doc = "Pipe %s Control 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 [pipectr](index.html) module"]
491pub struct PIPECTR_SPEC;
492impl crate::RegisterSpec for PIPECTR_SPEC {
493 type Ux = u16;
494}
495#[doc = "`read()` method returns [pipectr::R](R) reader structure"]
496impl crate::Readable for PIPECTR_SPEC {
497 type Reader = R;
498}
499#[doc = "`write(|w| ..)` method takes [pipectr::W](W) writer structure"]
500impl crate::Writable for PIPECTR_SPEC {
501 type Writer = W;
502 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
503 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
504}
505#[doc = "`reset()` method sets PIPE%sCTR to value 0"]
506impl crate::Resettable for PIPECTR_SPEC {
507 const RESET_VALUE: Self::Ux = 0;
508}