1#[doc = "Register `pg_pull1` reader"]
2pub type R = crate::R<PG_PULL1_SPEC>;
3#[doc = "Register `pg_pull1` writer"]
4pub type W = crate::W<PG_PULL1_SPEC>;
5#[doc = "Field `pg_pull[16-18]` reader - PG Pull_up/down Select"]
6pub type PG_PULL_R = crate::FieldReader<PG_PULL_A>;
7#[doc = "PG Pull_up/down Select\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum PG_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<PG_PULL_A> for u8 {
19 #[inline(always)]
20 fn from(variant: PG_PULL_A) -> Self {
21 variant as _
22 }
23}
24impl crate::FieldSpec for PG_PULL_A {
25 type Ux = u8;
26}
27impl PG_PULL_R {
28 #[doc = "Get enumerated values variant"]
29 #[inline(always)]
30 pub const fn variant(&self) -> PG_PULL_A {
31 match self.bits {
32 0 => PG_PULL_A::PULL_DISABLE,
33 1 => PG_PULL_A::PULL_UP,
34 2 => PG_PULL_A::PULL_DOWN,
35 _ => unreachable!(),
36 }
37 }
38 #[doc = "`0`"]
39 #[inline(always)]
40 pub fn is_pull_disable(&self) -> bool {
41 *self == PG_PULL_A::PULL_DISABLE
42 }
43 #[doc = "`1`"]
44 #[inline(always)]
45 pub fn is_pull_up(&self) -> bool {
46 *self == PG_PULL_A::PULL_UP
47 }
48 #[doc = "`10`"]
49 #[inline(always)]
50 pub fn is_pull_down(&self) -> bool {
51 *self == PG_PULL_A::PULL_DOWN
52 }
53}
54#[doc = "Field `pg_pull[16-18]` writer - PG Pull_up/down Select"]
55pub type PG_PULL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PG_PULL_A>;
56impl<'a, REG> PG_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(PG_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(PG_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(PG_PULL_A::PULL_DOWN)
75 }
76}
77impl R {
78 #[doc = "PG Pull_up/down Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pg16_pull` field"]
79 #[inline(always)]
80 pub fn pg_pull(&self, n: u8) -> PG_PULL_R {
81 #[allow(clippy::no_effect)]
82 [(); 3][n as usize];
83 PG_PULL_R::new(((self.bits >> (n * 2)) & 3) as u8)
84 }
85 #[doc = "Bits 0:1 - PG Pull_up/down Select"]
86 #[inline(always)]
87 pub fn pg16_pull(&self) -> PG_PULL_R {
88 PG_PULL_R::new((self.bits & 3) as u8)
89 }
90 #[doc = "Bits 2:3 - PG Pull_up/down Select"]
91 #[inline(always)]
92 pub fn pg17_pull(&self) -> PG_PULL_R {
93 PG_PULL_R::new(((self.bits >> 2) & 3) as u8)
94 }
95 #[doc = "Bits 4:5 - PG Pull_up/down Select"]
96 #[inline(always)]
97 pub fn pg18_pull(&self) -> PG_PULL_R {
98 PG_PULL_R::new(((self.bits >> 4) & 3) as u8)
99 }
100}
101impl W {
102 #[doc = "PG Pull_up/down Select\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pg16_pull` field"]
103 #[inline(always)]
104 #[must_use]
105 pub fn pg_pull(&mut self, n: u8) -> PG_PULL_W<PG_PULL1_SPEC> {
106 #[allow(clippy::no_effect)]
107 [(); 3][n as usize];
108 PG_PULL_W::new(self, n * 2)
109 }
110 #[doc = "Bits 0:1 - PG Pull_up/down Select"]
111 #[inline(always)]
112 #[must_use]
113 pub fn pg16_pull(&mut self) -> PG_PULL_W<PG_PULL1_SPEC> {
114 PG_PULL_W::new(self, 0)
115 }
116 #[doc = "Bits 2:3 - PG Pull_up/down Select"]
117 #[inline(always)]
118 #[must_use]
119 pub fn pg17_pull(&mut self) -> PG_PULL_W<PG_PULL1_SPEC> {
120 PG_PULL_W::new(self, 2)
121 }
122 #[doc = "Bits 4:5 - PG Pull_up/down Select"]
123 #[inline(always)]
124 #[must_use]
125 pub fn pg18_pull(&mut self) -> PG_PULL_W<PG_PULL1_SPEC> {
126 PG_PULL_W::new(self, 4)
127 }
128 #[doc = r" Writes raw bits to the register."]
129 #[doc = r""]
130 #[doc = r" # Safety"]
131 #[doc = r""]
132 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
133 #[inline(always)]
134 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
135 self.bits = bits;
136 self
137 }
138}
139#[doc = "PG Pull Register 1\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pg_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 [`pg_pull1::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
140pub struct PG_PULL1_SPEC;
141impl crate::RegisterSpec for PG_PULL1_SPEC {
142 type Ux = u32;
143}
144#[doc = "`read()` method returns [`pg_pull1::R`](R) reader structure"]
145impl crate::Readable for PG_PULL1_SPEC {}
146#[doc = "`write(|w| ..)` method takes [`pg_pull1::W`](W) writer structure"]
147impl crate::Writable for PG_PULL1_SPEC {
148 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
149 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
150}
151#[doc = "`reset()` method sets pg_pull1 to value 0"]
152impl crate::Resettable for PG_PULL1_SPEC {
153 const RESET_VALUE: Self::Ux = 0;
154}