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