rp2040_pac/usbctrl_dpram/
setup_packet_low.rs

1#[doc = "Register `SETUP_PACKET_LOW` reader"]
2pub type R = crate::R<SETUP_PACKET_LOW_SPEC>;
3#[doc = "Register `SETUP_PACKET_LOW` writer"]
4pub type W = crate::W<SETUP_PACKET_LOW_SPEC>;
5#[doc = "Field `BMREQUESTTYPE` reader - "]
6pub type BMREQUESTTYPE_R = crate::FieldReader;
7#[doc = "Field `BMREQUESTTYPE` writer - "]
8pub type BMREQUESTTYPE_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[doc = "Field `BREQUEST` reader - "]
10pub type BREQUEST_R = crate::FieldReader;
11#[doc = "Field `BREQUEST` writer - "]
12pub type BREQUEST_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13#[doc = "Field `WVALUE` reader - "]
14pub type WVALUE_R = crate::FieldReader<u16>;
15#[doc = "Field `WVALUE` writer - "]
16pub type WVALUE_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
17impl R {
18    #[doc = "Bits 0:7"]
19    #[inline(always)]
20    pub fn bmrequesttype(&self) -> BMREQUESTTYPE_R {
21        BMREQUESTTYPE_R::new((self.bits & 0xff) as u8)
22    }
23    #[doc = "Bits 8:15"]
24    #[inline(always)]
25    pub fn brequest(&self) -> BREQUEST_R {
26        BREQUEST_R::new(((self.bits >> 8) & 0xff) as u8)
27    }
28    #[doc = "Bits 16:31"]
29    #[inline(always)]
30    pub fn wvalue(&self) -> WVALUE_R {
31        WVALUE_R::new(((self.bits >> 16) & 0xffff) as u16)
32    }
33}
34impl W {
35    #[doc = "Bits 0:7"]
36    #[inline(always)]
37    #[must_use]
38    pub fn bmrequesttype(&mut self) -> BMREQUESTTYPE_W<SETUP_PACKET_LOW_SPEC> {
39        BMREQUESTTYPE_W::new(self, 0)
40    }
41    #[doc = "Bits 8:15"]
42    #[inline(always)]
43    #[must_use]
44    pub fn brequest(&mut self) -> BREQUEST_W<SETUP_PACKET_LOW_SPEC> {
45        BREQUEST_W::new(self, 8)
46    }
47    #[doc = "Bits 16:31"]
48    #[inline(always)]
49    #[must_use]
50    pub fn wvalue(&mut self) -> WVALUE_W<SETUP_PACKET_LOW_SPEC> {
51        WVALUE_W::new(self, 16)
52    }
53    #[doc = r" Writes raw bits to the register."]
54    #[doc = r""]
55    #[doc = r" # Safety"]
56    #[doc = r""]
57    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
58    #[inline(always)]
59    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
60        self.bits = bits;
61        self
62    }
63}
64#[doc = "Bytes 0-3 of the SETUP packet from the host.  
65
66You can [`read`](crate::generic::Reg::read) this register and get [`setup_packet_low::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`setup_packet_low::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
67pub struct SETUP_PACKET_LOW_SPEC;
68impl crate::RegisterSpec for SETUP_PACKET_LOW_SPEC {
69    type Ux = u32;
70}
71#[doc = "`read()` method returns [`setup_packet_low::R`](R) reader structure"]
72impl crate::Readable for SETUP_PACKET_LOW_SPEC {}
73#[doc = "`write(|w| ..)` method takes [`setup_packet_low::W`](W) writer structure"]
74impl crate::Writable for SETUP_PACKET_LOW_SPEC {
75    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
76    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
77}
78#[doc = "`reset()` method sets SETUP_PACKET_LOW to value 0"]
79impl crate::Resettable for SETUP_PACKET_LOW_SPEC {
80    const RESET_VALUE: u32 = 0;
81}