esp32s2/usb0/hc/
char.rs

1#[doc = "Register `CHAR` reader"]
2pub type R = crate::R<CHAR_SPEC>;
3#[doc = "Register `CHAR` writer"]
4pub type W = crate::W<CHAR_SPEC>;
5#[doc = "Field `MPS` reader - "]
6pub type MPS_R = crate::FieldReader<u16>;
7#[doc = "Field `MPS` writer - "]
8pub type MPS_W<'a, REG> = crate::FieldWriter<'a, REG, 11, u16>;
9#[doc = "Field `EPNUM` reader - "]
10pub type EPNUM_R = crate::FieldReader;
11#[doc = "Field `EPNUM` writer - "]
12pub type EPNUM_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
13#[doc = "Field `EPDIR` reader - "]
14pub type EPDIR_R = crate::BitReader;
15#[doc = "Field `EPDIR` writer - "]
16pub type EPDIR_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `LSPDDEV` reader - "]
18pub type LSPDDEV_R = crate::BitReader;
19#[doc = "Field `LSPDDEV` writer - "]
20pub type LSPDDEV_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `EPTYPE` reader - "]
22pub type EPTYPE_R = crate::FieldReader;
23#[doc = "Field `EPTYPE` writer - "]
24pub type EPTYPE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
25#[doc = "Field `EC` reader - "]
26pub type EC_R = crate::FieldReader;
27#[doc = "Field `EC` writer - "]
28pub type EC_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
29#[doc = "Field `DEVADDR` reader - "]
30pub type DEVADDR_R = crate::FieldReader;
31#[doc = "Field `DEVADDR` writer - "]
32pub type DEVADDR_W<'a, REG> = crate::FieldWriter<'a, REG, 7>;
33#[doc = "Field `ODDFRM` reader - "]
34pub type ODDFRM_R = crate::BitReader;
35#[doc = "Field `ODDFRM` writer - "]
36pub type ODDFRM_W<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `CHDIS` reader - "]
38pub type CHDIS_R = crate::BitReader;
39#[doc = "Field `CHDIS` writer - "]
40pub type CHDIS_W<'a, REG> = crate::BitWriter<'a, REG>;
41#[doc = "Field `CHENA` reader - "]
42pub type CHENA_R = crate::BitReader;
43#[doc = "Field `CHENA` writer - "]
44pub type CHENA_W<'a, REG> = crate::BitWriter<'a, REG>;
45impl R {
46    #[doc = "Bits 0:10"]
47    #[inline(always)]
48    pub fn mps(&self) -> MPS_R {
49        MPS_R::new((self.bits & 0x07ff) as u16)
50    }
51    #[doc = "Bits 11:14"]
52    #[inline(always)]
53    pub fn epnum(&self) -> EPNUM_R {
54        EPNUM_R::new(((self.bits >> 11) & 0x0f) as u8)
55    }
56    #[doc = "Bit 15"]
57    #[inline(always)]
58    pub fn epdir(&self) -> EPDIR_R {
59        EPDIR_R::new(((self.bits >> 15) & 1) != 0)
60    }
61    #[doc = "Bit 17"]
62    #[inline(always)]
63    pub fn lspddev(&self) -> LSPDDEV_R {
64        LSPDDEV_R::new(((self.bits >> 17) & 1) != 0)
65    }
66    #[doc = "Bits 18:19"]
67    #[inline(always)]
68    pub fn eptype(&self) -> EPTYPE_R {
69        EPTYPE_R::new(((self.bits >> 18) & 3) as u8)
70    }
71    #[doc = "Bits 20:21"]
72    #[inline(always)]
73    pub fn ec(&self) -> EC_R {
74        EC_R::new(((self.bits >> 20) & 3) as u8)
75    }
76    #[doc = "Bits 22:28"]
77    #[inline(always)]
78    pub fn devaddr(&self) -> DEVADDR_R {
79        DEVADDR_R::new(((self.bits >> 22) & 0x7f) as u8)
80    }
81    #[doc = "Bit 29"]
82    #[inline(always)]
83    pub fn oddfrm(&self) -> ODDFRM_R {
84        ODDFRM_R::new(((self.bits >> 29) & 1) != 0)
85    }
86    #[doc = "Bit 30"]
87    #[inline(always)]
88    pub fn chdis(&self) -> CHDIS_R {
89        CHDIS_R::new(((self.bits >> 30) & 1) != 0)
90    }
91    #[doc = "Bit 31"]
92    #[inline(always)]
93    pub fn chena(&self) -> CHENA_R {
94        CHENA_R::new(((self.bits >> 31) & 1) != 0)
95    }
96}
97#[cfg(feature = "impl-register-debug")]
98impl core::fmt::Debug for R {
99    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
100        f.debug_struct("CHAR")
101            .field("mps", &self.mps())
102            .field("epnum", &self.epnum())
103            .field("epdir", &self.epdir())
104            .field("lspddev", &self.lspddev())
105            .field("eptype", &self.eptype())
106            .field("ec", &self.ec())
107            .field("devaddr", &self.devaddr())
108            .field("oddfrm", &self.oddfrm())
109            .field("chdis", &self.chdis())
110            .field("chena", &self.chena())
111            .finish()
112    }
113}
114impl W {
115    #[doc = "Bits 0:10"]
116    #[inline(always)]
117    pub fn mps(&mut self) -> MPS_W<CHAR_SPEC> {
118        MPS_W::new(self, 0)
119    }
120    #[doc = "Bits 11:14"]
121    #[inline(always)]
122    pub fn epnum(&mut self) -> EPNUM_W<CHAR_SPEC> {
123        EPNUM_W::new(self, 11)
124    }
125    #[doc = "Bit 15"]
126    #[inline(always)]
127    pub fn epdir(&mut self) -> EPDIR_W<CHAR_SPEC> {
128        EPDIR_W::new(self, 15)
129    }
130    #[doc = "Bit 17"]
131    #[inline(always)]
132    pub fn lspddev(&mut self) -> LSPDDEV_W<CHAR_SPEC> {
133        LSPDDEV_W::new(self, 17)
134    }
135    #[doc = "Bits 18:19"]
136    #[inline(always)]
137    pub fn eptype(&mut self) -> EPTYPE_W<CHAR_SPEC> {
138        EPTYPE_W::new(self, 18)
139    }
140    #[doc = "Bits 20:21"]
141    #[inline(always)]
142    pub fn ec(&mut self) -> EC_W<CHAR_SPEC> {
143        EC_W::new(self, 20)
144    }
145    #[doc = "Bits 22:28"]
146    #[inline(always)]
147    pub fn devaddr(&mut self) -> DEVADDR_W<CHAR_SPEC> {
148        DEVADDR_W::new(self, 22)
149    }
150    #[doc = "Bit 29"]
151    #[inline(always)]
152    pub fn oddfrm(&mut self) -> ODDFRM_W<CHAR_SPEC> {
153        ODDFRM_W::new(self, 29)
154    }
155    #[doc = "Bit 30"]
156    #[inline(always)]
157    pub fn chdis(&mut self) -> CHDIS_W<CHAR_SPEC> {
158        CHDIS_W::new(self, 30)
159    }
160    #[doc = "Bit 31"]
161    #[inline(always)]
162    pub fn chena(&mut self) -> CHENA_W<CHAR_SPEC> {
163        CHENA_W::new(self, 31)
164    }
165}
166#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`char::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`char::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
167pub struct CHAR_SPEC;
168impl crate::RegisterSpec for CHAR_SPEC {
169    type Ux = u32;
170}
171#[doc = "`read()` method returns [`char::R`](R) reader structure"]
172impl crate::Readable for CHAR_SPEC {}
173#[doc = "`write(|w| ..)` method takes [`char::W`](W) writer structure"]
174impl crate::Writable for CHAR_SPEC {
175    type Safety = crate::Unsafe;
176}
177#[doc = "`reset()` method sets CHAR to value 0"]
178impl crate::Resettable for CHAR_SPEC {}