tm4c129x/usb0/
txtype4.rs

1#[doc = "Reader of register TXTYPE4"]
2pub type R = crate::R<u8, super::TXTYPE4>;
3#[doc = "Writer for register TXTYPE4"]
4pub type W = crate::W<u8, super::TXTYPE4>;
5#[doc = "Register TXTYPE4 `reset()`'s with value 0"]
6impl crate::ResetValue for super::TXTYPE4 {
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 = "1: High"]
127    HIGH = 1,
128    #[doc = "2: Full"]
129    FULL = 2,
130    #[doc = "3: Low"]
131    LOW = 3,
132}
133impl From<SPEED_A> for u8 {
134    #[inline(always)]
135    fn from(variant: SPEED_A) -> Self {
136        variant as _
137    }
138}
139#[doc = "Reader of field `SPEED`"]
140pub type SPEED_R = crate::R<u8, SPEED_A>;
141impl SPEED_R {
142    #[doc = r"Get enumerated values variant"]
143    #[inline(always)]
144    pub fn variant(&self) -> SPEED_A {
145        match self.bits {
146            0 => SPEED_A::DFLT,
147            1 => SPEED_A::HIGH,
148            2 => SPEED_A::FULL,
149            3 => SPEED_A::LOW,
150            _ => unreachable!(),
151        }
152    }
153    #[doc = "Checks if the value of the field is `DFLT`"]
154    #[inline(always)]
155    pub fn is_dflt(&self) -> bool {
156        *self == SPEED_A::DFLT
157    }
158    #[doc = "Checks if the value of the field is `HIGH`"]
159    #[inline(always)]
160    pub fn is_high(&self) -> bool {
161        *self == SPEED_A::HIGH
162    }
163    #[doc = "Checks if the value of the field is `FULL`"]
164    #[inline(always)]
165    pub fn is_full(&self) -> bool {
166        *self == SPEED_A::FULL
167    }
168    #[doc = "Checks if the value of the field is `LOW`"]
169    #[inline(always)]
170    pub fn is_low(&self) -> bool {
171        *self == SPEED_A::LOW
172    }
173}
174#[doc = "Write proxy for field `SPEED`"]
175pub struct SPEED_W<'a> {
176    w: &'a mut W,
177}
178impl<'a> SPEED_W<'a> {
179    #[doc = r"Writes `variant` to the field"]
180    #[inline(always)]
181    pub fn variant(self, variant: SPEED_A) -> &'a mut W {
182        {
183            self.bits(variant.into())
184        }
185    }
186    #[doc = "Default"]
187    #[inline(always)]
188    pub fn dflt(self) -> &'a mut W {
189        self.variant(SPEED_A::DFLT)
190    }
191    #[doc = "High"]
192    #[inline(always)]
193    pub fn high(self) -> &'a mut W {
194        self.variant(SPEED_A::HIGH)
195    }
196    #[doc = "Full"]
197    #[inline(always)]
198    pub fn full(self) -> &'a mut W {
199        self.variant(SPEED_A::FULL)
200    }
201    #[doc = "Low"]
202    #[inline(always)]
203    pub fn low(self) -> &'a mut W {
204        self.variant(SPEED_A::LOW)
205    }
206    #[doc = r"Writes raw bits to the field"]
207    #[inline(always)]
208    pub fn bits(self, value: u8) -> &'a mut W {
209        self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u8) & 0x03) << 6);
210        self.w
211    }
212}
213impl R {
214    #[doc = "Bits 0:3 - Target Endpoint Number"]
215    #[inline(always)]
216    pub fn tep(&self) -> TEP_R {
217        TEP_R::new((self.bits & 0x0f) as u8)
218    }
219    #[doc = "Bits 4:5 - Protocol"]
220    #[inline(always)]
221    pub fn proto(&self) -> PROTO_R {
222        PROTO_R::new(((self.bits >> 4) & 0x03) as u8)
223    }
224    #[doc = "Bits 6:7 - Operating Speed"]
225    #[inline(always)]
226    pub fn speed(&self) -> SPEED_R {
227        SPEED_R::new(((self.bits >> 6) & 0x03) as u8)
228    }
229}
230impl W {
231    #[doc = "Bits 0:3 - Target Endpoint Number"]
232    #[inline(always)]
233    pub fn tep(&mut self) -> TEP_W {
234        TEP_W { w: self }
235    }
236    #[doc = "Bits 4:5 - Protocol"]
237    #[inline(always)]
238    pub fn proto(&mut self) -> PROTO_W {
239        PROTO_W { w: self }
240    }
241    #[doc = "Bits 6:7 - Operating Speed"]
242    #[inline(always)]
243    pub fn speed(&mut self) -> SPEED_W {
244        SPEED_W { w: self }
245    }
246}