d1_pac/gpio/
pio_pow_mod_sel.rs1#[doc = "Register `pio_pow_mod_sel` reader"]
2pub type R = crate::R<PIO_POW_MOD_SEL_SPEC>;
3#[doc = "Register `pio_pow_mod_sel` writer"]
4pub type W = crate::W<PIO_POW_MOD_SEL_SPEC>;
5#[doc = "Field `p_pwr_mod_sel[C,D,E,F,G]` reader - PX_POWER POWER MODE Select"]
6pub type P_PWR_MOD_SEL_R = crate::BitReader<P_PWR_MOD_SEL_A>;
7#[doc = "PX_POWER POWER MODE Select\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum P_PWR_MOD_SEL_A {
10 #[doc = "0: 3.3 V"]
11 V33 = 0,
12 #[doc = "1: 1.8 V"]
13 V18 = 1,
14}
15impl From<P_PWR_MOD_SEL_A> for bool {
16 #[inline(always)]
17 fn from(variant: P_PWR_MOD_SEL_A) -> Self {
18 variant as u8 != 0
19 }
20}
21impl P_PWR_MOD_SEL_R {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> P_PWR_MOD_SEL_A {
25 match self.bits {
26 false => P_PWR_MOD_SEL_A::V33,
27 true => P_PWR_MOD_SEL_A::V18,
28 }
29 }
30 #[doc = "3.3 V"]
31 #[inline(always)]
32 pub fn is_v33(&self) -> bool {
33 *self == P_PWR_MOD_SEL_A::V33
34 }
35 #[doc = "1.8 V"]
36 #[inline(always)]
37 pub fn is_v18(&self) -> bool {
38 *self == P_PWR_MOD_SEL_A::V18
39 }
40}
41#[doc = "Field `p_pwr_mod_sel[C,D,E,F,G]` writer - PX_POWER POWER MODE Select"]
42pub type P_PWR_MOD_SEL_W<'a, REG> = crate::BitWriter<'a, REG, P_PWR_MOD_SEL_A>;
43impl<'a, REG> P_PWR_MOD_SEL_W<'a, REG>
44where
45 REG: crate::Writable + crate::RegisterSpec,
46{
47 #[doc = "3.3 V"]
48 #[inline(always)]
49 pub fn v33(self) -> &'a mut crate::W<REG> {
50 self.variant(P_PWR_MOD_SEL_A::V33)
51 }
52 #[doc = "1.8 V"]
53 #[inline(always)]
54 pub fn v18(self) -> &'a mut crate::W<REG> {
55 self.variant(P_PWR_MOD_SEL_A::V18)
56 }
57}
58#[doc = "Field `vcc_io_pwr_mod_sel` reader - VCC_IO POWER MODE Select"]
59pub type VCC_IO_PWR_MOD_SEL_R = crate::BitReader<VCC_IO_PWR_MOD_SEL_A>;
60#[doc = "VCC_IO POWER MODE Select\n\nValue on reset: 0"]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum VCC_IO_PWR_MOD_SEL_A {
63 #[doc = "0: 3.3 V"]
64 V33 = 0,
65 #[doc = "1: 1.8 V"]
66 V18 = 1,
67}
68impl From<VCC_IO_PWR_MOD_SEL_A> for bool {
69 #[inline(always)]
70 fn from(variant: VCC_IO_PWR_MOD_SEL_A) -> Self {
71 variant as u8 != 0
72 }
73}
74impl VCC_IO_PWR_MOD_SEL_R {
75 #[doc = "Get enumerated values variant"]
76 #[inline(always)]
77 pub const fn variant(&self) -> VCC_IO_PWR_MOD_SEL_A {
78 match self.bits {
79 false => VCC_IO_PWR_MOD_SEL_A::V33,
80 true => VCC_IO_PWR_MOD_SEL_A::V18,
81 }
82 }
83 #[doc = "3.3 V"]
84 #[inline(always)]
85 pub fn is_v33(&self) -> bool {
86 *self == VCC_IO_PWR_MOD_SEL_A::V33
87 }
88 #[doc = "1.8 V"]
89 #[inline(always)]
90 pub fn is_v18(&self) -> bool {
91 *self == VCC_IO_PWR_MOD_SEL_A::V18
92 }
93}
94#[doc = "Field `vcc_io_pwr_mod_sel` writer - VCC_IO POWER MODE Select"]
95pub type VCC_IO_PWR_MOD_SEL_W<'a, REG> = crate::BitWriter<'a, REG, VCC_IO_PWR_MOD_SEL_A>;
96impl<'a, REG> VCC_IO_PWR_MOD_SEL_W<'a, REG>
97where
98 REG: crate::Writable + crate::RegisterSpec,
99{
100 #[doc = "3.3 V"]
101 #[inline(always)]
102 pub fn v33(self) -> &'a mut crate::W<REG> {
103 self.variant(VCC_IO_PWR_MOD_SEL_A::V33)
104 }
105 #[doc = "1.8 V"]
106 #[inline(always)]
107 pub fn v18(self) -> &'a mut crate::W<REG> {
108 self.variant(VCC_IO_PWR_MOD_SEL_A::V18)
109 }
110}
111impl R {
112 #[doc = "PX_POWER POWER MODE Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pC_pwr_mod_sel` field"]
113 #[inline(always)]
114 pub fn p_pwr_mod_sel(&self, n: u8) -> P_PWR_MOD_SEL_R {
115 #[allow(clippy::no_effect)]
116 [(); 5][n as usize];
117 P_PWR_MOD_SEL_R::new(((self.bits >> (n + 2)) & 1) != 0)
118 }
119 #[doc = "Bit 2 - PX_POWER POWER MODE Select"]
120 #[inline(always)]
121 pub fn p_c_pwr_mod_sel(&self) -> P_PWR_MOD_SEL_R {
122 P_PWR_MOD_SEL_R::new(((self.bits >> 2) & 1) != 0)
123 }
124 #[doc = "Bit 3 - PX_POWER POWER MODE Select"]
125 #[inline(always)]
126 pub fn p_d_pwr_mod_sel(&self) -> P_PWR_MOD_SEL_R {
127 P_PWR_MOD_SEL_R::new(((self.bits >> 3) & 1) != 0)
128 }
129 #[doc = "Bit 4 - PX_POWER POWER MODE Select"]
130 #[inline(always)]
131 pub fn p_e_pwr_mod_sel(&self) -> P_PWR_MOD_SEL_R {
132 P_PWR_MOD_SEL_R::new(((self.bits >> 4) & 1) != 0)
133 }
134 #[doc = "Bit 5 - PX_POWER POWER MODE Select"]
135 #[inline(always)]
136 pub fn p_f_pwr_mod_sel(&self) -> P_PWR_MOD_SEL_R {
137 P_PWR_MOD_SEL_R::new(((self.bits >> 5) & 1) != 0)
138 }
139 #[doc = "Bit 6 - PX_POWER POWER MODE Select"]
140 #[inline(always)]
141 pub fn p_g_pwr_mod_sel(&self) -> P_PWR_MOD_SEL_R {
142 P_PWR_MOD_SEL_R::new(((self.bits >> 6) & 1) != 0)
143 }
144 #[doc = "Bit 12 - VCC_IO POWER MODE Select"]
145 #[inline(always)]
146 pub fn vcc_io_pwr_mod_sel(&self) -> VCC_IO_PWR_MOD_SEL_R {
147 VCC_IO_PWR_MOD_SEL_R::new(((self.bits >> 12) & 1) != 0)
148 }
149}
150impl W {
151 #[doc = "PX_POWER POWER MODE Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pC_pwr_mod_sel` field"]
152 #[inline(always)]
153 #[must_use]
154 pub fn p_pwr_mod_sel(&mut self, n: u8) -> P_PWR_MOD_SEL_W<PIO_POW_MOD_SEL_SPEC> {
155 #[allow(clippy::no_effect)]
156 [(); 5][n as usize];
157 P_PWR_MOD_SEL_W::new(self, n + 2)
158 }
159 #[doc = "Bit 2 - PX_POWER POWER MODE Select"]
160 #[inline(always)]
161 #[must_use]
162 pub fn p_c_pwr_mod_sel(&mut self) -> P_PWR_MOD_SEL_W<PIO_POW_MOD_SEL_SPEC> {
163 P_PWR_MOD_SEL_W::new(self, 2)
164 }
165 #[doc = "Bit 3 - PX_POWER POWER MODE Select"]
166 #[inline(always)]
167 #[must_use]
168 pub fn p_d_pwr_mod_sel(&mut self) -> P_PWR_MOD_SEL_W<PIO_POW_MOD_SEL_SPEC> {
169 P_PWR_MOD_SEL_W::new(self, 3)
170 }
171 #[doc = "Bit 4 - PX_POWER POWER MODE Select"]
172 #[inline(always)]
173 #[must_use]
174 pub fn p_e_pwr_mod_sel(&mut self) -> P_PWR_MOD_SEL_W<PIO_POW_MOD_SEL_SPEC> {
175 P_PWR_MOD_SEL_W::new(self, 4)
176 }
177 #[doc = "Bit 5 - PX_POWER POWER MODE Select"]
178 #[inline(always)]
179 #[must_use]
180 pub fn p_f_pwr_mod_sel(&mut self) -> P_PWR_MOD_SEL_W<PIO_POW_MOD_SEL_SPEC> {
181 P_PWR_MOD_SEL_W::new(self, 5)
182 }
183 #[doc = "Bit 6 - PX_POWER POWER MODE Select"]
184 #[inline(always)]
185 #[must_use]
186 pub fn p_g_pwr_mod_sel(&mut self) -> P_PWR_MOD_SEL_W<PIO_POW_MOD_SEL_SPEC> {
187 P_PWR_MOD_SEL_W::new(self, 6)
188 }
189 #[doc = "Bit 12 - VCC_IO POWER MODE Select"]
190 #[inline(always)]
191 #[must_use]
192 pub fn vcc_io_pwr_mod_sel(&mut self) -> VCC_IO_PWR_MOD_SEL_W<PIO_POW_MOD_SEL_SPEC> {
193 VCC_IO_PWR_MOD_SEL_W::new(self, 12)
194 }
195 #[doc = r" Writes raw bits to the register."]
196 #[doc = r""]
197 #[doc = r" # Safety"]
198 #[doc = r""]
199 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
200 #[inline(always)]
201 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
202 self.bits = bits;
203 self
204 }
205}
206#[doc = "PIO Group Withstand Voltage Mode Select Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pio_pow_mod_sel::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`pio_pow_mod_sel::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
207pub struct PIO_POW_MOD_SEL_SPEC;
208impl crate::RegisterSpec for PIO_POW_MOD_SEL_SPEC {
209 type Ux = u32;
210}
211#[doc = "`read()` method returns [`pio_pow_mod_sel::R`](R) reader structure"]
212impl crate::Readable for PIO_POW_MOD_SEL_SPEC {}
213#[doc = "`write(|w| ..)` method takes [`pio_pow_mod_sel::W`](W) writer structure"]
214impl crate::Writable for PIO_POW_MOD_SEL_SPEC {
215 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
216 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
217}
218#[doc = "`reset()` method sets pio_pow_mod_sel to value 0"]
219impl crate::Resettable for PIO_POW_MOD_SEL_SPEC {
220 const RESET_VALUE: Self::Ux = 0;
221}