esp32s3/usb0/
hprt.rs

1#[doc = "Register `HPRT` reader"]
2pub type R = crate::R<HPRT_SPEC>;
3#[doc = "Register `HPRT` writer"]
4pub type W = crate::W<HPRT_SPEC>;
5#[doc = "Field `PRTCONNSTS` reader - "]
6pub type PRTCONNSTS_R = crate::BitReader;
7#[doc = "Field `PRTCONNDET` reader - "]
8pub type PRTCONNDET_R = crate::BitReader;
9#[doc = "Field `PRTCONNDET` writer - "]
10pub type PRTCONNDET_W<'a, REG> = crate::BitWriter1C<'a, REG>;
11#[doc = "Field `PRTENA` reader - "]
12pub type PRTENA_R = crate::BitReader;
13#[doc = "Field `PRTENA` writer - "]
14pub type PRTENA_W<'a, REG> = crate::BitWriter1C<'a, REG>;
15#[doc = "Field `PRTENCHNG` reader - "]
16pub type PRTENCHNG_R = crate::BitReader;
17#[doc = "Field `PRTENCHNG` writer - "]
18pub type PRTENCHNG_W<'a, REG> = crate::BitWriter1C<'a, REG>;
19#[doc = "Field `PRTOVRCURRACT` reader - "]
20pub type PRTOVRCURRACT_R = crate::BitReader;
21#[doc = "Field `PRTOVRCURRCHNG` reader - "]
22pub type PRTOVRCURRCHNG_R = crate::BitReader;
23#[doc = "Field `PRTOVRCURRCHNG` writer - "]
24pub type PRTOVRCURRCHNG_W<'a, REG> = crate::BitWriter1C<'a, REG>;
25#[doc = "Field `PRTRES` reader - "]
26pub type PRTRES_R = crate::BitReader;
27#[doc = "Field `PRTRES` writer - "]
28pub type PRTRES_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `PRTSUSP` reader - "]
30pub type PRTSUSP_R = crate::BitReader;
31#[doc = "Field `PRTSUSP` writer - "]
32pub type PRTSUSP_W<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `PRTRST` reader - "]
34pub type PRTRST_R = crate::BitReader;
35#[doc = "Field `PRTRST` writer - "]
36pub type PRTRST_W<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `PRTLNSTS` reader - "]
38pub type PRTLNSTS_R = crate::FieldReader;
39#[doc = "Field `PRTPWR` reader - "]
40pub type PRTPWR_R = crate::BitReader;
41#[doc = "Field `PRTPWR` writer - "]
42pub type PRTPWR_W<'a, REG> = crate::BitWriter<'a, REG>;
43#[doc = "Field `PRTTSTCTL` reader - "]
44pub type PRTTSTCTL_R = crate::FieldReader;
45#[doc = "Field `PRTTSTCTL` writer - "]
46pub type PRTTSTCTL_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
47#[doc = "Field `PRTSPD` reader - "]
48pub type PRTSPD_R = crate::FieldReader;
49impl R {
50    #[doc = "Bit 0"]
51    #[inline(always)]
52    pub fn prtconnsts(&self) -> PRTCONNSTS_R {
53        PRTCONNSTS_R::new((self.bits & 1) != 0)
54    }
55    #[doc = "Bit 1"]
56    #[inline(always)]
57    pub fn prtconndet(&self) -> PRTCONNDET_R {
58        PRTCONNDET_R::new(((self.bits >> 1) & 1) != 0)
59    }
60    #[doc = "Bit 2"]
61    #[inline(always)]
62    pub fn prtena(&self) -> PRTENA_R {
63        PRTENA_R::new(((self.bits >> 2) & 1) != 0)
64    }
65    #[doc = "Bit 3"]
66    #[inline(always)]
67    pub fn prtenchng(&self) -> PRTENCHNG_R {
68        PRTENCHNG_R::new(((self.bits >> 3) & 1) != 0)
69    }
70    #[doc = "Bit 4"]
71    #[inline(always)]
72    pub fn prtovrcurract(&self) -> PRTOVRCURRACT_R {
73        PRTOVRCURRACT_R::new(((self.bits >> 4) & 1) != 0)
74    }
75    #[doc = "Bit 5"]
76    #[inline(always)]
77    pub fn prtovrcurrchng(&self) -> PRTOVRCURRCHNG_R {
78        PRTOVRCURRCHNG_R::new(((self.bits >> 5) & 1) != 0)
79    }
80    #[doc = "Bit 6"]
81    #[inline(always)]
82    pub fn prtres(&self) -> PRTRES_R {
83        PRTRES_R::new(((self.bits >> 6) & 1) != 0)
84    }
85    #[doc = "Bit 7"]
86    #[inline(always)]
87    pub fn prtsusp(&self) -> PRTSUSP_R {
88        PRTSUSP_R::new(((self.bits >> 7) & 1) != 0)
89    }
90    #[doc = "Bit 8"]
91    #[inline(always)]
92    pub fn prtrst(&self) -> PRTRST_R {
93        PRTRST_R::new(((self.bits >> 8) & 1) != 0)
94    }
95    #[doc = "Bits 10:11"]
96    #[inline(always)]
97    pub fn prtlnsts(&self) -> PRTLNSTS_R {
98        PRTLNSTS_R::new(((self.bits >> 10) & 3) as u8)
99    }
100    #[doc = "Bit 12"]
101    #[inline(always)]
102    pub fn prtpwr(&self) -> PRTPWR_R {
103        PRTPWR_R::new(((self.bits >> 12) & 1) != 0)
104    }
105    #[doc = "Bits 13:16"]
106    #[inline(always)]
107    pub fn prttstctl(&self) -> PRTTSTCTL_R {
108        PRTTSTCTL_R::new(((self.bits >> 13) & 0x0f) as u8)
109    }
110    #[doc = "Bits 17:18"]
111    #[inline(always)]
112    pub fn prtspd(&self) -> PRTSPD_R {
113        PRTSPD_R::new(((self.bits >> 17) & 3) as u8)
114    }
115}
116#[cfg(feature = "impl-register-debug")]
117impl core::fmt::Debug for R {
118    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
119        f.debug_struct("HPRT")
120            .field("prtconnsts", &self.prtconnsts())
121            .field("prtconndet", &self.prtconndet())
122            .field("prtena", &self.prtena())
123            .field("prtenchng", &self.prtenchng())
124            .field("prtovrcurract", &self.prtovrcurract())
125            .field("prtovrcurrchng", &self.prtovrcurrchng())
126            .field("prtres", &self.prtres())
127            .field("prtsusp", &self.prtsusp())
128            .field("prtrst", &self.prtrst())
129            .field("prtlnsts", &self.prtlnsts())
130            .field("prtpwr", &self.prtpwr())
131            .field("prttstctl", &self.prttstctl())
132            .field("prtspd", &self.prtspd())
133            .finish()
134    }
135}
136impl W {
137    #[doc = "Bit 1"]
138    #[inline(always)]
139    pub fn prtconndet(&mut self) -> PRTCONNDET_W<HPRT_SPEC> {
140        PRTCONNDET_W::new(self, 1)
141    }
142    #[doc = "Bit 2"]
143    #[inline(always)]
144    pub fn prtena(&mut self) -> PRTENA_W<HPRT_SPEC> {
145        PRTENA_W::new(self, 2)
146    }
147    #[doc = "Bit 3"]
148    #[inline(always)]
149    pub fn prtenchng(&mut self) -> PRTENCHNG_W<HPRT_SPEC> {
150        PRTENCHNG_W::new(self, 3)
151    }
152    #[doc = "Bit 5"]
153    #[inline(always)]
154    pub fn prtovrcurrchng(&mut self) -> PRTOVRCURRCHNG_W<HPRT_SPEC> {
155        PRTOVRCURRCHNG_W::new(self, 5)
156    }
157    #[doc = "Bit 6"]
158    #[inline(always)]
159    pub fn prtres(&mut self) -> PRTRES_W<HPRT_SPEC> {
160        PRTRES_W::new(self, 6)
161    }
162    #[doc = "Bit 7"]
163    #[inline(always)]
164    pub fn prtsusp(&mut self) -> PRTSUSP_W<HPRT_SPEC> {
165        PRTSUSP_W::new(self, 7)
166    }
167    #[doc = "Bit 8"]
168    #[inline(always)]
169    pub fn prtrst(&mut self) -> PRTRST_W<HPRT_SPEC> {
170        PRTRST_W::new(self, 8)
171    }
172    #[doc = "Bit 12"]
173    #[inline(always)]
174    pub fn prtpwr(&mut self) -> PRTPWR_W<HPRT_SPEC> {
175        PRTPWR_W::new(self, 12)
176    }
177    #[doc = "Bits 13:16"]
178    #[inline(always)]
179    pub fn prttstctl(&mut self) -> PRTTSTCTL_W<HPRT_SPEC> {
180        PRTTSTCTL_W::new(self, 13)
181    }
182}
183#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`hprt::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`hprt::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
184pub struct HPRT_SPEC;
185impl crate::RegisterSpec for HPRT_SPEC {
186    type Ux = u32;
187}
188#[doc = "`read()` method returns [`hprt::R`](R) reader structure"]
189impl crate::Readable for HPRT_SPEC {}
190#[doc = "`write(|w| ..)` method takes [`hprt::W`](W) writer structure"]
191impl crate::Writable for HPRT_SPEC {
192    type Safety = crate::Unsafe;
193    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x2e;
194}
195#[doc = "`reset()` method sets HPRT to value 0"]
196impl crate::Resettable for HPRT_SPEC {}