stm32wb_pac/gpiob/
afrh.rs

1#[doc = "Reader of register AFRH"]
2pub type R = crate::R<u32, super::AFRH>;
3#[doc = "Writer for register AFRH"]
4pub type W = crate::W<u32, super::AFRH>;
5#[doc = "Register AFRH `reset()`'s with value 0"]
6impl crate::ResetValue for super::AFRH {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `AFSEL15`"]
14pub type AFSEL15_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `AFSEL15`"]
16pub struct AFSEL15_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> AFSEL15_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 & !(0x0f << 28)) | (((value as u32) & 0x0f) << 28);
24        self.w
25    }
26}
27#[doc = "Reader of field `AFSEL14`"]
28pub type AFSEL14_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `AFSEL14`"]
30pub struct AFSEL14_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> AFSEL14_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 & !(0x0f << 24)) | (((value as u32) & 0x0f) << 24);
38        self.w
39    }
40}
41#[doc = "Reader of field `AFSEL13`"]
42pub type AFSEL13_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `AFSEL13`"]
44pub struct AFSEL13_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> AFSEL13_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 & !(0x0f << 20)) | (((value as u32) & 0x0f) << 20);
52        self.w
53    }
54}
55#[doc = "Reader of field `AFSEL12`"]
56pub type AFSEL12_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `AFSEL12`"]
58pub struct AFSEL12_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> AFSEL12_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 & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
66        self.w
67    }
68}
69#[doc = "Reader of field `AFSEL11`"]
70pub type AFSEL11_R = crate::R<u8, u8>;
71#[doc = "Write proxy for field `AFSEL11`"]
72pub struct AFSEL11_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> AFSEL11_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 & !(0x0f << 12)) | (((value as u32) & 0x0f) << 12);
80        self.w
81    }
82}
83#[doc = "Reader of field `AFSEL10`"]
84pub type AFSEL10_R = crate::R<u8, u8>;
85#[doc = "Write proxy for field `AFSEL10`"]
86pub struct AFSEL10_W<'a> {
87    w: &'a mut W,
88}
89impl<'a> AFSEL10_W<'a> {
90    #[doc = r"Writes raw bits to the field"]
91    #[inline(always)]
92    pub unsafe fn bits(self, value: u8) -> &'a mut W {
93        self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
94        self.w
95    }
96}
97#[doc = "Reader of field `AFSEL9`"]
98pub type AFSEL9_R = crate::R<u8, u8>;
99#[doc = "Write proxy for field `AFSEL9`"]
100pub struct AFSEL9_W<'a> {
101    w: &'a mut W,
102}
103impl<'a> AFSEL9_W<'a> {
104    #[doc = r"Writes raw bits to the field"]
105    #[inline(always)]
106    pub unsafe fn bits(self, value: u8) -> &'a mut W {
107        self.w.bits = (self.w.bits & !(0x0f << 4)) | (((value as u32) & 0x0f) << 4);
108        self.w
109    }
110}
111#[doc = "Reader of field `AFSEL8`"]
112pub type AFSEL8_R = crate::R<u8, u8>;
113#[doc = "Write proxy for field `AFSEL8`"]
114pub struct AFSEL8_W<'a> {
115    w: &'a mut W,
116}
117impl<'a> AFSEL8_W<'a> {
118    #[doc = r"Writes raw bits to the field"]
119    #[inline(always)]
120    pub unsafe fn bits(self, value: u8) -> &'a mut W {
121        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
122        self.w
123    }
124}
125impl R {
126    #[doc = "Bits 28:31 - Alternate function selection for port x bit y (y = 8..15)"]
127    #[inline(always)]
128    pub fn afsel15(&self) -> AFSEL15_R {
129        AFSEL15_R::new(((self.bits >> 28) & 0x0f) as u8)
130    }
131    #[doc = "Bits 24:27 - Alternate function selection for port x bit y (y = 8..15)"]
132    #[inline(always)]
133    pub fn afsel14(&self) -> AFSEL14_R {
134        AFSEL14_R::new(((self.bits >> 24) & 0x0f) as u8)
135    }
136    #[doc = "Bits 20:23 - Alternate function selection for port x bit y (y = 8..15)"]
137    #[inline(always)]
138    pub fn afsel13(&self) -> AFSEL13_R {
139        AFSEL13_R::new(((self.bits >> 20) & 0x0f) as u8)
140    }
141    #[doc = "Bits 16:19 - Alternate function selection for port x bit y (y = 8..15)"]
142    #[inline(always)]
143    pub fn afsel12(&self) -> AFSEL12_R {
144        AFSEL12_R::new(((self.bits >> 16) & 0x0f) as u8)
145    }
146    #[doc = "Bits 12:15 - Alternate function selection for port x bit y (y = 8..15)"]
147    #[inline(always)]
148    pub fn afsel11(&self) -> AFSEL11_R {
149        AFSEL11_R::new(((self.bits >> 12) & 0x0f) as u8)
150    }
151    #[doc = "Bits 8:11 - Alternate function selection for port x bit y (y = 8..15)"]
152    #[inline(always)]
153    pub fn afsel10(&self) -> AFSEL10_R {
154        AFSEL10_R::new(((self.bits >> 8) & 0x0f) as u8)
155    }
156    #[doc = "Bits 4:7 - Alternate function selection for port x bit y (y = 8..15)"]
157    #[inline(always)]
158    pub fn afsel9(&self) -> AFSEL9_R {
159        AFSEL9_R::new(((self.bits >> 4) & 0x0f) as u8)
160    }
161    #[doc = "Bits 0:3 - Alternate function selection for port x bit y (y = 8..15)"]
162    #[inline(always)]
163    pub fn afsel8(&self) -> AFSEL8_R {
164        AFSEL8_R::new((self.bits & 0x0f) as u8)
165    }
166}
167impl W {
168    #[doc = "Bits 28:31 - Alternate function selection for port x bit y (y = 8..15)"]
169    #[inline(always)]
170    pub fn afsel15(&mut self) -> AFSEL15_W {
171        AFSEL15_W { w: self }
172    }
173    #[doc = "Bits 24:27 - Alternate function selection for port x bit y (y = 8..15)"]
174    #[inline(always)]
175    pub fn afsel14(&mut self) -> AFSEL14_W {
176        AFSEL14_W { w: self }
177    }
178    #[doc = "Bits 20:23 - Alternate function selection for port x bit y (y = 8..15)"]
179    #[inline(always)]
180    pub fn afsel13(&mut self) -> AFSEL13_W {
181        AFSEL13_W { w: self }
182    }
183    #[doc = "Bits 16:19 - Alternate function selection for port x bit y (y = 8..15)"]
184    #[inline(always)]
185    pub fn afsel12(&mut self) -> AFSEL12_W {
186        AFSEL12_W { w: self }
187    }
188    #[doc = "Bits 12:15 - Alternate function selection for port x bit y (y = 8..15)"]
189    #[inline(always)]
190    pub fn afsel11(&mut self) -> AFSEL11_W {
191        AFSEL11_W { w: self }
192    }
193    #[doc = "Bits 8:11 - Alternate function selection for port x bit y (y = 8..15)"]
194    #[inline(always)]
195    pub fn afsel10(&mut self) -> AFSEL10_W {
196        AFSEL10_W { w: self }
197    }
198    #[doc = "Bits 4:7 - Alternate function selection for port x bit y (y = 8..15)"]
199    #[inline(always)]
200    pub fn afsel9(&mut self) -> AFSEL9_W {
201        AFSEL9_W { w: self }
202    }
203    #[doc = "Bits 0:3 - Alternate function selection for port x bit y (y = 8..15)"]
204    #[inline(always)]
205    pub fn afsel8(&mut self) -> AFSEL8_W {
206        AFSEL8_W { w: self }
207    }
208}