cc2538/usb/
oif.rs

1#[doc = "Reader of register OIF"]
2pub type R = crate::R<u32, super::OIF>;
3#[doc = "Writer for register OIF"]
4pub type W = crate::W<u32, super::OIF>;
5#[doc = "Register OIF `reset()`'s with value 0"]
6impl crate::ResetValue for super::OIF {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `Reserved32`"]
14pub type RESERVED32_R = crate::R<u32, u32>;
15#[doc = "Write proxy for field `Reserved32`"]
16pub struct RESERVED32_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> RESERVED32_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u32) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x00ff_ffff << 8)) | (((value as u32) & 0x00ff_ffff) << 8);
24        self.w
25    }
26}
27#[doc = "Reader of field `Reserved8`"]
28pub type RESERVED8_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `Reserved8`"]
30pub struct RESERVED8_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> RESERVED8_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u32) & 0x03) << 6);
38        self.w
39    }
40}
41#[doc = "Reader of field `OUTEP5IF`"]
42pub type OUTEP5IF_R = crate::R<bool, bool>;
43#[doc = "Write proxy for field `OUTEP5IF`"]
44pub struct OUTEP5IF_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> OUTEP5IF_W<'a> {
48    #[doc = r"Sets the field bit"]
49    #[inline(always)]
50    pub fn set_bit(self) -> &'a mut W {
51        self.bit(true)
52    }
53    #[doc = r"Clears the field bit"]
54    #[inline(always)]
55    pub fn clear_bit(self) -> &'a mut W {
56        self.bit(false)
57    }
58    #[doc = r"Writes raw bits to the field"]
59    #[inline(always)]
60    pub fn bit(self, value: bool) -> &'a mut W {
61        self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
62        self.w
63    }
64}
65#[doc = "Reader of field `OUTEP4IF`"]
66pub type OUTEP4IF_R = crate::R<bool, bool>;
67#[doc = "Write proxy for field `OUTEP4IF`"]
68pub struct OUTEP4IF_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> OUTEP4IF_W<'a> {
72    #[doc = r"Sets the field bit"]
73    #[inline(always)]
74    pub fn set_bit(self) -> &'a mut W {
75        self.bit(true)
76    }
77    #[doc = r"Clears the field bit"]
78    #[inline(always)]
79    pub fn clear_bit(self) -> &'a mut W {
80        self.bit(false)
81    }
82    #[doc = r"Writes raw bits to the field"]
83    #[inline(always)]
84    pub fn bit(self, value: bool) -> &'a mut W {
85        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
86        self.w
87    }
88}
89#[doc = "Reader of field `OUTEP3IF`"]
90pub type OUTEP3IF_R = crate::R<bool, bool>;
91#[doc = "Write proxy for field `OUTEP3IF`"]
92pub struct OUTEP3IF_W<'a> {
93    w: &'a mut W,
94}
95impl<'a> OUTEP3IF_W<'a> {
96    #[doc = r"Sets the field bit"]
97    #[inline(always)]
98    pub fn set_bit(self) -> &'a mut W {
99        self.bit(true)
100    }
101    #[doc = r"Clears the field bit"]
102    #[inline(always)]
103    pub fn clear_bit(self) -> &'a mut W {
104        self.bit(false)
105    }
106    #[doc = r"Writes raw bits to the field"]
107    #[inline(always)]
108    pub fn bit(self, value: bool) -> &'a mut W {
109        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
110        self.w
111    }
112}
113#[doc = "Reader of field `OUTEP2IF`"]
114pub type OUTEP2IF_R = crate::R<bool, bool>;
115#[doc = "Write proxy for field `OUTEP2IF`"]
116pub struct OUTEP2IF_W<'a> {
117    w: &'a mut W,
118}
119impl<'a> OUTEP2IF_W<'a> {
120    #[doc = r"Sets the field bit"]
121    #[inline(always)]
122    pub fn set_bit(self) -> &'a mut W {
123        self.bit(true)
124    }
125    #[doc = r"Clears the field bit"]
126    #[inline(always)]
127    pub fn clear_bit(self) -> &'a mut W {
128        self.bit(false)
129    }
130    #[doc = r"Writes raw bits to the field"]
131    #[inline(always)]
132    pub fn bit(self, value: bool) -> &'a mut W {
133        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
134        self.w
135    }
136}
137#[doc = "Reader of field `OUTEP1IF`"]
138pub type OUTEP1IF_R = crate::R<bool, bool>;
139#[doc = "Write proxy for field `OUTEP1IF`"]
140pub struct OUTEP1IF_W<'a> {
141    w: &'a mut W,
142}
143impl<'a> OUTEP1IF_W<'a> {
144    #[doc = r"Sets the field bit"]
145    #[inline(always)]
146    pub fn set_bit(self) -> &'a mut W {
147        self.bit(true)
148    }
149    #[doc = r"Clears the field bit"]
150    #[inline(always)]
151    pub fn clear_bit(self) -> &'a mut W {
152        self.bit(false)
153    }
154    #[doc = r"Writes raw bits to the field"]
155    #[inline(always)]
156    pub fn bit(self, value: bool) -> &'a mut W {
157        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
158        self.w
159    }
160}
161#[doc = "Reader of field `Reserved1`"]
162pub type RESERVED1_R = crate::R<bool, bool>;
163#[doc = "Write proxy for field `Reserved1`"]
164pub struct RESERVED1_W<'a> {
165    w: &'a mut W,
166}
167impl<'a> RESERVED1_W<'a> {
168    #[doc = r"Sets the field bit"]
169    #[inline(always)]
170    pub fn set_bit(self) -> &'a mut W {
171        self.bit(true)
172    }
173    #[doc = r"Clears the field bit"]
174    #[inline(always)]
175    pub fn clear_bit(self) -> &'a mut W {
176        self.bit(false)
177    }
178    #[doc = r"Writes raw bits to the field"]
179    #[inline(always)]
180    pub fn bit(self, value: bool) -> &'a mut W {
181        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
182        self.w
183    }
184}
185impl R {
186    #[doc = "Bits 8:31 - 31:8\\] Reserved"]
187    #[inline(always)]
188    pub fn reserved32(&self) -> RESERVED32_R {
189        RESERVED32_R::new(((self.bits >> 8) & 0x00ff_ffff) as u32)
190    }
191    #[doc = "Bits 6:7 - 7:6\\] Reserved"]
192    #[inline(always)]
193    pub fn reserved8(&self) -> RESERVED8_R {
194        RESERVED8_R::new(((self.bits >> 6) & 0x03) as u8)
195    }
196    #[doc = "Bit 5 - 5:5\\] Interrupt flag for OUT endpoint 5 Cleared by hardware when read"]
197    #[inline(always)]
198    pub fn outep5if(&self) -> OUTEP5IF_R {
199        OUTEP5IF_R::new(((self.bits >> 5) & 0x01) != 0)
200    }
201    #[doc = "Bit 4 - 4:4\\] Interrupt flag for OUT endpoint 4 Cleared by hardware when read"]
202    #[inline(always)]
203    pub fn outep4if(&self) -> OUTEP4IF_R {
204        OUTEP4IF_R::new(((self.bits >> 4) & 0x01) != 0)
205    }
206    #[doc = "Bit 3 - 3:3\\] Interrupt flag for OUT endpoint 3 Cleared by hardware when read"]
207    #[inline(always)]
208    pub fn outep3if(&self) -> OUTEP3IF_R {
209        OUTEP3IF_R::new(((self.bits >> 3) & 0x01) != 0)
210    }
211    #[doc = "Bit 2 - 2:2\\] Interrupt flag for OUT endpoint 2 Cleared by hardware when read"]
212    #[inline(always)]
213    pub fn outep2if(&self) -> OUTEP2IF_R {
214        OUTEP2IF_R::new(((self.bits >> 2) & 0x01) != 0)
215    }
216    #[doc = "Bit 1 - 1:1\\] Interrupt flag for OUT endpoint 1 Cleared by hardware when read"]
217    #[inline(always)]
218    pub fn outep1if(&self) -> OUTEP1IF_R {
219        OUTEP1IF_R::new(((self.bits >> 1) & 0x01) != 0)
220    }
221    #[doc = "Bit 0 - 0:0\\] Reserved"]
222    #[inline(always)]
223    pub fn reserved1(&self) -> RESERVED1_R {
224        RESERVED1_R::new((self.bits & 0x01) != 0)
225    }
226}
227impl W {
228    #[doc = "Bits 8:31 - 31:8\\] Reserved"]
229    #[inline(always)]
230    pub fn reserved32(&mut self) -> RESERVED32_W {
231        RESERVED32_W { w: self }
232    }
233    #[doc = "Bits 6:7 - 7:6\\] Reserved"]
234    #[inline(always)]
235    pub fn reserved8(&mut self) -> RESERVED8_W {
236        RESERVED8_W { w: self }
237    }
238    #[doc = "Bit 5 - 5:5\\] Interrupt flag for OUT endpoint 5 Cleared by hardware when read"]
239    #[inline(always)]
240    pub fn outep5if(&mut self) -> OUTEP5IF_W {
241        OUTEP5IF_W { w: self }
242    }
243    #[doc = "Bit 4 - 4:4\\] Interrupt flag for OUT endpoint 4 Cleared by hardware when read"]
244    #[inline(always)]
245    pub fn outep4if(&mut self) -> OUTEP4IF_W {
246        OUTEP4IF_W { w: self }
247    }
248    #[doc = "Bit 3 - 3:3\\] Interrupt flag for OUT endpoint 3 Cleared by hardware when read"]
249    #[inline(always)]
250    pub fn outep3if(&mut self) -> OUTEP3IF_W {
251        OUTEP3IF_W { w: self }
252    }
253    #[doc = "Bit 2 - 2:2\\] Interrupt flag for OUT endpoint 2 Cleared by hardware when read"]
254    #[inline(always)]
255    pub fn outep2if(&mut self) -> OUTEP2IF_W {
256        OUTEP2IF_W { w: self }
257    }
258    #[doc = "Bit 1 - 1:1\\] Interrupt flag for OUT endpoint 1 Cleared by hardware when read"]
259    #[inline(always)]
260    pub fn outep1if(&mut self) -> OUTEP1IF_W {
261        OUTEP1IF_W { w: self }
262    }
263    #[doc = "Bit 0 - 0:0\\] Reserved"]
264    #[inline(always)]
265    pub fn reserved1(&mut self) -> RESERVED1_W {
266        RESERVED1_W { w: self }
267    }
268}