swm341_pac/usbd/
epcfg.rs

1#[doc = "Register `EPCFG[%s]` reader"]
2pub struct R(crate::R<EPCFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<EPCFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<EPCFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<EPCFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `EPCFG[%s]` writer"]
17pub struct W(crate::W<EPCFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<EPCFG_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<EPCFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<EPCFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `EPNR` reader - EPNR field"]
38pub type EPNR_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `EPNR` writer - EPNR field"]
40pub type EPNR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, EPCFG_SPEC, u8, u8, 4, O>;
41#[doc = "Field `DIR` reader - DIR field"]
42pub type DIR_R = crate::BitReader<bool>;
43#[doc = "Field `DIR` writer - DIR field"]
44pub type DIR_W<'a, const O: u8> = crate::BitWriter<'a, u32, EPCFG_SPEC, bool, O>;
45#[doc = "Field `TYPE` reader - TYPE field"]
46pub type TYPE_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `TYPE` writer - TYPE field"]
48pub type TYPE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, EPCFG_SPEC, u8, u8, 2, O>;
49#[doc = "Field `CFG` reader - CFG field"]
50pub type CFG_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `CFG` writer - CFG field"]
52pub type CFG_W<'a, const O: u8> = crate::FieldWriter<'a, u32, EPCFG_SPEC, u8, u8, 4, O>;
53#[doc = "Field `INTF` reader - INTF field"]
54pub type INTF_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `INTF` writer - INTF field"]
56pub type INTF_W<'a, const O: u8> = crate::FieldWriter<'a, u32, EPCFG_SPEC, u8, u8, 4, O>;
57#[doc = "Field `ALT` reader - ALT field"]
58pub type ALT_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `ALT` writer - ALT field"]
60pub type ALT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, EPCFG_SPEC, u8, u8, 4, O>;
61#[doc = "Field `PKSZ` reader - PKSZ field"]
62pub type PKSZ_R = crate::FieldReader<u8, u8>;
63#[doc = "Field `PKSZ` writer - PKSZ field"]
64pub type PKSZ_W<'a, const O: u8> = crate::FieldWriter<'a, u32, EPCFG_SPEC, u8, u8, 8, O>;
65impl R {
66    #[doc = "Bits 0:3 - EPNR field"]
67    #[inline(always)]
68    pub fn epnr(&self) -> EPNR_R {
69        EPNR_R::new((self.bits & 0x0f) as u8)
70    }
71    #[doc = "Bit 4 - DIR field"]
72    #[inline(always)]
73    pub fn dir(&self) -> DIR_R {
74        DIR_R::new(((self.bits >> 4) & 1) != 0)
75    }
76    #[doc = "Bits 5:6 - TYPE field"]
77    #[inline(always)]
78    pub fn type_(&self) -> TYPE_R {
79        TYPE_R::new(((self.bits >> 5) & 3) as u8)
80    }
81    #[doc = "Bits 7:10 - CFG field"]
82    #[inline(always)]
83    pub fn cfg(&self) -> CFG_R {
84        CFG_R::new(((self.bits >> 7) & 0x0f) as u8)
85    }
86    #[doc = "Bits 11:14 - INTF field"]
87    #[inline(always)]
88    pub fn intf(&self) -> INTF_R {
89        INTF_R::new(((self.bits >> 11) & 0x0f) as u8)
90    }
91    #[doc = "Bits 15:18 - ALT field"]
92    #[inline(always)]
93    pub fn alt(&self) -> ALT_R {
94        ALT_R::new(((self.bits >> 15) & 0x0f) as u8)
95    }
96    #[doc = "Bits 19:26 - PKSZ field"]
97    #[inline(always)]
98    pub fn pksz(&self) -> PKSZ_R {
99        PKSZ_R::new(((self.bits >> 19) & 0xff) as u8)
100    }
101}
102impl W {
103    #[doc = "Bits 0:3 - EPNR field"]
104    #[inline(always)]
105    pub fn epnr(&mut self) -> EPNR_W<0> {
106        EPNR_W::new(self)
107    }
108    #[doc = "Bit 4 - DIR field"]
109    #[inline(always)]
110    pub fn dir(&mut self) -> DIR_W<4> {
111        DIR_W::new(self)
112    }
113    #[doc = "Bits 5:6 - TYPE field"]
114    #[inline(always)]
115    pub fn type_(&mut self) -> TYPE_W<5> {
116        TYPE_W::new(self)
117    }
118    #[doc = "Bits 7:10 - CFG field"]
119    #[inline(always)]
120    pub fn cfg(&mut self) -> CFG_W<7> {
121        CFG_W::new(self)
122    }
123    #[doc = "Bits 11:14 - INTF field"]
124    #[inline(always)]
125    pub fn intf(&mut self) -> INTF_W<11> {
126        INTF_W::new(self)
127    }
128    #[doc = "Bits 15:18 - ALT field"]
129    #[inline(always)]
130    pub fn alt(&mut self) -> ALT_W<15> {
131        ALT_W::new(self)
132    }
133    #[doc = "Bits 19:26 - PKSZ field"]
134    #[inline(always)]
135    pub fn pksz(&mut self) -> PKSZ_W<19> {
136        PKSZ_W::new(self)
137    }
138    #[doc = "Writes raw bits to the register."]
139    #[inline(always)]
140    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
141        self.0.bits(bits);
142        self
143    }
144}
145#[doc = "EPCFG 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 [epcfg](index.html) module"]
146pub struct EPCFG_SPEC;
147impl crate::RegisterSpec for EPCFG_SPEC {
148    type Ux = u32;
149}
150#[doc = "`read()` method returns [epcfg::R](R) reader structure"]
151impl crate::Readable for EPCFG_SPEC {
152    type Reader = R;
153}
154#[doc = "`write(|w| ..)` method takes [epcfg::W](W) writer structure"]
155impl crate::Writable for EPCFG_SPEC {
156    type Writer = W;
157}
158#[doc = "`reset()` method sets EPCFG[%s]
159to value 0"]
160impl crate::Resettable for EPCFG_SPEC {
161    #[inline(always)]
162    fn reset_value() -> Self::Ux {
163        0
164    }
165}