d1_pac/gpio/
pb_pull0.rs

1#[doc = "Register `pb_pull0` reader"]
2pub type R = crate::R<PB_PULL0_SPEC>;
3#[doc = "Register `pb_pull0` writer"]
4pub type W = crate::W<PB_PULL0_SPEC>;
5#[doc = "Field `pc_pull[0-12]` reader - PC Pull_up/down Select"]
6pub type PC_PULL_R = crate::FieldReader<PC_PULL_A>;
7#[doc = "PC Pull_up/down Select\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum PC_PULL_A {
11    #[doc = "0: `0`"]
12    PULL_DISABLE = 0,
13    #[doc = "1: `1`"]
14    PULL_UP = 1,
15    #[doc = "2: `10`"]
16    PULL_DOWN = 2,
17}
18impl From<PC_PULL_A> for u8 {
19    #[inline(always)]
20    fn from(variant: PC_PULL_A) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for PC_PULL_A {
25    type Ux = u8;
26}
27impl PC_PULL_R {
28    #[doc = "Get enumerated values variant"]
29    #[inline(always)]
30    pub const fn variant(&self) -> PC_PULL_A {
31        match self.bits {
32            0 => PC_PULL_A::PULL_DISABLE,
33            1 => PC_PULL_A::PULL_UP,
34            2 => PC_PULL_A::PULL_DOWN,
35            _ => unreachable!(),
36        }
37    }
38    #[doc = "`0`"]
39    #[inline(always)]
40    pub fn is_pull_disable(&self) -> bool {
41        *self == PC_PULL_A::PULL_DISABLE
42    }
43    #[doc = "`1`"]
44    #[inline(always)]
45    pub fn is_pull_up(&self) -> bool {
46        *self == PC_PULL_A::PULL_UP
47    }
48    #[doc = "`10`"]
49    #[inline(always)]
50    pub fn is_pull_down(&self) -> bool {
51        *self == PC_PULL_A::PULL_DOWN
52    }
53}
54#[doc = "Field `pc_pull[0-12]` writer - PC Pull_up/down Select"]
55pub type PC_PULL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PC_PULL_A>;
56impl<'a, REG> PC_PULL_W<'a, REG>
57where
58    REG: crate::Writable + crate::RegisterSpec,
59    REG::Ux: From<u8>,
60{
61    #[doc = "`0`"]
62    #[inline(always)]
63    pub fn pull_disable(self) -> &'a mut crate::W<REG> {
64        self.variant(PC_PULL_A::PULL_DISABLE)
65    }
66    #[doc = "`1`"]
67    #[inline(always)]
68    pub fn pull_up(self) -> &'a mut crate::W<REG> {
69        self.variant(PC_PULL_A::PULL_UP)
70    }
71    #[doc = "`10`"]
72    #[inline(always)]
73    pub fn pull_down(self) -> &'a mut crate::W<REG> {
74        self.variant(PC_PULL_A::PULL_DOWN)
75    }
76}
77impl R {
78    #[doc = "PC Pull_up/down Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pc0_pull` field"]
79    #[inline(always)]
80    pub fn pc_pull(&self, n: u8) -> PC_PULL_R {
81        #[allow(clippy::no_effect)]
82        [(); 13][n as usize];
83        PC_PULL_R::new(((self.bits >> (n * 2)) & 3) as u8)
84    }
85    #[doc = "Bits 0:1 - PC Pull_up/down Select"]
86    #[inline(always)]
87    pub fn pc0_pull(&self) -> PC_PULL_R {
88        PC_PULL_R::new((self.bits & 3) as u8)
89    }
90    #[doc = "Bits 2:3 - PC Pull_up/down Select"]
91    #[inline(always)]
92    pub fn pc1_pull(&self) -> PC_PULL_R {
93        PC_PULL_R::new(((self.bits >> 2) & 3) as u8)
94    }
95    #[doc = "Bits 4:5 - PC Pull_up/down Select"]
96    #[inline(always)]
97    pub fn pc2_pull(&self) -> PC_PULL_R {
98        PC_PULL_R::new(((self.bits >> 4) & 3) as u8)
99    }
100    #[doc = "Bits 6:7 - PC Pull_up/down Select"]
101    #[inline(always)]
102    pub fn pc3_pull(&self) -> PC_PULL_R {
103        PC_PULL_R::new(((self.bits >> 6) & 3) as u8)
104    }
105    #[doc = "Bits 8:9 - PC Pull_up/down Select"]
106    #[inline(always)]
107    pub fn pc4_pull(&self) -> PC_PULL_R {
108        PC_PULL_R::new(((self.bits >> 8) & 3) as u8)
109    }
110    #[doc = "Bits 10:11 - PC Pull_up/down Select"]
111    #[inline(always)]
112    pub fn pc5_pull(&self) -> PC_PULL_R {
113        PC_PULL_R::new(((self.bits >> 10) & 3) as u8)
114    }
115    #[doc = "Bits 12:13 - PC Pull_up/down Select"]
116    #[inline(always)]
117    pub fn pc6_pull(&self) -> PC_PULL_R {
118        PC_PULL_R::new(((self.bits >> 12) & 3) as u8)
119    }
120    #[doc = "Bits 14:15 - PC Pull_up/down Select"]
121    #[inline(always)]
122    pub fn pc7_pull(&self) -> PC_PULL_R {
123        PC_PULL_R::new(((self.bits >> 14) & 3) as u8)
124    }
125    #[doc = "Bits 16:17 - PC Pull_up/down Select"]
126    #[inline(always)]
127    pub fn pc8_pull(&self) -> PC_PULL_R {
128        PC_PULL_R::new(((self.bits >> 16) & 3) as u8)
129    }
130    #[doc = "Bits 18:19 - PC Pull_up/down Select"]
131    #[inline(always)]
132    pub fn pc9_pull(&self) -> PC_PULL_R {
133        PC_PULL_R::new(((self.bits >> 18) & 3) as u8)
134    }
135    #[doc = "Bits 20:21 - PC Pull_up/down Select"]
136    #[inline(always)]
137    pub fn pc10_pull(&self) -> PC_PULL_R {
138        PC_PULL_R::new(((self.bits >> 20) & 3) as u8)
139    }
140    #[doc = "Bits 22:23 - PC Pull_up/down Select"]
141    #[inline(always)]
142    pub fn pc11_pull(&self) -> PC_PULL_R {
143        PC_PULL_R::new(((self.bits >> 22) & 3) as u8)
144    }
145    #[doc = "Bits 24:25 - PC Pull_up/down Select"]
146    #[inline(always)]
147    pub fn pc12_pull(&self) -> PC_PULL_R {
148        PC_PULL_R::new(((self.bits >> 24) & 3) as u8)
149    }
150}
151impl W {
152    #[doc = "PC Pull_up/down Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pc0_pull` field"]
153    #[inline(always)]
154    #[must_use]
155    pub fn pc_pull(&mut self, n: u8) -> PC_PULL_W<PB_PULL0_SPEC> {
156        #[allow(clippy::no_effect)]
157        [(); 13][n as usize];
158        PC_PULL_W::new(self, n * 2)
159    }
160    #[doc = "Bits 0:1 - PC Pull_up/down Select"]
161    #[inline(always)]
162    #[must_use]
163    pub fn pc0_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
164        PC_PULL_W::new(self, 0)
165    }
166    #[doc = "Bits 2:3 - PC Pull_up/down Select"]
167    #[inline(always)]
168    #[must_use]
169    pub fn pc1_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
170        PC_PULL_W::new(self, 2)
171    }
172    #[doc = "Bits 4:5 - PC Pull_up/down Select"]
173    #[inline(always)]
174    #[must_use]
175    pub fn pc2_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
176        PC_PULL_W::new(self, 4)
177    }
178    #[doc = "Bits 6:7 - PC Pull_up/down Select"]
179    #[inline(always)]
180    #[must_use]
181    pub fn pc3_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
182        PC_PULL_W::new(self, 6)
183    }
184    #[doc = "Bits 8:9 - PC Pull_up/down Select"]
185    #[inline(always)]
186    #[must_use]
187    pub fn pc4_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
188        PC_PULL_W::new(self, 8)
189    }
190    #[doc = "Bits 10:11 - PC Pull_up/down Select"]
191    #[inline(always)]
192    #[must_use]
193    pub fn pc5_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
194        PC_PULL_W::new(self, 10)
195    }
196    #[doc = "Bits 12:13 - PC Pull_up/down Select"]
197    #[inline(always)]
198    #[must_use]
199    pub fn pc6_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
200        PC_PULL_W::new(self, 12)
201    }
202    #[doc = "Bits 14:15 - PC Pull_up/down Select"]
203    #[inline(always)]
204    #[must_use]
205    pub fn pc7_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
206        PC_PULL_W::new(self, 14)
207    }
208    #[doc = "Bits 16:17 - PC Pull_up/down Select"]
209    #[inline(always)]
210    #[must_use]
211    pub fn pc8_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
212        PC_PULL_W::new(self, 16)
213    }
214    #[doc = "Bits 18:19 - PC Pull_up/down Select"]
215    #[inline(always)]
216    #[must_use]
217    pub fn pc9_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
218        PC_PULL_W::new(self, 18)
219    }
220    #[doc = "Bits 20:21 - PC Pull_up/down Select"]
221    #[inline(always)]
222    #[must_use]
223    pub fn pc10_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
224        PC_PULL_W::new(self, 20)
225    }
226    #[doc = "Bits 22:23 - PC Pull_up/down Select"]
227    #[inline(always)]
228    #[must_use]
229    pub fn pc11_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
230        PC_PULL_W::new(self, 22)
231    }
232    #[doc = "Bits 24:25 - PC Pull_up/down Select"]
233    #[inline(always)]
234    #[must_use]
235    pub fn pc12_pull(&mut self) -> PC_PULL_W<PB_PULL0_SPEC> {
236        PC_PULL_W::new(self, 24)
237    }
238    #[doc = r" Writes raw bits to the register."]
239    #[doc = r""]
240    #[doc = r" # Safety"]
241    #[doc = r""]
242    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
243    #[inline(always)]
244    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
245        self.bits = bits;
246        self
247    }
248}
249#[doc = "PB Pull Register 0\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pb_pull0::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 [`pb_pull0::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
250pub struct PB_PULL0_SPEC;
251impl crate::RegisterSpec for PB_PULL0_SPEC {
252    type Ux = u32;
253}
254#[doc = "`read()` method returns [`pb_pull0::R`](R) reader structure"]
255impl crate::Readable for PB_PULL0_SPEC {}
256#[doc = "`write(|w| ..)` method takes [`pb_pull0::W`](W) writer structure"]
257impl crate::Writable for PB_PULL0_SPEC {
258    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
259    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
260}
261#[doc = "`reset()` method sets pb_pull0 to value 0"]
262impl crate::Resettable for PB_PULL0_SPEC {
263    const RESET_VALUE: Self::Ux = 0;
264}