swm341_pac/usbd/
devcr.rs

1#[doc = "Register `DEVCR` reader"]
2pub struct R(crate::R<DEVCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DEVCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DEVCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DEVCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `DEVCR` writer"]
17pub struct W(crate::W<DEVCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DEVCR_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<DEVCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DEVCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SPEED` reader - SPEED field"]
38pub type SPEED_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `SPEED` writer - SPEED field"]
40pub type SPEED_W<'a, const O: u8> = crate::FieldWriter<'a, u32, DEVCR_SPEC, u8, u8, 2, O>;
41#[doc = "Field `REMOTEWKUP` reader - REMOTEWKUP field"]
42pub type REMOTEWKUP_R = crate::BitReader<bool>;
43#[doc = "Field `REMOTEWKUP` writer - REMOTEWKUP field"]
44pub type REMOTEWKUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, DEVCR_SPEC, bool, O>;
45#[doc = "Field `SELFPWRD` reader - SELFPWRD field"]
46pub type SELFPWRD_R = crate::BitReader<bool>;
47#[doc = "Field `SELFPWRD` writer - SELFPWRD field"]
48pub type SELFPWRD_W<'a, const O: u8> = crate::BitWriter<'a, u32, DEVCR_SPEC, bool, O>;
49#[doc = "Field `SYNCFRAME` reader - SYNCFRAME field"]
50pub type SYNCFRAME_R = crate::BitReader<bool>;
51#[doc = "Field `SYNCFRAME` writer - SYNCFRAME field"]
52pub type SYNCFRAME_W<'a, const O: u8> = crate::BitWriter<'a, u32, DEVCR_SPEC, bool, O>;
53#[doc = "Field `CSRDONE` reader - CSRDONE field"]
54pub type CSRDONE_R = crate::BitReader<bool>;
55#[doc = "Field `CSRDONE` writer - CSRDONE field"]
56pub type CSRDONE_W<'a, const O: u8> = crate::BitWriter<'a, u32, DEVCR_SPEC, bool, O>;
57#[doc = "Field `SETDESC` reader - SETDESC field"]
58pub type SETDESC_R = crate::BitReader<bool>;
59#[doc = "Field `SETDESC` writer - SETDESC field"]
60pub type SETDESC_W<'a, const O: u8> = crate::BitWriter<'a, u32, DEVCR_SPEC, bool, O>;
61#[doc = "Field `DEVICE` reader - DEVICE field"]
62pub type DEVICE_R = crate::BitReader<bool>;
63#[doc = "Field `DEVICE` writer - DEVICE field"]
64pub type DEVICE_W<'a, const O: u8> = crate::BitWriter<'a, u32, DEVCR_SPEC, bool, O>;
65impl R {
66    #[doc = "Bits 0:1 - SPEED field"]
67    #[inline(always)]
68    pub fn speed(&self) -> SPEED_R {
69        SPEED_R::new((self.bits & 3) as u8)
70    }
71    #[doc = "Bit 2 - REMOTEWKUP field"]
72    #[inline(always)]
73    pub fn remotewkup(&self) -> REMOTEWKUP_R {
74        REMOTEWKUP_R::new(((self.bits >> 2) & 1) != 0)
75    }
76    #[doc = "Bit 3 - SELFPWRD field"]
77    #[inline(always)]
78    pub fn selfpwrd(&self) -> SELFPWRD_R {
79        SELFPWRD_R::new(((self.bits >> 3) & 1) != 0)
80    }
81    #[doc = "Bit 4 - SYNCFRAME field"]
82    #[inline(always)]
83    pub fn syncframe(&self) -> SYNCFRAME_R {
84        SYNCFRAME_R::new(((self.bits >> 4) & 1) != 0)
85    }
86    #[doc = "Bit 6 - CSRDONE field"]
87    #[inline(always)]
88    pub fn csrdone(&self) -> CSRDONE_R {
89        CSRDONE_R::new(((self.bits >> 6) & 1) != 0)
90    }
91    #[doc = "Bit 7 - SETDESC field"]
92    #[inline(always)]
93    pub fn setdesc(&self) -> SETDESC_R {
94        SETDESC_R::new(((self.bits >> 7) & 1) != 0)
95    }
96    #[doc = "Bit 8 - DEVICE field"]
97    #[inline(always)]
98    pub fn device(&self) -> DEVICE_R {
99        DEVICE_R::new(((self.bits >> 8) & 1) != 0)
100    }
101}
102impl W {
103    #[doc = "Bits 0:1 - SPEED field"]
104    #[inline(always)]
105    pub fn speed(&mut self) -> SPEED_W<0> {
106        SPEED_W::new(self)
107    }
108    #[doc = "Bit 2 - REMOTEWKUP field"]
109    #[inline(always)]
110    pub fn remotewkup(&mut self) -> REMOTEWKUP_W<2> {
111        REMOTEWKUP_W::new(self)
112    }
113    #[doc = "Bit 3 - SELFPWRD field"]
114    #[inline(always)]
115    pub fn selfpwrd(&mut self) -> SELFPWRD_W<3> {
116        SELFPWRD_W::new(self)
117    }
118    #[doc = "Bit 4 - SYNCFRAME field"]
119    #[inline(always)]
120    pub fn syncframe(&mut self) -> SYNCFRAME_W<4> {
121        SYNCFRAME_W::new(self)
122    }
123    #[doc = "Bit 6 - CSRDONE field"]
124    #[inline(always)]
125    pub fn csrdone(&mut self) -> CSRDONE_W<6> {
126        CSRDONE_W::new(self)
127    }
128    #[doc = "Bit 7 - SETDESC field"]
129    #[inline(always)]
130    pub fn setdesc(&mut self) -> SETDESC_W<7> {
131        SETDESC_W::new(self)
132    }
133    #[doc = "Bit 8 - DEVICE field"]
134    #[inline(always)]
135    pub fn device(&mut self) -> DEVICE_W<8> {
136        DEVICE_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 = "DEVCR 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 [devcr](index.html) module"]
146pub struct DEVCR_SPEC;
147impl crate::RegisterSpec for DEVCR_SPEC {
148    type Ux = u32;
149}
150#[doc = "`read()` method returns [devcr::R](R) reader structure"]
151impl crate::Readable for DEVCR_SPEC {
152    type Reader = R;
153}
154#[doc = "`write(|w| ..)` method takes [devcr::W](W) writer structure"]
155impl crate::Writable for DEVCR_SPEC {
156    type Writer = W;
157}
158#[doc = "`reset()` method sets DEVCR to value 0"]
159impl crate::Resettable for DEVCR_SPEC {
160    #[inline(always)]
161    fn reset_value() -> Self::Ux {
162        0
163    }
164}