1#[doc = "Register `pd_pull1` reader"]
2pub type R = crate::R<PD_PULL1_SPEC>;
3#[doc = "Register `pd_pull1` writer"]
4pub type W = crate::W<PD_PULL1_SPEC>;
5#[doc = "Field `pd_pull[16-22]` reader - PD Pull_up/down Select"]
6pub type PD_PULL_R = crate::FieldReader<PD_PULL_A>;
7#[doc = "PD Pull_up/down Select\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum PD_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<PD_PULL_A> for u8 {
19 #[inline(always)]
20 fn from(variant: PD_PULL_A) -> Self {
21 variant as _
22 }
23}
24impl crate::FieldSpec for PD_PULL_A {
25 type Ux = u8;
26}
27impl PD_PULL_R {
28 #[doc = "Get enumerated values variant"]
29 #[inline(always)]
30 pub const fn variant(&self) -> PD_PULL_A {
31 match self.bits {
32 0 => PD_PULL_A::PULL_DISABLE,
33 1 => PD_PULL_A::PULL_UP,
34 2 => PD_PULL_A::PULL_DOWN,
35 _ => unreachable!(),
36 }
37 }
38 #[doc = "`0`"]
39 #[inline(always)]
40 pub fn is_pull_disable(&self) -> bool {
41 *self == PD_PULL_A::PULL_DISABLE
42 }
43 #[doc = "`1`"]
44 #[inline(always)]
45 pub fn is_pull_up(&self) -> bool {
46 *self == PD_PULL_A::PULL_UP
47 }
48 #[doc = "`10`"]
49 #[inline(always)]
50 pub fn is_pull_down(&self) -> bool {
51 *self == PD_PULL_A::PULL_DOWN
52 }
53}
54#[doc = "Field `pd_pull[16-22]` writer - PD Pull_up/down Select"]
55pub type PD_PULL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PD_PULL_A>;
56impl<'a, REG> PD_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(PD_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(PD_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(PD_PULL_A::PULL_DOWN)
75 }
76}
77impl R {
78 #[doc = "PD Pull_up/down Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pd16_pull` field"]
79 #[inline(always)]
80 pub fn pd_pull(&self, n: u8) -> PD_PULL_R {
81 #[allow(clippy::no_effect)]
82 [(); 7][n as usize];
83 PD_PULL_R::new(((self.bits >> (n * 2)) & 3) as u8)
84 }
85 #[doc = "Bits 0:1 - PD Pull_up/down Select"]
86 #[inline(always)]
87 pub fn pd16_pull(&self) -> PD_PULL_R {
88 PD_PULL_R::new((self.bits & 3) as u8)
89 }
90 #[doc = "Bits 2:3 - PD Pull_up/down Select"]
91 #[inline(always)]
92 pub fn pd17_pull(&self) -> PD_PULL_R {
93 PD_PULL_R::new(((self.bits >> 2) & 3) as u8)
94 }
95 #[doc = "Bits 4:5 - PD Pull_up/down Select"]
96 #[inline(always)]
97 pub fn pd18_pull(&self) -> PD_PULL_R {
98 PD_PULL_R::new(((self.bits >> 4) & 3) as u8)
99 }
100 #[doc = "Bits 6:7 - PD Pull_up/down Select"]
101 #[inline(always)]
102 pub fn pd19_pull(&self) -> PD_PULL_R {
103 PD_PULL_R::new(((self.bits >> 6) & 3) as u8)
104 }
105 #[doc = "Bits 8:9 - PD Pull_up/down Select"]
106 #[inline(always)]
107 pub fn pd20_pull(&self) -> PD_PULL_R {
108 PD_PULL_R::new(((self.bits >> 8) & 3) as u8)
109 }
110 #[doc = "Bits 10:11 - PD Pull_up/down Select"]
111 #[inline(always)]
112 pub fn pd21_pull(&self) -> PD_PULL_R {
113 PD_PULL_R::new(((self.bits >> 10) & 3) as u8)
114 }
115 #[doc = "Bits 12:13 - PD Pull_up/down Select"]
116 #[inline(always)]
117 pub fn pd22_pull(&self) -> PD_PULL_R {
118 PD_PULL_R::new(((self.bits >> 12) & 3) as u8)
119 }
120}
121impl W {
122 #[doc = "PD Pull_up/down Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pd16_pull` field"]
123 #[inline(always)]
124 #[must_use]
125 pub fn pd_pull(&mut self, n: u8) -> PD_PULL_W<PD_PULL1_SPEC> {
126 #[allow(clippy::no_effect)]
127 [(); 7][n as usize];
128 PD_PULL_W::new(self, n * 2)
129 }
130 #[doc = "Bits 0:1 - PD Pull_up/down Select"]
131 #[inline(always)]
132 #[must_use]
133 pub fn pd16_pull(&mut self) -> PD_PULL_W<PD_PULL1_SPEC> {
134 PD_PULL_W::new(self, 0)
135 }
136 #[doc = "Bits 2:3 - PD Pull_up/down Select"]
137 #[inline(always)]
138 #[must_use]
139 pub fn pd17_pull(&mut self) -> PD_PULL_W<PD_PULL1_SPEC> {
140 PD_PULL_W::new(self, 2)
141 }
142 #[doc = "Bits 4:5 - PD Pull_up/down Select"]
143 #[inline(always)]
144 #[must_use]
145 pub fn pd18_pull(&mut self) -> PD_PULL_W<PD_PULL1_SPEC> {
146 PD_PULL_W::new(self, 4)
147 }
148 #[doc = "Bits 6:7 - PD Pull_up/down Select"]
149 #[inline(always)]
150 #[must_use]
151 pub fn pd19_pull(&mut self) -> PD_PULL_W<PD_PULL1_SPEC> {
152 PD_PULL_W::new(self, 6)
153 }
154 #[doc = "Bits 8:9 - PD Pull_up/down Select"]
155 #[inline(always)]
156 #[must_use]
157 pub fn pd20_pull(&mut self) -> PD_PULL_W<PD_PULL1_SPEC> {
158 PD_PULL_W::new(self, 8)
159 }
160 #[doc = "Bits 10:11 - PD Pull_up/down Select"]
161 #[inline(always)]
162 #[must_use]
163 pub fn pd21_pull(&mut self) -> PD_PULL_W<PD_PULL1_SPEC> {
164 PD_PULL_W::new(self, 10)
165 }
166 #[doc = "Bits 12:13 - PD Pull_up/down Select"]
167 #[inline(always)]
168 #[must_use]
169 pub fn pd22_pull(&mut self) -> PD_PULL_W<PD_PULL1_SPEC> {
170 PD_PULL_W::new(self, 12)
171 }
172 #[doc = r" Writes raw bits to the register."]
173 #[doc = r""]
174 #[doc = r" # Safety"]
175 #[doc = r""]
176 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
177 #[inline(always)]
178 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
179 self.bits = bits;
180 self
181 }
182}
183#[doc = "PD Pull Register 1\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pd_pull1::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 [`pd_pull1::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
184pub struct PD_PULL1_SPEC;
185impl crate::RegisterSpec for PD_PULL1_SPEC {
186 type Ux = u32;
187}
188#[doc = "`read()` method returns [`pd_pull1::R`](R) reader structure"]
189impl crate::Readable for PD_PULL1_SPEC {}
190#[doc = "`write(|w| ..)` method takes [`pd_pull1::W`](W) writer structure"]
191impl crate::Writable for PD_PULL1_SPEC {
192 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
193 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
194}
195#[doc = "`reset()` method sets pd_pull1 to value 0"]
196impl crate::Resettable for PD_PULL1_SPEC {
197 const RESET_VALUE: Self::Ux = 0;
198}