1#[doc = "Register `GPIO2` reader"]
2pub type R = crate::R<GPIO2_SPEC>;
3#[doc = "Register `GPIO2` writer"]
4pub type W = crate::W<GPIO2_SPEC>;
5#[doc = "Field `MCU_OE` reader - Output enable of the pin in sleep mode. 1: Output enabled. 0: Output disabled."]
6pub type MCU_OE_R = crate::BitReader;
7#[doc = "Field `MCU_OE` writer - Output enable of the pin in sleep mode. 1: Output enabled. 0: Output disabled."]
8pub type MCU_OE_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `SLP_SEL` reader - Sleep mode selection of this pin. Set to 1 to put the pin in sleep mode."]
10pub type SLP_SEL_R = crate::BitReader;
11#[doc = "Field `SLP_SEL` writer - Sleep mode selection of this pin. Set to 1 to put the pin 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 pin 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 pin 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 pin 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 pin 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 pin 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 pin during sleep mode. 1: Input enabled. 0: Input disabled."]
24pub type MCU_IE_W<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `FUN_WPD` reader - Pull-down enable of the pin. 1: Internal pull-down enabled. 0: internal pull-down disabled."]
26pub type FUN_WPD_R = crate::BitReader;
27#[doc = "Field `FUN_WPD` writer - Pull-down enable of the pin. 1: Internal pull-down enabled. 0: internal pull-down disabled."]
28pub type FUN_WPD_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `FUN_WPU` reader - Pull-up enable of the pin. 1: Internal pull-up enabled. 0: Internal pull-up disabled."]
30pub type FUN_WPU_R = crate::BitReader;
31#[doc = "Field `FUN_WPU` writer - Pull-up enable of the pin. 1: Internal pull-up enabled. 0: Internal pull-up disabled."]
32pub type FUN_WPU_W<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `FUN_IE` reader - Input enable of the pin. 1: Input enabled. 0: Input disabled."]
34pub type FUN_IE_R = crate::BitReader;
35#[doc = "Field `FUN_IE` writer - Input enable of the pin. 1: Input enabled. 0: Input disabled."]
36pub type FUN_IE_W<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `FUN_DRV` reader - Select the drive strength of the pin. 0: ~5 mA. 1: ~10 mA. 2: ~20 mA. 3: ~40 mA."]
38pub type FUN_DRV_R = crate::FieldReader;
39#[doc = "Field `FUN_DRV` writer - Select the drive strength of the pin. 0: ~5 mA. 1: ~10 mA. 2: ~20 mA. 3: ~40 mA."]
40pub type FUN_DRV_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
41#[doc = "Field `MCU_SEL` reader - Select IO MUX function for this signal. 0: Select Function 1. 1: Select Function 2, etc."]
42pub type MCU_SEL_R = crate::FieldReader;
43#[doc = "Field `MCU_SEL` writer - Select IO MUX function for this signal. 0: Select Function 1. 1: Select Function 2, etc."]
44pub type MCU_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
45#[doc = "Field `FILTER_EN` reader - Enable filter for pin input signals. 1: Filter enabled. 2: Filter disabled."]
46pub type FILTER_EN_R = crate::BitReader;
47#[doc = "Field `FILTER_EN` writer - Enable filter for pin input signals. 1: Filter enabled. 2: Filter disabled."]
48pub type FILTER_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
49impl R {
50 #[doc = "Bit 0 - Output enable of the pin in sleep mode. 1: Output enabled. 0: Output disabled."]
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 pin. Set to 1 to put the pin 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 pin 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 pin 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 pin 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 = "Bit 7 - Pull-down enable of the pin. 1: Internal pull-down enabled. 0: internal pull-down disabled."]
76 #[inline(always)]
77 pub fn fun_wpd(&self) -> FUN_WPD_R {
78 FUN_WPD_R::new(((self.bits >> 7) & 1) != 0)
79 }
80 #[doc = "Bit 8 - Pull-up enable of the pin. 1: Internal pull-up enabled. 0: Internal pull-up disabled."]
81 #[inline(always)]
82 pub fn fun_wpu(&self) -> FUN_WPU_R {
83 FUN_WPU_R::new(((self.bits >> 8) & 1) != 0)
84 }
85 #[doc = "Bit 9 - Input enable of the pin. 1: Input enabled. 0: Input disabled."]
86 #[inline(always)]
87 pub fn fun_ie(&self) -> FUN_IE_R {
88 FUN_IE_R::new(((self.bits >> 9) & 1) != 0)
89 }
90 #[doc = "Bits 10:11 - Select the drive strength of the pin. 0: ~5 mA. 1: ~10 mA. 2: ~20 mA. 3: ~40 mA."]
91 #[inline(always)]
92 pub fn fun_drv(&self) -> FUN_DRV_R {
93 FUN_DRV_R::new(((self.bits >> 10) & 3) as u8)
94 }
95 #[doc = "Bits 12:14 - Select IO MUX function for this signal. 0: Select Function 1. 1: Select Function 2, etc."]
96 #[inline(always)]
97 pub fn mcu_sel(&self) -> MCU_SEL_R {
98 MCU_SEL_R::new(((self.bits >> 12) & 7) as u8)
99 }
100 #[doc = "Bit 15 - Enable filter for pin input signals. 1: Filter enabled. 2: Filter disabled."]
101 #[inline(always)]
102 pub fn filter_en(&self) -> FILTER_EN_R {
103 FILTER_EN_R::new(((self.bits >> 15) & 1) != 0)
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("GPIO2")
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("fun_wpd", &self.fun_wpd())
116 .field("fun_wpu", &self.fun_wpu())
117 .field("fun_ie", &self.fun_ie())
118 .field("fun_drv", &self.fun_drv())
119 .field("mcu_sel", &self.mcu_sel())
120 .field("filter_en", &self.filter_en())
121 .finish()
122 }
123}
124impl W {
125 #[doc = "Bit 0 - Output enable of the pin in sleep mode. 1: Output enabled. 0: Output disabled."]
126 #[inline(always)]
127 pub fn mcu_oe(&mut self) -> MCU_OE_W<GPIO2_SPEC> {
128 MCU_OE_W::new(self, 0)
129 }
130 #[doc = "Bit 1 - Sleep mode selection of this pin. Set to 1 to put the pin in sleep mode."]
131 #[inline(always)]
132 pub fn slp_sel(&mut self) -> SLP_SEL_W<GPIO2_SPEC> {
133 SLP_SEL_W::new(self, 1)
134 }
135 #[doc = "Bit 2 - Pull-down enable of the pin 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<GPIO2_SPEC> {
138 MCU_WPD_W::new(self, 2)
139 }
140 #[doc = "Bit 3 - Pull-up enable of the pin 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<GPIO2_SPEC> {
143 MCU_WPU_W::new(self, 3)
144 }
145 #[doc = "Bit 4 - Input enable of the pin during sleep mode. 1: Input enabled. 0: Input disabled."]
146 #[inline(always)]
147 pub fn mcu_ie(&mut self) -> MCU_IE_W<GPIO2_SPEC> {
148 MCU_IE_W::new(self, 4)
149 }
150 #[doc = "Bit 7 - Pull-down enable of the pin. 1: Internal pull-down enabled. 0: internal pull-down disabled."]
151 #[inline(always)]
152 pub fn fun_wpd(&mut self) -> FUN_WPD_W<GPIO2_SPEC> {
153 FUN_WPD_W::new(self, 7)
154 }
155 #[doc = "Bit 8 - Pull-up enable of the pin. 1: Internal pull-up enabled. 0: Internal pull-up disabled."]
156 #[inline(always)]
157 pub fn fun_wpu(&mut self) -> FUN_WPU_W<GPIO2_SPEC> {
158 FUN_WPU_W::new(self, 8)
159 }
160 #[doc = "Bit 9 - Input enable of the pin. 1: Input enabled. 0: Input disabled."]
161 #[inline(always)]
162 pub fn fun_ie(&mut self) -> FUN_IE_W<GPIO2_SPEC> {
163 FUN_IE_W::new(self, 9)
164 }
165 #[doc = "Bits 10:11 - Select the drive strength of the pin. 0: ~5 mA. 1: ~10 mA. 2: ~20 mA. 3: ~40 mA."]
166 #[inline(always)]
167 pub fn fun_drv(&mut self) -> FUN_DRV_W<GPIO2_SPEC> {
168 FUN_DRV_W::new(self, 10)
169 }
170 #[doc = "Bits 12:14 - Select IO MUX function for this signal. 0: Select Function 1. 1: Select Function 2, etc."]
171 #[inline(always)]
172 pub fn mcu_sel(&mut self) -> MCU_SEL_W<GPIO2_SPEC> {
173 MCU_SEL_W::new(self, 12)
174 }
175 #[doc = "Bit 15 - Enable filter for pin input signals. 1: Filter enabled. 2: Filter disabled."]
176 #[inline(always)]
177 pub fn filter_en(&mut self) -> FILTER_EN_W<GPIO2_SPEC> {
178 FILTER_EN_W::new(self, 15)
179 }
180}
181#[doc = "Configuration register for pin GPIO2\n\nYou can [`read`](crate::Reg::read) this register and get [`gpio2::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`gpio2::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
182pub struct GPIO2_SPEC;
183impl crate::RegisterSpec for GPIO2_SPEC {
184 type Ux = u32;
185}
186#[doc = "`read()` method returns [`gpio2::R`](R) reader structure"]
187impl crate::Readable for GPIO2_SPEC {}
188#[doc = "`write(|w| ..)` method takes [`gpio2::W`](W) writer structure"]
189impl crate::Writable for GPIO2_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 GPIO2 to value 0x0b00"]
195impl crate::Resettable for GPIO2_SPEC {
196 const RESET_VALUE: u32 = 0x0b00;
197}