esp32s3/usb0/in_ep0/
dieptsiz.rs

1#[doc = "Register `DIEPTSIZ` reader"]
2pub type R = crate::R<DIEPTSIZ_SPEC>;
3#[doc = "Register `DIEPTSIZ` writer"]
4pub type W = crate::W<DIEPTSIZ_SPEC>;
5#[doc = "Field `XFERSIZE` reader - "]
6pub type XFERSIZE_R = crate::FieldReader;
7#[doc = "Field `XFERSIZE` writer - "]
8pub type XFERSIZE_W<'a, REG> = crate::FieldWriter<'a, REG, 7, u8, crate::Safe>;
9#[doc = "Field `PKTCNT` reader - "]
10pub type PKTCNT_R = crate::FieldReader;
11#[doc = "Field `PKTCNT` writer - "]
12pub type PKTCNT_W<'a, REG> = crate::FieldWriter<'a, REG, 2, u8, crate::Safe>;
13impl R {
14    #[doc = "Bits 0:6"]
15    #[inline(always)]
16    pub fn xfersize(&self) -> XFERSIZE_R {
17        XFERSIZE_R::new((self.bits & 0x7f) as u8)
18    }
19    #[doc = "Bits 19:20"]
20    #[inline(always)]
21    pub fn pktcnt(&self) -> PKTCNT_R {
22        PKTCNT_R::new(((self.bits >> 19) & 3) as u8)
23    }
24}
25#[cfg(feature = "impl-register-debug")]
26impl core::fmt::Debug for R {
27    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
28        f.debug_struct("DIEPTSIZ")
29            .field("xfersize", &self.xfersize())
30            .field("pktcnt", &self.pktcnt())
31            .finish()
32    }
33}
34impl W {
35    #[doc = "Bits 0:6"]
36    #[inline(always)]
37    pub fn xfersize(&mut self) -> XFERSIZE_W<DIEPTSIZ_SPEC> {
38        XFERSIZE_W::new(self, 0)
39    }
40    #[doc = "Bits 19:20"]
41    #[inline(always)]
42    pub fn pktcnt(&mut self) -> PKTCNT_W<DIEPTSIZ_SPEC> {
43        PKTCNT_W::new(self, 19)
44    }
45}
46#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`dieptsiz::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`dieptsiz::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
47pub struct DIEPTSIZ_SPEC;
48impl crate::RegisterSpec for DIEPTSIZ_SPEC {
49    type Ux = u32;
50}
51#[doc = "`read()` method returns [`dieptsiz::R`](R) reader structure"]
52impl crate::Readable for DIEPTSIZ_SPEC {}
53#[doc = "`write(|w| ..)` method takes [`dieptsiz::W`](W) writer structure"]
54impl crate::Writable for DIEPTSIZ_SPEC {
55    type Safety = crate::Unsafe;
56    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
57    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
58}
59#[doc = "`reset()` method sets DIEPTSIZ to value 0"]
60impl crate::Resettable for DIEPTSIZ_SPEC {
61    const RESET_VALUE: u32 = 0;
62}