esp32/io_mux/
gpio20.rs

1#[doc = "Register `GPIO20` reader"]
2pub type R = crate::R<GPIO20_SPEC>;
3#[doc = "Register `GPIO20` writer"]
4pub type W = crate::W<GPIO20_SPEC>;
5#[doc = "Field `MCU_OE` reader - Output enable of the pad in sleep mode. 1: enable output; 0: disable output."]
6pub type MCU_OE_R = crate::BitReader;
7#[doc = "Field `MCU_OE` writer - Output enable of the pad in sleep mode. 1: enable output; 0: disable output."]
8pub type MCU_OE_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `SLP_SEL` reader - Sleep mode selection of this pad. Set to 1 to put the pad in sleep mode."]
10pub type SLP_SEL_R = crate::BitReader;
11#[doc = "Field `SLP_SEL` writer - Sleep mode selection of this pad. Set to 1 to put the pad in sleep mode."]
12pub type SLP_SEL_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `MCU_WPD` reader - Pull-down enable of the pad during sleep mode. 1: internal pull-down enabled; 0: internal pull-down disabled."]
14pub type MCU_WPD_R = crate::BitReader;
15#[doc = "Field `MCU_WPD` writer - Pull-down enable of the pad during sleep mode. 1: internal pull-down enabled; 0: internal pull-down disabled."]
16pub type MCU_WPD_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `MCU_WPU` reader - Pull-up enable of the pad during sleep mode. 1: internal pull-up enabled; 0: internal pull-up disabled."]
18pub type MCU_WPU_R = crate::BitReader;
19#[doc = "Field `MCU_WPU` writer - Pull-up enable of the pad during sleep mode. 1: internal pull-up enabled; 0: internal pull-up disabled."]
20pub type MCU_WPU_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `MCU_IE` reader - Input enable of the pad during sleep mode. 1: input enabled; 0: input disabled."]
22pub type MCU_IE_R = crate::BitReader;
23#[doc = "Field `MCU_IE` writer - Input enable of the pad during sleep mode. 1: input enabled; 0: input disabled."]
24pub type MCU_IE_W<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `MCU_DRV` reader - Select the drive strength of the pad during sleep mode. A higher value corresponds with a higher strength."]
26pub type MCU_DRV_R = crate::FieldReader;
27#[doc = "Field `MCU_DRV` writer - Select the drive strength of the pad during sleep mode. A higher value corresponds with a higher strength."]
28pub type MCU_DRV_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
29#[doc = "Field `FUN_WPD` reader - Pull-down enable of the pad. 1: internal pull-down enabled, 0: internal pull-down disabled. GPIO pins 34-39 are input-only. These pins do not feature an output driver or internal pull- up/pull-down circuitry, therefore, their FUN_WPD is always 0."]
30pub type FUN_WPD_R = crate::BitReader;
31#[doc = "Field `FUN_WPD` writer - Pull-down enable of the pad. 1: internal pull-down enabled, 0: internal pull-down disabled. GPIO pins 34-39 are input-only. These pins do not feature an output driver or internal pull- up/pull-down circuitry, therefore, their FUN_WPD is always 0."]
32pub type FUN_WPD_W<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `FUN_WPU` reader - Pull-up enable of the pad. 1: internal pull-up enabled; 0: internal pull-up disabled. GPIO pins 34-39 are input-only. These pins do not feature an output driver or internal pull- up/pull- down circuitry, therefore, their FUN_WPU is always 0."]
34pub type FUN_WPU_R = crate::BitReader;
35#[doc = "Field `FUN_WPU` writer - Pull-up enable of the pad. 1: internal pull-up enabled; 0: internal pull-up disabled. GPIO pins 34-39 are input-only. These pins do not feature an output driver or internal pull- up/pull- down circuitry, therefore, their FUN_WPU is always 0."]
36pub type FUN_WPU_W<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `FUN_IE` reader - Input enable of the pad. 1: input enabled; 0: input disabled."]
38pub type FUN_IE_R = crate::BitReader;
39#[doc = "Field `FUN_IE` writer - Input enable of the pad. 1: input enabled; 0: input disabled."]
40pub type FUN_IE_W<'a, REG> = crate::BitWriter<'a, REG>;
41#[doc = "Field `FUN_DRV` reader - Select the drive strength of the pad. A higher value corresponds with a higher strength. For GPIO34-39, FUN_DRV is always 0. For detailed drive strength, please see note 8 in Table ”Notes on ESP32 Pin Lists”, in ESP32 Datasheet."]
42pub type FUN_DRV_R = crate::FieldReader;
43#[doc = "Field `FUN_DRV` writer - Select the drive strength of the pad. A higher value corresponds with a higher strength. For GPIO34-39, FUN_DRV is always 0. For detailed drive strength, please see note 8 in Table ”Notes on ESP32 Pin Lists”, in ESP32 Datasheet."]
44pub type FUN_DRV_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
45#[doc = "Field `MCU_SEL` reader - Select the IO_MUX function for this signal. 0 selects Function 0, 1 selects Function 1, etc."]
46pub type MCU_SEL_R = crate::FieldReader;
47#[doc = "Field `MCU_SEL` writer - Select the IO_MUX function for this signal. 0 selects Function 0, 1 selects Function 1, etc."]
48pub type MCU_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
49impl R {
50    #[doc = "Bit 0 - Output enable of the pad in sleep mode. 1: enable output; 0: disable output."]
51    #[inline(always)]
52    pub fn mcu_oe(&self) -> MCU_OE_R {
53        MCU_OE_R::new((self.bits & 1) != 0)
54    }
55    #[doc = "Bit 1 - Sleep mode selection of this pad. Set to 1 to put the pad in sleep mode."]
56    #[inline(always)]
57    pub fn slp_sel(&self) -> SLP_SEL_R {
58        SLP_SEL_R::new(((self.bits >> 1) & 1) != 0)
59    }
60    #[doc = "Bit 2 - Pull-down enable of the pad during sleep mode. 1: internal pull-down enabled; 0: internal pull-down disabled."]
61    #[inline(always)]
62    pub fn mcu_wpd(&self) -> MCU_WPD_R {
63        MCU_WPD_R::new(((self.bits >> 2) & 1) != 0)
64    }
65    #[doc = "Bit 3 - Pull-up enable of the pad during sleep mode. 1: internal pull-up enabled; 0: internal pull-up disabled."]
66    #[inline(always)]
67    pub fn mcu_wpu(&self) -> MCU_WPU_R {
68        MCU_WPU_R::new(((self.bits >> 3) & 1) != 0)
69    }
70    #[doc = "Bit 4 - Input enable of the pad during sleep mode. 1: input enabled; 0: input disabled."]
71    #[inline(always)]
72    pub fn mcu_ie(&self) -> MCU_IE_R {
73        MCU_IE_R::new(((self.bits >> 4) & 1) != 0)
74    }
75    #[doc = "Bits 5:6 - Select the drive strength of the pad during sleep mode. A higher value corresponds with a higher strength."]
76    #[inline(always)]
77    pub fn mcu_drv(&self) -> MCU_DRV_R {
78        MCU_DRV_R::new(((self.bits >> 5) & 3) as u8)
79    }
80    #[doc = "Bit 7 - Pull-down enable of the pad. 1: internal pull-down enabled, 0: internal pull-down disabled. GPIO pins 34-39 are input-only. These pins do not feature an output driver or internal pull- up/pull-down circuitry, therefore, their FUN_WPD is always 0."]
81    #[inline(always)]
82    pub fn fun_wpd(&self) -> FUN_WPD_R {
83        FUN_WPD_R::new(((self.bits >> 7) & 1) != 0)
84    }
85    #[doc = "Bit 8 - Pull-up enable of the pad. 1: internal pull-up enabled; 0: internal pull-up disabled. GPIO pins 34-39 are input-only. These pins do not feature an output driver or internal pull- up/pull- down circuitry, therefore, their FUN_WPU is always 0."]
86    #[inline(always)]
87    pub fn fun_wpu(&self) -> FUN_WPU_R {
88        FUN_WPU_R::new(((self.bits >> 8) & 1) != 0)
89    }
90    #[doc = "Bit 9 - Input enable of the pad. 1: input enabled; 0: input disabled."]
91    #[inline(always)]
92    pub fn fun_ie(&self) -> FUN_IE_R {
93        FUN_IE_R::new(((self.bits >> 9) & 1) != 0)
94    }
95    #[doc = "Bits 10:11 - Select the drive strength of the pad. A higher value corresponds with a higher strength. For GPIO34-39, FUN_DRV is always 0. For detailed drive strength, please see note 8 in Table ”Notes on ESP32 Pin Lists”, in ESP32 Datasheet."]
96    #[inline(always)]
97    pub fn fun_drv(&self) -> FUN_DRV_R {
98        FUN_DRV_R::new(((self.bits >> 10) & 3) as u8)
99    }
100    #[doc = "Bits 12:14 - Select the IO_MUX function for this signal. 0 selects Function 0, 1 selects Function 1, etc."]
101    #[inline(always)]
102    pub fn mcu_sel(&self) -> MCU_SEL_R {
103        MCU_SEL_R::new(((self.bits >> 12) & 7) as u8)
104    }
105}
106#[cfg(feature = "impl-register-debug")]
107impl core::fmt::Debug for R {
108    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
109        f.debug_struct("GPIO20")
110            .field("mcu_oe", &self.mcu_oe())
111            .field("slp_sel", &self.slp_sel())
112            .field("mcu_wpd", &self.mcu_wpd())
113            .field("mcu_wpu", &self.mcu_wpu())
114            .field("mcu_ie", &self.mcu_ie())
115            .field("mcu_drv", &self.mcu_drv())
116            .field("fun_wpd", &self.fun_wpd())
117            .field("fun_wpu", &self.fun_wpu())
118            .field("fun_ie", &self.fun_ie())
119            .field("fun_drv", &self.fun_drv())
120            .field("mcu_sel", &self.mcu_sel())
121            .finish()
122    }
123}
124impl W {
125    #[doc = "Bit 0 - Output enable of the pad in sleep mode. 1: enable output; 0: disable output."]
126    #[inline(always)]
127    pub fn mcu_oe(&mut self) -> MCU_OE_W<GPIO20_SPEC> {
128        MCU_OE_W::new(self, 0)
129    }
130    #[doc = "Bit 1 - Sleep mode selection of this pad. Set to 1 to put the pad in sleep mode."]
131    #[inline(always)]
132    pub fn slp_sel(&mut self) -> SLP_SEL_W<GPIO20_SPEC> {
133        SLP_SEL_W::new(self, 1)
134    }
135    #[doc = "Bit 2 - Pull-down enable of the pad during sleep mode. 1: internal pull-down enabled; 0: internal pull-down disabled."]
136    #[inline(always)]
137    pub fn mcu_wpd(&mut self) -> MCU_WPD_W<GPIO20_SPEC> {
138        MCU_WPD_W::new(self, 2)
139    }
140    #[doc = "Bit 3 - Pull-up enable of the pad during sleep mode. 1: internal pull-up enabled; 0: internal pull-up disabled."]
141    #[inline(always)]
142    pub fn mcu_wpu(&mut self) -> MCU_WPU_W<GPIO20_SPEC> {
143        MCU_WPU_W::new(self, 3)
144    }
145    #[doc = "Bit 4 - Input enable of the pad during sleep mode. 1: input enabled; 0: input disabled."]
146    #[inline(always)]
147    pub fn mcu_ie(&mut self) -> MCU_IE_W<GPIO20_SPEC> {
148        MCU_IE_W::new(self, 4)
149    }
150    #[doc = "Bits 5:6 - Select the drive strength of the pad during sleep mode. A higher value corresponds with a higher strength."]
151    #[inline(always)]
152    pub fn mcu_drv(&mut self) -> MCU_DRV_W<GPIO20_SPEC> {
153        MCU_DRV_W::new(self, 5)
154    }
155    #[doc = "Bit 7 - Pull-down enable of the pad. 1: internal pull-down enabled, 0: internal pull-down disabled. GPIO pins 34-39 are input-only. These pins do not feature an output driver or internal pull- up/pull-down circuitry, therefore, their FUN_WPD is always 0."]
156    #[inline(always)]
157    pub fn fun_wpd(&mut self) -> FUN_WPD_W<GPIO20_SPEC> {
158        FUN_WPD_W::new(self, 7)
159    }
160    #[doc = "Bit 8 - Pull-up enable of the pad. 1: internal pull-up enabled; 0: internal pull-up disabled. GPIO pins 34-39 are input-only. These pins do not feature an output driver or internal pull- up/pull- down circuitry, therefore, their FUN_WPU is always 0."]
161    #[inline(always)]
162    pub fn fun_wpu(&mut self) -> FUN_WPU_W<GPIO20_SPEC> {
163        FUN_WPU_W::new(self, 8)
164    }
165    #[doc = "Bit 9 - Input enable of the pad. 1: input enabled; 0: input disabled."]
166    #[inline(always)]
167    pub fn fun_ie(&mut self) -> FUN_IE_W<GPIO20_SPEC> {
168        FUN_IE_W::new(self, 9)
169    }
170    #[doc = "Bits 10:11 - Select the drive strength of the pad. A higher value corresponds with a higher strength. For GPIO34-39, FUN_DRV is always 0. For detailed drive strength, please see note 8 in Table ”Notes on ESP32 Pin Lists”, in ESP32 Datasheet."]
171    #[inline(always)]
172    pub fn fun_drv(&mut self) -> FUN_DRV_W<GPIO20_SPEC> {
173        FUN_DRV_W::new(self, 10)
174    }
175    #[doc = "Bits 12:14 - Select the IO_MUX function for this signal. 0 selects Function 0, 1 selects Function 1, etc."]
176    #[inline(always)]
177    pub fn mcu_sel(&mut self) -> MCU_SEL_W<GPIO20_SPEC> {
178        MCU_SEL_W::new(self, 12)
179    }
180}
181#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`gpio20::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`gpio20::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
182pub struct GPIO20_SPEC;
183impl crate::RegisterSpec for GPIO20_SPEC {
184    type Ux = u32;
185}
186#[doc = "`read()` method returns [`gpio20::R`](R) reader structure"]
187impl crate::Readable for GPIO20_SPEC {}
188#[doc = "`write(|w| ..)` method takes [`gpio20::W`](W) writer structure"]
189impl crate::Writable for GPIO20_SPEC {
190    type Safety = crate::Unsafe;
191    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
192    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
193}
194#[doc = "`reset()` method sets GPIO20 to value 0"]
195impl crate::Resettable for GPIO20_SPEC {
196    const RESET_VALUE: u32 = 0;
197}