swm341_pac/usbh/
otgcsr.rs

1#[doc = "Register `OTGCSR` reader"]
2pub struct R(crate::R<OTGCSR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<OTGCSR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<OTGCSR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<OTGCSR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `OTGCSR` writer"]
17pub struct W(crate::W<OTGCSR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<OTGCSR_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<OTGCSR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<OTGCSR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SRSUCC` reader - SRSUCC field"]
38pub type SRSUCC_R = crate::BitReader<bool>;
39#[doc = "Field `SRSUCC` writer - SRSUCC field"]
40pub type SRSUCC_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
41#[doc = "Field `SRSCHG` reader - SRSCHG field"]
42pub type SRSCHG_R = crate::BitReader<bool>;
43#[doc = "Field `SRSCHG` writer - SRSCHG field"]
44pub type SRSCHG_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
45#[doc = "Field `HNSUCC` reader - HNSUCC field"]
46pub type HNSUCC_R = crate::BitReader<bool>;
47#[doc = "Field `HNSUCC` writer - HNSUCC field"]
48pub type HNSUCC_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
49#[doc = "Field `HNSCHG` reader - HNSCHG field"]
50pub type HNSCHG_R = crate::BitReader<bool>;
51#[doc = "Field `HNSCHG` writer - HNSCHG field"]
52pub type HNSCHG_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
53#[doc = "Field `SRDET` reader - SRDET field"]
54pub type SRDET_R = crate::BitReader<bool>;
55#[doc = "Field `SRDET` writer - SRDET field"]
56pub type SRDET_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
57#[doc = "Field `SRDCHG` reader - SRDCHG field"]
58pub type SRDCHG_R = crate::BitReader<bool>;
59#[doc = "Field `SRDCHG` writer - SRDCHG field"]
60pub type SRDCHG_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
61#[doc = "Field `HNDET` reader - HNDET field"]
62pub type HNDET_R = crate::BitReader<bool>;
63#[doc = "Field `HNDET` writer - HNDET field"]
64pub type HNDET_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
65#[doc = "Field `HNDCHG` reader - HNDCHG field"]
66pub type HNDCHG_R = crate::BitReader<bool>;
67#[doc = "Field `HNDCHG` writer - HNDCHG field"]
68pub type HNDCHG_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
69#[doc = "Field `ID` reader - ID field"]
70pub type ID_R = crate::BitReader<bool>;
71#[doc = "Field `ID` writer - ID field"]
72pub type ID_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
73#[doc = "Field `IDCHG` reader - IDCHG field"]
74pub type IDCHG_R = crate::BitReader<bool>;
75#[doc = "Field `IDCHG` writer - IDCHG field"]
76pub type IDCHG_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
77#[doc = "Field `MODE` reader - MODE field"]
78pub type MODE_R = crate::BitReader<bool>;
79#[doc = "Field `MODE` writer - MODE field"]
80pub type MODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
81#[doc = "Field `SRPREQ` reader - SRPREQ field"]
82pub type SRPREQ_R = crate::BitReader<bool>;
83#[doc = "Field `SRPREQ` writer - SRPREQ field"]
84pub type SRPREQ_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
85#[doc = "Field `HNPREQ` reader - HNPREQ field"]
86pub type HNPREQ_R = crate::BitReader<bool>;
87#[doc = "Field `HNPREQ` writer - HNPREQ field"]
88pub type HNPREQ_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
89#[doc = "Field `HHNPENA` reader - HHNPENA field"]
90pub type HHNPENA_R = crate::BitReader<bool>;
91#[doc = "Field `HHNPENA` writer - HHNPENA field"]
92pub type HHNPENA_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
93#[doc = "Field `HNPENA` reader - HNPENA field"]
94pub type HNPENA_R = crate::BitReader<bool>;
95#[doc = "Field `HNPENA` writer - HNPENA field"]
96pub type HNPENA_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
97#[doc = "Field `SRPCAP` reader - SRPCAP field"]
98pub type SRPCAP_R = crate::BitReader<bool>;
99#[doc = "Field `SRPCAP` writer - SRPCAP field"]
100pub type SRPCAP_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
101#[doc = "Field `HNPCAP` reader - HNPCAP field"]
102pub type HNPCAP_R = crate::BitReader<bool>;
103#[doc = "Field `HNPCAP` writer - HNPCAP field"]
104pub type HNPCAP_W<'a, const O: u8> = crate::BitWriter<'a, u32, OTGCSR_SPEC, bool, O>;
105impl R {
106    #[doc = "Bit 0 - SRSUCC field"]
107    #[inline(always)]
108    pub fn srsucc(&self) -> SRSUCC_R {
109        SRSUCC_R::new((self.bits & 1) != 0)
110    }
111    #[doc = "Bit 1 - SRSCHG field"]
112    #[inline(always)]
113    pub fn srschg(&self) -> SRSCHG_R {
114        SRSCHG_R::new(((self.bits >> 1) & 1) != 0)
115    }
116    #[doc = "Bit 2 - HNSUCC field"]
117    #[inline(always)]
118    pub fn hnsucc(&self) -> HNSUCC_R {
119        HNSUCC_R::new(((self.bits >> 2) & 1) != 0)
120    }
121    #[doc = "Bit 3 - HNSCHG field"]
122    #[inline(always)]
123    pub fn hnschg(&self) -> HNSCHG_R {
124        HNSCHG_R::new(((self.bits >> 3) & 1) != 0)
125    }
126    #[doc = "Bit 4 - SRDET field"]
127    #[inline(always)]
128    pub fn srdet(&self) -> SRDET_R {
129        SRDET_R::new(((self.bits >> 4) & 1) != 0)
130    }
131    #[doc = "Bit 5 - SRDCHG field"]
132    #[inline(always)]
133    pub fn srdchg(&self) -> SRDCHG_R {
134        SRDCHG_R::new(((self.bits >> 5) & 1) != 0)
135    }
136    #[doc = "Bit 6 - HNDET field"]
137    #[inline(always)]
138    pub fn hndet(&self) -> HNDET_R {
139        HNDET_R::new(((self.bits >> 6) & 1) != 0)
140    }
141    #[doc = "Bit 7 - HNDCHG field"]
142    #[inline(always)]
143    pub fn hndchg(&self) -> HNDCHG_R {
144        HNDCHG_R::new(((self.bits >> 7) & 1) != 0)
145    }
146    #[doc = "Bit 8 - ID field"]
147    #[inline(always)]
148    pub fn id(&self) -> ID_R {
149        ID_R::new(((self.bits >> 8) & 1) != 0)
150    }
151    #[doc = "Bit 9 - IDCHG field"]
152    #[inline(always)]
153    pub fn idchg(&self) -> IDCHG_R {
154        IDCHG_R::new(((self.bits >> 9) & 1) != 0)
155    }
156    #[doc = "Bit 10 - MODE field"]
157    #[inline(always)]
158    pub fn mode(&self) -> MODE_R {
159        MODE_R::new(((self.bits >> 10) & 1) != 0)
160    }
161    #[doc = "Bit 16 - SRPREQ field"]
162    #[inline(always)]
163    pub fn srpreq(&self) -> SRPREQ_R {
164        SRPREQ_R::new(((self.bits >> 16) & 1) != 0)
165    }
166    #[doc = "Bit 17 - HNPREQ field"]
167    #[inline(always)]
168    pub fn hnpreq(&self) -> HNPREQ_R {
169        HNPREQ_R::new(((self.bits >> 17) & 1) != 0)
170    }
171    #[doc = "Bit 18 - HHNPENA field"]
172    #[inline(always)]
173    pub fn hhnpena(&self) -> HHNPENA_R {
174        HHNPENA_R::new(((self.bits >> 18) & 1) != 0)
175    }
176    #[doc = "Bit 19 - HNPENA field"]
177    #[inline(always)]
178    pub fn hnpena(&self) -> HNPENA_R {
179        HNPENA_R::new(((self.bits >> 19) & 1) != 0)
180    }
181    #[doc = "Bit 20 - SRPCAP field"]
182    #[inline(always)]
183    pub fn srpcap(&self) -> SRPCAP_R {
184        SRPCAP_R::new(((self.bits >> 20) & 1) != 0)
185    }
186    #[doc = "Bit 21 - HNPCAP field"]
187    #[inline(always)]
188    pub fn hnpcap(&self) -> HNPCAP_R {
189        HNPCAP_R::new(((self.bits >> 21) & 1) != 0)
190    }
191}
192impl W {
193    #[doc = "Bit 0 - SRSUCC field"]
194    #[inline(always)]
195    pub fn srsucc(&mut self) -> SRSUCC_W<0> {
196        SRSUCC_W::new(self)
197    }
198    #[doc = "Bit 1 - SRSCHG field"]
199    #[inline(always)]
200    pub fn srschg(&mut self) -> SRSCHG_W<1> {
201        SRSCHG_W::new(self)
202    }
203    #[doc = "Bit 2 - HNSUCC field"]
204    #[inline(always)]
205    pub fn hnsucc(&mut self) -> HNSUCC_W<2> {
206        HNSUCC_W::new(self)
207    }
208    #[doc = "Bit 3 - HNSCHG field"]
209    #[inline(always)]
210    pub fn hnschg(&mut self) -> HNSCHG_W<3> {
211        HNSCHG_W::new(self)
212    }
213    #[doc = "Bit 4 - SRDET field"]
214    #[inline(always)]
215    pub fn srdet(&mut self) -> SRDET_W<4> {
216        SRDET_W::new(self)
217    }
218    #[doc = "Bit 5 - SRDCHG field"]
219    #[inline(always)]
220    pub fn srdchg(&mut self) -> SRDCHG_W<5> {
221        SRDCHG_W::new(self)
222    }
223    #[doc = "Bit 6 - HNDET field"]
224    #[inline(always)]
225    pub fn hndet(&mut self) -> HNDET_W<6> {
226        HNDET_W::new(self)
227    }
228    #[doc = "Bit 7 - HNDCHG field"]
229    #[inline(always)]
230    pub fn hndchg(&mut self) -> HNDCHG_W<7> {
231        HNDCHG_W::new(self)
232    }
233    #[doc = "Bit 8 - ID field"]
234    #[inline(always)]
235    pub fn id(&mut self) -> ID_W<8> {
236        ID_W::new(self)
237    }
238    #[doc = "Bit 9 - IDCHG field"]
239    #[inline(always)]
240    pub fn idchg(&mut self) -> IDCHG_W<9> {
241        IDCHG_W::new(self)
242    }
243    #[doc = "Bit 10 - MODE field"]
244    #[inline(always)]
245    pub fn mode(&mut self) -> MODE_W<10> {
246        MODE_W::new(self)
247    }
248    #[doc = "Bit 16 - SRPREQ field"]
249    #[inline(always)]
250    pub fn srpreq(&mut self) -> SRPREQ_W<16> {
251        SRPREQ_W::new(self)
252    }
253    #[doc = "Bit 17 - HNPREQ field"]
254    #[inline(always)]
255    pub fn hnpreq(&mut self) -> HNPREQ_W<17> {
256        HNPREQ_W::new(self)
257    }
258    #[doc = "Bit 18 - HHNPENA field"]
259    #[inline(always)]
260    pub fn hhnpena(&mut self) -> HHNPENA_W<18> {
261        HHNPENA_W::new(self)
262    }
263    #[doc = "Bit 19 - HNPENA field"]
264    #[inline(always)]
265    pub fn hnpena(&mut self) -> HNPENA_W<19> {
266        HNPENA_W::new(self)
267    }
268    #[doc = "Bit 20 - SRPCAP field"]
269    #[inline(always)]
270    pub fn srpcap(&mut self) -> SRPCAP_W<20> {
271        SRPCAP_W::new(self)
272    }
273    #[doc = "Bit 21 - HNPCAP field"]
274    #[inline(always)]
275    pub fn hnpcap(&mut self) -> HNPCAP_W<21> {
276        HNPCAP_W::new(self)
277    }
278    #[doc = "Writes raw bits to the register."]
279    #[inline(always)]
280    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
281        self.0.bits(bits);
282        self
283    }
284}
285#[doc = "OTGCSR 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 [otgcsr](index.html) module"]
286pub struct OTGCSR_SPEC;
287impl crate::RegisterSpec for OTGCSR_SPEC {
288    type Ux = u32;
289}
290#[doc = "`read()` method returns [otgcsr::R](R) reader structure"]
291impl crate::Readable for OTGCSR_SPEC {
292    type Reader = R;
293}
294#[doc = "`write(|w| ..)` method takes [otgcsr::W](W) writer structure"]
295impl crate::Writable for OTGCSR_SPEC {
296    type Writer = W;
297}
298#[doc = "`reset()` method sets OTGCSR to value 0"]
299impl crate::Resettable for OTGCSR_SPEC {
300    #[inline(always)]
301    fn reset_value() -> Self::Ux {
302        0
303    }
304}