1#[doc = "Register `CR2` reader"]
2pub struct R(crate::R<CR2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CR2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CR2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CR2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CR2` writer"]
17pub struct W(crate::W<CR2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CR2_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<CR2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CR2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `CLKEN` reader - CLKEN field"]
38pub type CLKEN_R = crate::BitReader<bool>;
39#[doc = "Field `CLKEN` writer - CLKEN field"]
40pub type CLKEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
41#[doc = "Field `CLKRDY` reader - CLKRDY field"]
42pub type CLKRDY_R = crate::BitReader<bool>;
43#[doc = "Field `CLKRDY` writer - CLKRDY field"]
44pub type CLKRDY_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
45#[doc = "Field `SDCLKEN` reader - SDCLKEN field"]
46pub type SDCLKEN_R = crate::BitReader<bool>;
47#[doc = "Field `SDCLKEN` writer - SDCLKEN field"]
48pub type SDCLKEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
49#[doc = "Field `SDCLKDIV` reader - SDCLKDIV field"]
50pub type SDCLKDIV_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `SDCLKDIV` writer - SDCLKDIV field"]
52pub type SDCLKDIV_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR2_SPEC, u8, u8, 8, O>;
53#[doc = "Field `TIMEOUT` reader - TIMEOUT field"]
54pub type TIMEOUT_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `TIMEOUT` writer - TIMEOUT field"]
56pub type TIMEOUT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR2_SPEC, u8, u8, 4, O>;
57#[doc = "Field `RSTALL` reader - RSTALL field"]
58pub type RSTALL_R = crate::BitReader<bool>;
59#[doc = "Field `RSTALL` writer - RSTALL field"]
60pub type RSTALL_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
61#[doc = "Field `RSTCMD` reader - RSTCMD field"]
62pub type RSTCMD_R = crate::BitReader<bool>;
63#[doc = "Field `RSTCMD` writer - RSTCMD field"]
64pub type RSTCMD_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
65#[doc = "Field `RSTDAT` reader - RSTDAT field"]
66pub type RSTDAT_R = crate::BitReader<bool>;
67#[doc = "Field `RSTDAT` writer - RSTDAT field"]
68pub type RSTDAT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
69impl R {
70 #[doc = "Bit 0 - CLKEN field"]
71 #[inline(always)]
72 pub fn clken(&self) -> CLKEN_R {
73 CLKEN_R::new((self.bits & 1) != 0)
74 }
75 #[doc = "Bit 1 - CLKRDY field"]
76 #[inline(always)]
77 pub fn clkrdy(&self) -> CLKRDY_R {
78 CLKRDY_R::new(((self.bits >> 1) & 1) != 0)
79 }
80 #[doc = "Bit 2 - SDCLKEN field"]
81 #[inline(always)]
82 pub fn sdclken(&self) -> SDCLKEN_R {
83 SDCLKEN_R::new(((self.bits >> 2) & 1) != 0)
84 }
85 #[doc = "Bits 8:15 - SDCLKDIV field"]
86 #[inline(always)]
87 pub fn sdclkdiv(&self) -> SDCLKDIV_R {
88 SDCLKDIV_R::new(((self.bits >> 8) & 0xff) as u8)
89 }
90 #[doc = "Bits 16:19 - TIMEOUT field"]
91 #[inline(always)]
92 pub fn timeout(&self) -> TIMEOUT_R {
93 TIMEOUT_R::new(((self.bits >> 16) & 0x0f) as u8)
94 }
95 #[doc = "Bit 24 - RSTALL field"]
96 #[inline(always)]
97 pub fn rstall(&self) -> RSTALL_R {
98 RSTALL_R::new(((self.bits >> 24) & 1) != 0)
99 }
100 #[doc = "Bit 25 - RSTCMD field"]
101 #[inline(always)]
102 pub fn rstcmd(&self) -> RSTCMD_R {
103 RSTCMD_R::new(((self.bits >> 25) & 1) != 0)
104 }
105 #[doc = "Bit 26 - RSTDAT field"]
106 #[inline(always)]
107 pub fn rstdat(&self) -> RSTDAT_R {
108 RSTDAT_R::new(((self.bits >> 26) & 1) != 0)
109 }
110}
111impl W {
112 #[doc = "Bit 0 - CLKEN field"]
113 #[inline(always)]
114 pub fn clken(&mut self) -> CLKEN_W<0> {
115 CLKEN_W::new(self)
116 }
117 #[doc = "Bit 1 - CLKRDY field"]
118 #[inline(always)]
119 pub fn clkrdy(&mut self) -> CLKRDY_W<1> {
120 CLKRDY_W::new(self)
121 }
122 #[doc = "Bit 2 - SDCLKEN field"]
123 #[inline(always)]
124 pub fn sdclken(&mut self) -> SDCLKEN_W<2> {
125 SDCLKEN_W::new(self)
126 }
127 #[doc = "Bits 8:15 - SDCLKDIV field"]
128 #[inline(always)]
129 pub fn sdclkdiv(&mut self) -> SDCLKDIV_W<8> {
130 SDCLKDIV_W::new(self)
131 }
132 #[doc = "Bits 16:19 - TIMEOUT field"]
133 #[inline(always)]
134 pub fn timeout(&mut self) -> TIMEOUT_W<16> {
135 TIMEOUT_W::new(self)
136 }
137 #[doc = "Bit 24 - RSTALL field"]
138 #[inline(always)]
139 pub fn rstall(&mut self) -> RSTALL_W<24> {
140 RSTALL_W::new(self)
141 }
142 #[doc = "Bit 25 - RSTCMD field"]
143 #[inline(always)]
144 pub fn rstcmd(&mut self) -> RSTCMD_W<25> {
145 RSTCMD_W::new(self)
146 }
147 #[doc = "Bit 26 - RSTDAT field"]
148 #[inline(always)]
149 pub fn rstdat(&mut self) -> RSTDAT_W<26> {
150 RSTDAT_W::new(self)
151 }
152 #[doc = "Writes raw bits to the register."]
153 #[inline(always)]
154 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
155 self.0.bits(bits);
156 self
157 }
158}
159#[doc = "CR2 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 [cr2](index.html) module"]
160pub struct CR2_SPEC;
161impl crate::RegisterSpec for CR2_SPEC {
162 type Ux = u32;
163}
164#[doc = "`read()` method returns [cr2::R](R) reader structure"]
165impl crate::Readable for CR2_SPEC {
166 type Reader = R;
167}
168#[doc = "`write(|w| ..)` method takes [cr2::W](W) writer structure"]
169impl crate::Writable for CR2_SPEC {
170 type Writer = W;
171}
172#[doc = "`reset()` method sets CR2 to value 0"]
173impl crate::Resettable for CR2_SPEC {
174 #[inline(always)]
175 fn reset_value() -> Self::Ux {
176 0
177 }
178}