stm32wb_pac/gpioe/
pupdr.rs

1#[doc = "Reader of register PUPDR"]
2pub type R = crate::R<u32, super::PUPDR>;
3#[doc = "Writer for register PUPDR"]
4pub type W = crate::W<u32, super::PUPDR>;
5#[doc = "Register PUPDR `reset()`'s with value 0"]
6impl crate::ResetValue for super::PUPDR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `PUPDR4`"]
14pub type PUPDR4_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `PUPDR4`"]
16pub struct PUPDR4_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> PUPDR4_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
24        self.w
25    }
26}
27#[doc = "Reader of field `PUPDR3`"]
28pub type PUPDR3_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `PUPDR3`"]
30pub struct PUPDR3_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> PUPDR3_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u32) & 0x03) << 6);
38        self.w
39    }
40}
41#[doc = "Reader of field `PUPDR2`"]
42pub type PUPDR2_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `PUPDR2`"]
44pub struct PUPDR2_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> PUPDR2_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u8) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
52        self.w
53    }
54}
55#[doc = "Reader of field `PUPDR1`"]
56pub type PUPDR1_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `PUPDR1`"]
58pub struct PUPDR1_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> PUPDR1_W<'a> {
62    #[doc = r"Writes raw bits to the field"]
63    #[inline(always)]
64    pub unsafe fn bits(self, value: u8) -> &'a mut W {
65        self.w.bits = (self.w.bits & !(0x03 << 2)) | (((value as u32) & 0x03) << 2);
66        self.w
67    }
68}
69#[doc = "Reader of field `PUPDR0`"]
70pub type PUPDR0_R = crate::R<u8, u8>;
71#[doc = "Write proxy for field `PUPDR0`"]
72pub struct PUPDR0_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> PUPDR0_W<'a> {
76    #[doc = r"Writes raw bits to the field"]
77    #[inline(always)]
78    pub unsafe fn bits(self, value: u8) -> &'a mut W {
79        self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
80        self.w
81    }
82}
83impl R {
84    #[doc = "Bits 8:9 - Port x configuration bits (y = 0..15)"]
85    #[inline(always)]
86    pub fn pupdr4(&self) -> PUPDR4_R {
87        PUPDR4_R::new(((self.bits >> 8) & 0x03) as u8)
88    }
89    #[doc = "Bits 6:7 - Port x configuration bits (y = 0..15)"]
90    #[inline(always)]
91    pub fn pupdr3(&self) -> PUPDR3_R {
92        PUPDR3_R::new(((self.bits >> 6) & 0x03) as u8)
93    }
94    #[doc = "Bits 4:5 - Port x configuration bits (y = 0..15)"]
95    #[inline(always)]
96    pub fn pupdr2(&self) -> PUPDR2_R {
97        PUPDR2_R::new(((self.bits >> 4) & 0x03) as u8)
98    }
99    #[doc = "Bits 2:3 - Port x configuration bits (y = 0..15)"]
100    #[inline(always)]
101    pub fn pupdr1(&self) -> PUPDR1_R {
102        PUPDR1_R::new(((self.bits >> 2) & 0x03) as u8)
103    }
104    #[doc = "Bits 0:1 - Port x configuration bits (y = 0..15)"]
105    #[inline(always)]
106    pub fn pupdr0(&self) -> PUPDR0_R {
107        PUPDR0_R::new((self.bits & 0x03) as u8)
108    }
109}
110impl W {
111    #[doc = "Bits 8:9 - Port x configuration bits (y = 0..15)"]
112    #[inline(always)]
113    pub fn pupdr4(&mut self) -> PUPDR4_W {
114        PUPDR4_W { w: self }
115    }
116    #[doc = "Bits 6:7 - Port x configuration bits (y = 0..15)"]
117    #[inline(always)]
118    pub fn pupdr3(&mut self) -> PUPDR3_W {
119        PUPDR3_W { w: self }
120    }
121    #[doc = "Bits 4:5 - Port x configuration bits (y = 0..15)"]
122    #[inline(always)]
123    pub fn pupdr2(&mut self) -> PUPDR2_W {
124        PUPDR2_W { w: self }
125    }
126    #[doc = "Bits 2:3 - Port x configuration bits (y = 0..15)"]
127    #[inline(always)]
128    pub fn pupdr1(&mut self) -> PUPDR1_W {
129        PUPDR1_W { w: self }
130    }
131    #[doc = "Bits 0:1 - Port x configuration bits (y = 0..15)"]
132    #[inline(always)]
133    pub fn pupdr0(&mut self) -> PUPDR0_W {
134        PUPDR0_W { w: self }
135    }
136}