esp8266/io_mux/
io_mux_sd_cmd.rs1#[doc = "Register `IO_MUX_SD_CMD` reader"]
2pub struct R(crate::R<IO_MUX_SD_CMD_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<IO_MUX_SD_CMD_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<IO_MUX_SD_CMD_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<IO_MUX_SD_CMD_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `IO_MUX_SD_CMD` writer"]
17pub struct W(crate::W<IO_MUX_SD_CMD_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<IO_MUX_SD_CMD_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<IO_MUX_SD_CMD_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<IO_MUX_SD_CMD_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `Register` reader - "]
38pub struct REGISTER_R(crate::FieldReader<u32, u32>);
39impl REGISTER_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u32) -> Self {
42 REGISTER_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for REGISTER_R {
46 type Target = crate::FieldReader<u32, u32>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `Register` writer - "]
53pub struct REGISTER_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> REGISTER_W<'a> {
57 #[doc = r"Writes raw bits to the field"]
58 #[inline(always)]
59 pub unsafe fn bits(self, value: u32) -> &'a mut W {
60 self.w.bits = value;
61 self.w
62 }
63}
64#[doc = "Field `FUNCTION_SELECT_LOW_BITS` reader - configures IO_MUX function, bottom 2 bits"]
65pub struct FUNCTION_SELECT_LOW_BITS_R(crate::FieldReader<u8, u8>);
66impl FUNCTION_SELECT_LOW_BITS_R {
67 #[inline(always)]
68 pub(crate) fn new(bits: u8) -> Self {
69 FUNCTION_SELECT_LOW_BITS_R(crate::FieldReader::new(bits))
70 }
71}
72impl core::ops::Deref for FUNCTION_SELECT_LOW_BITS_R {
73 type Target = crate::FieldReader<u8, u8>;
74 #[inline(always)]
75 fn deref(&self) -> &Self::Target {
76 &self.0
77 }
78}
79#[doc = "Field `FUNCTION_SELECT_LOW_BITS` writer - configures IO_MUX function, bottom 2 bits"]
80pub struct FUNCTION_SELECT_LOW_BITS_W<'a> {
81 w: &'a mut W,
82}
83impl<'a> FUNCTION_SELECT_LOW_BITS_W<'a> {
84 #[doc = r"Writes raw bits to the field"]
85 #[inline(always)]
86 pub unsafe fn bits(self, value: u8) -> &'a mut W {
87 self.w.bits = (self.w.bits & !(3 << 4)) | ((value as u32 & 3) << 4);
88 self.w
89 }
90}
91#[doc = "Field `FUNCTION_SELECT_HIGH_BIT` reader - configures IO_MUX function, upper bit"]
92pub struct FUNCTION_SELECT_HIGH_BIT_R(crate::FieldReader<bool, bool>);
93impl FUNCTION_SELECT_HIGH_BIT_R {
94 #[inline(always)]
95 pub(crate) fn new(bits: bool) -> Self {
96 FUNCTION_SELECT_HIGH_BIT_R(crate::FieldReader::new(bits))
97 }
98}
99impl core::ops::Deref for FUNCTION_SELECT_HIGH_BIT_R {
100 type Target = crate::FieldReader<bool, bool>;
101 #[inline(always)]
102 fn deref(&self) -> &Self::Target {
103 &self.0
104 }
105}
106#[doc = "Field `FUNCTION_SELECT_HIGH_BIT` writer - configures IO_MUX function, upper bit"]
107pub struct FUNCTION_SELECT_HIGH_BIT_W<'a> {
108 w: &'a mut W,
109}
110impl<'a> FUNCTION_SELECT_HIGH_BIT_W<'a> {
111 #[doc = r"Sets the field bit"]
112 #[inline(always)]
113 pub fn set_bit(self) -> &'a mut W {
114 self.bit(true)
115 }
116 #[doc = r"Clears the field bit"]
117 #[inline(always)]
118 pub fn clear_bit(self) -> &'a mut W {
119 self.bit(false)
120 }
121 #[doc = r"Writes raw bits to the field"]
122 #[inline(always)]
123 pub fn bit(self, value: bool) -> &'a mut W {
124 self.w.bits = (self.w.bits & !(1 << 8)) | ((value as u32 & 1) << 8);
125 self.w
126 }
127}
128#[doc = "Field `PULLUP` reader - configures pull up"]
129pub struct PULLUP_R(crate::FieldReader<bool, bool>);
130impl PULLUP_R {
131 #[inline(always)]
132 pub(crate) fn new(bits: bool) -> Self {
133 PULLUP_R(crate::FieldReader::new(bits))
134 }
135}
136impl core::ops::Deref for PULLUP_R {
137 type Target = crate::FieldReader<bool, bool>;
138 #[inline(always)]
139 fn deref(&self) -> &Self::Target {
140 &self.0
141 }
142}
143#[doc = "Field `PULLUP` writer - configures pull up"]
144pub struct PULLUP_W<'a> {
145 w: &'a mut W,
146}
147impl<'a> PULLUP_W<'a> {
148 #[doc = r"Sets the field bit"]
149 #[inline(always)]
150 pub fn set_bit(self) -> &'a mut W {
151 self.bit(true)
152 }
153 #[doc = r"Clears the field bit"]
154 #[inline(always)]
155 pub fn clear_bit(self) -> &'a mut W {
156 self.bit(false)
157 }
158 #[doc = r"Writes raw bits to the field"]
159 #[inline(always)]
160 pub fn bit(self, value: bool) -> &'a mut W {
161 self.w.bits = (self.w.bits & !(1 << 7)) | ((value as u32 & 1) << 7);
162 self.w
163 }
164}
165#[doc = "Field `SLEEP_PULLUP` reader - configures pull up during sleep mode"]
166pub struct SLEEP_PULLUP_R(crate::FieldReader<bool, bool>);
167impl SLEEP_PULLUP_R {
168 #[inline(always)]
169 pub(crate) fn new(bits: bool) -> Self {
170 SLEEP_PULLUP_R(crate::FieldReader::new(bits))
171 }
172}
173impl core::ops::Deref for SLEEP_PULLUP_R {
174 type Target = crate::FieldReader<bool, bool>;
175 #[inline(always)]
176 fn deref(&self) -> &Self::Target {
177 &self.0
178 }
179}
180#[doc = "Field `SLEEP_PULLUP` writer - configures pull up during sleep mode"]
181pub struct SLEEP_PULLUP_W<'a> {
182 w: &'a mut W,
183}
184impl<'a> SLEEP_PULLUP_W<'a> {
185 #[doc = r"Sets the field bit"]
186 #[inline(always)]
187 pub fn set_bit(self) -> &'a mut W {
188 self.bit(true)
189 }
190 #[doc = r"Clears the field bit"]
191 #[inline(always)]
192 pub fn clear_bit(self) -> &'a mut W {
193 self.bit(false)
194 }
195 #[doc = r"Writes raw bits to the field"]
196 #[inline(always)]
197 pub fn bit(self, value: bool) -> &'a mut W {
198 self.w.bits = (self.w.bits & !(1 << 3)) | ((value as u32 & 1) << 3);
199 self.w
200 }
201}
202#[doc = "Field `SLEEP_ENABLE` reader - configures output enable during sleep mode"]
203pub struct SLEEP_ENABLE_R(crate::FieldReader<bool, bool>);
204impl SLEEP_ENABLE_R {
205 #[inline(always)]
206 pub(crate) fn new(bits: bool) -> Self {
207 SLEEP_ENABLE_R(crate::FieldReader::new(bits))
208 }
209}
210impl core::ops::Deref for SLEEP_ENABLE_R {
211 type Target = crate::FieldReader<bool, bool>;
212 #[inline(always)]
213 fn deref(&self) -> &Self::Target {
214 &self.0
215 }
216}
217#[doc = "Field `SLEEP_ENABLE` writer - configures output enable during sleep mode"]
218pub struct SLEEP_ENABLE_W<'a> {
219 w: &'a mut W,
220}
221impl<'a> SLEEP_ENABLE_W<'a> {
222 #[doc = r"Sets the field bit"]
223 #[inline(always)]
224 pub fn set_bit(self) -> &'a mut W {
225 self.bit(true)
226 }
227 #[doc = r"Clears the field bit"]
228 #[inline(always)]
229 pub fn clear_bit(self) -> &'a mut W {
230 self.bit(false)
231 }
232 #[doc = r"Writes raw bits to the field"]
233 #[inline(always)]
234 pub fn bit(self, value: bool) -> &'a mut W {
235 self.w.bits = (self.w.bits & !1) | (value as u32 & 1);
236 self.w
237 }
238}
239impl R {
240 #[doc = "Bits 0:31"]
241 #[inline(always)]
242 pub fn register(&self) -> REGISTER_R {
243 REGISTER_R::new(self.bits)
244 }
245 #[doc = "Bits 4:5 - configures IO_MUX function, bottom 2 bits"]
246 #[inline(always)]
247 pub fn function_select_low_bits(&self) -> FUNCTION_SELECT_LOW_BITS_R {
248 FUNCTION_SELECT_LOW_BITS_R::new(((self.bits >> 4) & 3) as u8)
249 }
250 #[doc = "Bit 8 - configures IO_MUX function, upper bit"]
251 #[inline(always)]
252 pub fn function_select_high_bit(&self) -> FUNCTION_SELECT_HIGH_BIT_R {
253 FUNCTION_SELECT_HIGH_BIT_R::new(((self.bits >> 8) & 1) != 0)
254 }
255 #[doc = "Bit 7 - configures pull up"]
256 #[inline(always)]
257 pub fn pullup(&self) -> PULLUP_R {
258 PULLUP_R::new(((self.bits >> 7) & 1) != 0)
259 }
260 #[doc = "Bit 3 - configures pull up during sleep mode"]
261 #[inline(always)]
262 pub fn sleep_pullup(&self) -> SLEEP_PULLUP_R {
263 SLEEP_PULLUP_R::new(((self.bits >> 3) & 1) != 0)
264 }
265 #[doc = "Bit 0 - configures output enable during sleep mode"]
266 #[inline(always)]
267 pub fn sleep_enable(&self) -> SLEEP_ENABLE_R {
268 SLEEP_ENABLE_R::new((self.bits & 1) != 0)
269 }
270}
271impl W {
272 #[doc = "Bits 0:31"]
273 #[inline(always)]
274 pub fn register(&mut self) -> REGISTER_W {
275 REGISTER_W { w: self }
276 }
277 #[doc = "Bits 4:5 - configures IO_MUX function, bottom 2 bits"]
278 #[inline(always)]
279 pub fn function_select_low_bits(&mut self) -> FUNCTION_SELECT_LOW_BITS_W {
280 FUNCTION_SELECT_LOW_BITS_W { w: self }
281 }
282 #[doc = "Bit 8 - configures IO_MUX function, upper bit"]
283 #[inline(always)]
284 pub fn function_select_high_bit(&mut self) -> FUNCTION_SELECT_HIGH_BIT_W {
285 FUNCTION_SELECT_HIGH_BIT_W { w: self }
286 }
287 #[doc = "Bit 7 - configures pull up"]
288 #[inline(always)]
289 pub fn pullup(&mut self) -> PULLUP_W {
290 PULLUP_W { w: self }
291 }
292 #[doc = "Bit 3 - configures pull up during sleep mode"]
293 #[inline(always)]
294 pub fn sleep_pullup(&mut self) -> SLEEP_PULLUP_W {
295 SLEEP_PULLUP_W { w: self }
296 }
297 #[doc = "Bit 0 - configures output enable during sleep mode"]
298 #[inline(always)]
299 pub fn sleep_enable(&mut self) -> SLEEP_ENABLE_W {
300 SLEEP_ENABLE_W { w: self }
301 }
302 #[doc = "Writes raw bits to the register."]
303 #[inline(always)]
304 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
305 self.0.bits(bits);
306 self
307 }
308}
309#[doc = "IO_MUX_SD_CMD\n\nThis register you can [`read`]
310(crate::generic::Reg::read), [`write_with_zero`]
311(crate::generic::Reg::write_with_zero), [`reset`]
312(crate::generic::Reg::reset), [`write`]
313(crate::generic::Reg::write), [`modify`]
314(crate::generic::Reg::modify). See [API]
315(https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [io_mux_sd_cmd]
316(index.html) module"]
317pub struct IO_MUX_SD_CMD_SPEC;
318impl crate::RegisterSpec for IO_MUX_SD_CMD_SPEC {
319 type Ux = u32;
320}
321#[doc = "`read()` method returns [io_mux_sd_cmd::R]
322(R) reader structure"]
323impl crate::Readable for IO_MUX_SD_CMD_SPEC {
324 type Reader = R;
325}
326#[doc = "`write(|w| ..)` method takes [io_mux_sd_cmd::W]
327(W) writer structure"]
328impl crate::Writable for IO_MUX_SD_CMD_SPEC {
329 type Writer = W;
330}
331#[doc = "`reset()` method sets IO_MUX_SD_CMD to value 0"]
332impl crate::Resettable for IO_MUX_SD_CMD_SPEC {
333 #[inline(always)]
334 fn reset_value() -> Self::Ux {
335 0
336 }
337}