1#[doc = "Register `PIPECFG` reader"]
2pub struct R(crate::R<PIPECFG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PIPECFG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PIPECFG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PIPECFG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PIPECFG` writer"]
17pub struct W(crate::W<PIPECFG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PIPECFG_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<PIPECFG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PIPECFG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `EPNUM` reader - Endpoint Number"]
38pub type EPNUM_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `EPNUM` writer - Endpoint Number"]
40pub type EPNUM_W<'a, const O: u8> = crate::FieldWriter<'a, u16, PIPECFG_SPEC, u8, u8, 4, O>;
41#[doc = "Field `DIR` reader - Transfer Direction"]
42pub type DIR_R = crate::BitReader<DIR_A>;
43#[doc = "Transfer Direction\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum DIR_A {
46 #[doc = "0: Receiving direction"]
47 _0 = 0,
48 #[doc = "1: Transmitting direction"]
49 _1 = 1,
50}
51impl From<DIR_A> for bool {
52 #[inline(always)]
53 fn from(variant: DIR_A) -> Self {
54 variant as u8 != 0
55 }
56}
57impl DIR_R {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> DIR_A {
61 match self.bits {
62 false => DIR_A::_0,
63 true => DIR_A::_1,
64 }
65 }
66 #[doc = "Checks if the value of the field is `_0`"]
67 #[inline(always)]
68 pub fn is_0(&self) -> bool {
69 *self == DIR_A::_0
70 }
71 #[doc = "Checks if the value of the field is `_1`"]
72 #[inline(always)]
73 pub fn is_1(&self) -> bool {
74 *self == DIR_A::_1
75 }
76}
77#[doc = "Field `DIR` writer - Transfer Direction"]
78pub type DIR_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECFG_SPEC, DIR_A, O>;
79impl<'a, const O: u8> DIR_W<'a, O> {
80 #[doc = "Receiving direction"]
81 #[inline(always)]
82 pub fn _0(self) -> &'a mut W {
83 self.variant(DIR_A::_0)
84 }
85 #[doc = "Transmitting direction"]
86 #[inline(always)]
87 pub fn _1(self) -> &'a mut W {
88 self.variant(DIR_A::_1)
89 }
90}
91#[doc = "Field `SHTNAK` reader - Pipe Disabled at End of Transfer"]
92pub type SHTNAK_R = crate::BitReader<SHTNAK_A>;
93#[doc = "Pipe Disabled at End of Transfer\n\nValue on reset: 0"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum SHTNAK_A {
96 #[doc = "0: Continue pipe operation after transfer ends"]
97 _0 = 0,
98 #[doc = "1: Disable pipe after transfer ends"]
99 _1 = 1,
100}
101impl From<SHTNAK_A> for bool {
102 #[inline(always)]
103 fn from(variant: SHTNAK_A) -> Self {
104 variant as u8 != 0
105 }
106}
107impl SHTNAK_R {
108 #[doc = "Get enumerated values variant"]
109 #[inline(always)]
110 pub fn variant(&self) -> SHTNAK_A {
111 match self.bits {
112 false => SHTNAK_A::_0,
113 true => SHTNAK_A::_1,
114 }
115 }
116 #[doc = "Checks if the value of the field is `_0`"]
117 #[inline(always)]
118 pub fn is_0(&self) -> bool {
119 *self == SHTNAK_A::_0
120 }
121 #[doc = "Checks if the value of the field is `_1`"]
122 #[inline(always)]
123 pub fn is_1(&self) -> bool {
124 *self == SHTNAK_A::_1
125 }
126}
127#[doc = "Field `SHTNAK` writer - Pipe Disabled at End of Transfer"]
128pub type SHTNAK_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECFG_SPEC, SHTNAK_A, O>;
129impl<'a, const O: u8> SHTNAK_W<'a, O> {
130 #[doc = "Continue pipe operation after transfer ends"]
131 #[inline(always)]
132 pub fn _0(self) -> &'a mut W {
133 self.variant(SHTNAK_A::_0)
134 }
135 #[doc = "Disable pipe after transfer ends"]
136 #[inline(always)]
137 pub fn _1(self) -> &'a mut W {
138 self.variant(SHTNAK_A::_1)
139 }
140}
141#[doc = "Field `DBLB` reader - Double Buffer Mode"]
142pub type DBLB_R = crate::BitReader<DBLB_A>;
143#[doc = "Double Buffer Mode\n\nValue on reset: 0"]
144#[derive(Clone, Copy, Debug, PartialEq, Eq)]
145pub enum DBLB_A {
146 #[doc = "0: Single buffer"]
147 _0 = 0,
148 #[doc = "1: Double buffer"]
149 _1 = 1,
150}
151impl From<DBLB_A> for bool {
152 #[inline(always)]
153 fn from(variant: DBLB_A) -> Self {
154 variant as u8 != 0
155 }
156}
157impl DBLB_R {
158 #[doc = "Get enumerated values variant"]
159 #[inline(always)]
160 pub fn variant(&self) -> DBLB_A {
161 match self.bits {
162 false => DBLB_A::_0,
163 true => DBLB_A::_1,
164 }
165 }
166 #[doc = "Checks if the value of the field is `_0`"]
167 #[inline(always)]
168 pub fn is_0(&self) -> bool {
169 *self == DBLB_A::_0
170 }
171 #[doc = "Checks if the value of the field is `_1`"]
172 #[inline(always)]
173 pub fn is_1(&self) -> bool {
174 *self == DBLB_A::_1
175 }
176}
177#[doc = "Field `DBLB` writer - Double Buffer Mode"]
178pub type DBLB_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECFG_SPEC, DBLB_A, O>;
179impl<'a, const O: u8> DBLB_W<'a, O> {
180 #[doc = "Single buffer"]
181 #[inline(always)]
182 pub fn _0(self) -> &'a mut W {
183 self.variant(DBLB_A::_0)
184 }
185 #[doc = "Double buffer"]
186 #[inline(always)]
187 pub fn _1(self) -> &'a mut W {
188 self.variant(DBLB_A::_1)
189 }
190}
191#[doc = "Field `BFRE` reader - BRDY Interrupt Operation Specification"]
192pub type BFRE_R = crate::BitReader<BFRE_A>;
193#[doc = "BRDY Interrupt Operation Specification\n\nValue on reset: 0"]
194#[derive(Clone, Copy, Debug, PartialEq, Eq)]
195pub enum BFRE_A {
196 #[doc = "0: Generate BRDY interrupt on transmitting or receiving data"]
197 _0 = 0,
198 #[doc = "1: Generate BRDY interrupt on completion of reading data"]
199 _1 = 1,
200}
201impl From<BFRE_A> for bool {
202 #[inline(always)]
203 fn from(variant: BFRE_A) -> Self {
204 variant as u8 != 0
205 }
206}
207impl BFRE_R {
208 #[doc = "Get enumerated values variant"]
209 #[inline(always)]
210 pub fn variant(&self) -> BFRE_A {
211 match self.bits {
212 false => BFRE_A::_0,
213 true => BFRE_A::_1,
214 }
215 }
216 #[doc = "Checks if the value of the field is `_0`"]
217 #[inline(always)]
218 pub fn is_0(&self) -> bool {
219 *self == BFRE_A::_0
220 }
221 #[doc = "Checks if the value of the field is `_1`"]
222 #[inline(always)]
223 pub fn is_1(&self) -> bool {
224 *self == BFRE_A::_1
225 }
226}
227#[doc = "Field `BFRE` writer - BRDY Interrupt Operation Specification"]
228pub type BFRE_W<'a, const O: u8> = crate::BitWriter<'a, u16, PIPECFG_SPEC, BFRE_A, O>;
229impl<'a, const O: u8> BFRE_W<'a, O> {
230 #[doc = "Generate BRDY interrupt on transmitting or receiving data"]
231 #[inline(always)]
232 pub fn _0(self) -> &'a mut W {
233 self.variant(BFRE_A::_0)
234 }
235 #[doc = "Generate BRDY interrupt on completion of reading data"]
236 #[inline(always)]
237 pub fn _1(self) -> &'a mut W {
238 self.variant(BFRE_A::_1)
239 }
240}
241#[doc = "Field `TYPE` reader - Transfer Type"]
242pub type TYPE_R = crate::FieldReader<u8, TYPE_A>;
243#[doc = "Transfer Type\n\nValue on reset: 0"]
244#[derive(Clone, Copy, Debug, PartialEq, Eq)]
245#[repr(u8)]
246pub enum TYPE_A {
247 #[doc = "0: Pipe not used"]
248 _00 = 0,
249 #[doc = "1: Pipes 1 and 2: Bulk transfer Pipes 3 to 5: Bulk transfer Pipes 6 to 9: Setting prohibited"]
250 _01 = 1,
251 #[doc = "2: Pipes 1 and 2: Setting prohibited Pipes 3 to 5: Setting prohibited Pipes 6 to 9: Interrupt transfer"]
252 _10 = 2,
253 #[doc = "3: Pipes 1 and 2: Isochronous transfer Pipes 3 to 5: Setting prohibited Pipes 6 to 9: Setting prohibited"]
254 _11 = 3,
255}
256impl From<TYPE_A> for u8 {
257 #[inline(always)]
258 fn from(variant: TYPE_A) -> Self {
259 variant as _
260 }
261}
262impl TYPE_R {
263 #[doc = "Get enumerated values variant"]
264 #[inline(always)]
265 pub fn variant(&self) -> TYPE_A {
266 match self.bits {
267 0 => TYPE_A::_00,
268 1 => TYPE_A::_01,
269 2 => TYPE_A::_10,
270 3 => TYPE_A::_11,
271 _ => unreachable!(),
272 }
273 }
274 #[doc = "Checks if the value of the field is `_00`"]
275 #[inline(always)]
276 pub fn is_00(&self) -> bool {
277 *self == TYPE_A::_00
278 }
279 #[doc = "Checks if the value of the field is `_01`"]
280 #[inline(always)]
281 pub fn is_01(&self) -> bool {
282 *self == TYPE_A::_01
283 }
284 #[doc = "Checks if the value of the field is `_10`"]
285 #[inline(always)]
286 pub fn is_10(&self) -> bool {
287 *self == TYPE_A::_10
288 }
289 #[doc = "Checks if the value of the field is `_11`"]
290 #[inline(always)]
291 pub fn is_11(&self) -> bool {
292 *self == TYPE_A::_11
293 }
294}
295#[doc = "Field `TYPE` writer - Transfer Type"]
296pub type TYPE_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u16, PIPECFG_SPEC, u8, TYPE_A, 2, O>;
297impl<'a, const O: u8> TYPE_W<'a, O> {
298 #[doc = "Pipe not used"]
299 #[inline(always)]
300 pub fn _00(self) -> &'a mut W {
301 self.variant(TYPE_A::_00)
302 }
303 #[doc = "Pipes 1 and 2: Bulk transfer Pipes 3 to 5: Bulk transfer Pipes 6 to 9: Setting prohibited"]
304 #[inline(always)]
305 pub fn _01(self) -> &'a mut W {
306 self.variant(TYPE_A::_01)
307 }
308 #[doc = "Pipes 1 and 2: Setting prohibited Pipes 3 to 5: Setting prohibited Pipes 6 to 9: Interrupt transfer"]
309 #[inline(always)]
310 pub fn _10(self) -> &'a mut W {
311 self.variant(TYPE_A::_10)
312 }
313 #[doc = "Pipes 1 and 2: Isochronous transfer Pipes 3 to 5: Setting prohibited Pipes 6 to 9: Setting prohibited"]
314 #[inline(always)]
315 pub fn _11(self) -> &'a mut W {
316 self.variant(TYPE_A::_11)
317 }
318}
319impl R {
320 #[doc = "Bits 0:3 - Endpoint Number"]
321 #[inline(always)]
322 pub fn epnum(&self) -> EPNUM_R {
323 EPNUM_R::new((self.bits & 0x0f) as u8)
324 }
325 #[doc = "Bit 4 - Transfer Direction"]
326 #[inline(always)]
327 pub fn dir(&self) -> DIR_R {
328 DIR_R::new(((self.bits >> 4) & 1) != 0)
329 }
330 #[doc = "Bit 7 - Pipe Disabled at End of Transfer"]
331 #[inline(always)]
332 pub fn shtnak(&self) -> SHTNAK_R {
333 SHTNAK_R::new(((self.bits >> 7) & 1) != 0)
334 }
335 #[doc = "Bit 9 - Double Buffer Mode"]
336 #[inline(always)]
337 pub fn dblb(&self) -> DBLB_R {
338 DBLB_R::new(((self.bits >> 9) & 1) != 0)
339 }
340 #[doc = "Bit 10 - BRDY Interrupt Operation Specification"]
341 #[inline(always)]
342 pub fn bfre(&self) -> BFRE_R {
343 BFRE_R::new(((self.bits >> 10) & 1) != 0)
344 }
345 #[doc = "Bits 14:15 - Transfer Type"]
346 #[inline(always)]
347 pub fn type_(&self) -> TYPE_R {
348 TYPE_R::new(((self.bits >> 14) & 3) as u8)
349 }
350}
351impl W {
352 #[doc = "Bits 0:3 - Endpoint Number"]
353 #[inline(always)]
354 #[must_use]
355 pub fn epnum(&mut self) -> EPNUM_W<0> {
356 EPNUM_W::new(self)
357 }
358 #[doc = "Bit 4 - Transfer Direction"]
359 #[inline(always)]
360 #[must_use]
361 pub fn dir(&mut self) -> DIR_W<4> {
362 DIR_W::new(self)
363 }
364 #[doc = "Bit 7 - Pipe Disabled at End of Transfer"]
365 #[inline(always)]
366 #[must_use]
367 pub fn shtnak(&mut self) -> SHTNAK_W<7> {
368 SHTNAK_W::new(self)
369 }
370 #[doc = "Bit 9 - Double Buffer Mode"]
371 #[inline(always)]
372 #[must_use]
373 pub fn dblb(&mut self) -> DBLB_W<9> {
374 DBLB_W::new(self)
375 }
376 #[doc = "Bit 10 - BRDY Interrupt Operation Specification"]
377 #[inline(always)]
378 #[must_use]
379 pub fn bfre(&mut self) -> BFRE_W<10> {
380 BFRE_W::new(self)
381 }
382 #[doc = "Bits 14:15 - Transfer Type"]
383 #[inline(always)]
384 #[must_use]
385 pub fn type_(&mut self) -> TYPE_W<14> {
386 TYPE_W::new(self)
387 }
388 #[doc = "Writes raw bits to the register."]
389 #[inline(always)]
390 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
391 self.0.bits(bits);
392 self
393 }
394}
395#[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 [pipecfg](index.html) module"]
396pub struct PIPECFG_SPEC;
397impl crate::RegisterSpec for PIPECFG_SPEC {
398 type Ux = u16;
399}
400#[doc = "`read()` method returns [pipecfg::R](R) reader structure"]
401impl crate::Readable for PIPECFG_SPEC {
402 type Reader = R;
403}
404#[doc = "`write(|w| ..)` method takes [pipecfg::W](W) writer structure"]
405impl crate::Writable for PIPECFG_SPEC {
406 type Writer = W;
407 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
408 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
409}
410#[doc = "`reset()` method sets PIPECFG to value 0"]
411impl crate::Resettable for PIPECFG_SPEC {
412 const RESET_VALUE: Self::Ux = 0;
413}