stm32wb_pac/usb/
istr.rs

1#[doc = "Reader of register ISTR"]
2pub type R = crate::R<u16, super::ISTR>;
3#[doc = "Writer for register ISTR"]
4pub type W = crate::W<u16, super::ISTR>;
5#[doc = "Register ISTR `reset()`'s with value 0"]
6impl crate::ResetValue for super::ISTR {
7    type Type = u16;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `EP_ID`"]
14pub type EP_ID_R = crate::R<u8, u8>;
15#[doc = "Reader of field `DIR`"]
16pub type DIR_R = crate::R<bool, bool>;
17#[doc = "Reader of field `L1REQ`"]
18pub type L1REQ_R = crate::R<bool, bool>;
19#[doc = "Write proxy for field `L1REQ`"]
20pub struct L1REQ_W<'a> {
21    w: &'a mut W,
22}
23impl<'a> L1REQ_W<'a> {
24    #[doc = r"Sets the field bit"]
25    #[inline(always)]
26    pub fn set_bit(self) -> &'a mut W {
27        self.bit(true)
28    }
29    #[doc = r"Clears the field bit"]
30    #[inline(always)]
31    pub fn clear_bit(self) -> &'a mut W {
32        self.bit(false)
33    }
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub fn bit(self, value: bool) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u16) & 0x01) << 7);
38        self.w
39    }
40}
41#[doc = "Reader of field `ESOF`"]
42pub type ESOF_R = crate::R<bool, bool>;
43#[doc = "Write proxy for field `ESOF`"]
44pub struct ESOF_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> ESOF_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 << 8)) | (((value as u16) & 0x01) << 8);
62        self.w
63    }
64}
65#[doc = "Reader of field `SOF`"]
66pub type SOF_R = crate::R<bool, bool>;
67#[doc = "Write proxy for field `SOF`"]
68pub struct SOF_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> SOF_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 << 9)) | (((value as u16) & 0x01) << 9);
86        self.w
87    }
88}
89#[doc = "Reader of field `RESET`"]
90pub type RESET_R = crate::R<bool, bool>;
91#[doc = "Write proxy for field `RESET`"]
92pub struct RESET_W<'a> {
93    w: &'a mut W,
94}
95impl<'a> RESET_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 << 10)) | (((value as u16) & 0x01) << 10);
110        self.w
111    }
112}
113#[doc = "Reader of field `SUSP`"]
114pub type SUSP_R = crate::R<bool, bool>;
115#[doc = "Write proxy for field `SUSP`"]
116pub struct SUSP_W<'a> {
117    w: &'a mut W,
118}
119impl<'a> SUSP_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 << 11)) | (((value as u16) & 0x01) << 11);
134        self.w
135    }
136}
137#[doc = "Reader of field `WKUP`"]
138pub type WKUP_R = crate::R<bool, bool>;
139#[doc = "Write proxy for field `WKUP`"]
140pub struct WKUP_W<'a> {
141    w: &'a mut W,
142}
143impl<'a> WKUP_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 << 12)) | (((value as u16) & 0x01) << 12);
158        self.w
159    }
160}
161#[doc = "Reader of field `ERR`"]
162pub type ERR_R = crate::R<bool, bool>;
163#[doc = "Write proxy for field `ERR`"]
164pub struct ERR_W<'a> {
165    w: &'a mut W,
166}
167impl<'a> ERR_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 << 13)) | (((value as u16) & 0x01) << 13);
182        self.w
183    }
184}
185#[doc = "Reader of field `PMAOVR`"]
186pub type PMAOVR_R = crate::R<bool, bool>;
187#[doc = "Write proxy for field `PMAOVR`"]
188pub struct PMAOVR_W<'a> {
189    w: &'a mut W,
190}
191impl<'a> PMAOVR_W<'a> {
192    #[doc = r"Sets the field bit"]
193    #[inline(always)]
194    pub fn set_bit(self) -> &'a mut W {
195        self.bit(true)
196    }
197    #[doc = r"Clears the field bit"]
198    #[inline(always)]
199    pub fn clear_bit(self) -> &'a mut W {
200        self.bit(false)
201    }
202    #[doc = r"Writes raw bits to the field"]
203    #[inline(always)]
204    pub fn bit(self, value: bool) -> &'a mut W {
205        self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u16) & 0x01) << 14);
206        self.w
207    }
208}
209#[doc = "Reader of field `CTR`"]
210pub type CTR_R = crate::R<bool, bool>;
211impl R {
212    #[doc = "Bits 0:3 - Endpoint Identifier"]
213    #[inline(always)]
214    pub fn ep_id(&self) -> EP_ID_R {
215        EP_ID_R::new((self.bits & 0x0f) as u8)
216    }
217    #[doc = "Bit 4 - Direction of transaction"]
218    #[inline(always)]
219    pub fn dir(&self) -> DIR_R {
220        DIR_R::new(((self.bits >> 4) & 0x01) != 0)
221    }
222    #[doc = "Bit 7 - LPM L1 state request"]
223    #[inline(always)]
224    pub fn l1req(&self) -> L1REQ_R {
225        L1REQ_R::new(((self.bits >> 7) & 0x01) != 0)
226    }
227    #[doc = "Bit 8 - Expected start frame"]
228    #[inline(always)]
229    pub fn esof(&self) -> ESOF_R {
230        ESOF_R::new(((self.bits >> 8) & 0x01) != 0)
231    }
232    #[doc = "Bit 9 - start of frame"]
233    #[inline(always)]
234    pub fn sof(&self) -> SOF_R {
235        SOF_R::new(((self.bits >> 9) & 0x01) != 0)
236    }
237    #[doc = "Bit 10 - reset request"]
238    #[inline(always)]
239    pub fn reset(&self) -> RESET_R {
240        RESET_R::new(((self.bits >> 10) & 0x01) != 0)
241    }
242    #[doc = "Bit 11 - Suspend mode request"]
243    #[inline(always)]
244    pub fn susp(&self) -> SUSP_R {
245        SUSP_R::new(((self.bits >> 11) & 0x01) != 0)
246    }
247    #[doc = "Bit 12 - Wakeup"]
248    #[inline(always)]
249    pub fn wkup(&self) -> WKUP_R {
250        WKUP_R::new(((self.bits >> 12) & 0x01) != 0)
251    }
252    #[doc = "Bit 13 - Error"]
253    #[inline(always)]
254    pub fn err(&self) -> ERR_R {
255        ERR_R::new(((self.bits >> 13) & 0x01) != 0)
256    }
257    #[doc = "Bit 14 - Packet memory area over / underrun"]
258    #[inline(always)]
259    pub fn pmaovr(&self) -> PMAOVR_R {
260        PMAOVR_R::new(((self.bits >> 14) & 0x01) != 0)
261    }
262    #[doc = "Bit 15 - Correct transfer"]
263    #[inline(always)]
264    pub fn ctr(&self) -> CTR_R {
265        CTR_R::new(((self.bits >> 15) & 0x01) != 0)
266    }
267}
268impl W {
269    #[doc = "Bit 7 - LPM L1 state request"]
270    #[inline(always)]
271    pub fn l1req(&mut self) -> L1REQ_W {
272        L1REQ_W { w: self }
273    }
274    #[doc = "Bit 8 - Expected start frame"]
275    #[inline(always)]
276    pub fn esof(&mut self) -> ESOF_W {
277        ESOF_W { w: self }
278    }
279    #[doc = "Bit 9 - start of frame"]
280    #[inline(always)]
281    pub fn sof(&mut self) -> SOF_W {
282        SOF_W { w: self }
283    }
284    #[doc = "Bit 10 - reset request"]
285    #[inline(always)]
286    pub fn reset(&mut self) -> RESET_W {
287        RESET_W { w: self }
288    }
289    #[doc = "Bit 11 - Suspend mode request"]
290    #[inline(always)]
291    pub fn susp(&mut self) -> SUSP_W {
292        SUSP_W { w: self }
293    }
294    #[doc = "Bit 12 - Wakeup"]
295    #[inline(always)]
296    pub fn wkup(&mut self) -> WKUP_W {
297        WKUP_W { w: self }
298    }
299    #[doc = "Bit 13 - Error"]
300    #[inline(always)]
301    pub fn err(&mut self) -> ERR_W {
302        ERR_W { w: self }
303    }
304    #[doc = "Bit 14 - Packet memory area over / underrun"]
305    #[inline(always)]
306    pub fn pmaovr(&mut self) -> PMAOVR_W {
307        PMAOVR_W { w: self }
308    }
309}