stm32wb_pac/gpioe/
afrl.rs

1#[doc = "Reader of register AFRL"]
2pub type R = crate::R<u32, super::AFRL>;
3#[doc = "Writer for register AFRL"]
4pub type W = crate::W<u32, super::AFRL>;
5#[doc = "Register AFRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::AFRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `AFSEL4`"]
14pub type AFSEL4_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `AFSEL4`"]
16pub struct AFSEL4_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> AFSEL4_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 << 16)) | (((value as u32) & 0x0f) << 16);
24        self.w
25    }
26}
27#[doc = "Reader of field `AFSEL3`"]
28pub type AFSEL3_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `AFSEL3`"]
30pub struct AFSEL3_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> AFSEL3_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 << 12)) | (((value as u32) & 0x0f) << 12);
38        self.w
39    }
40}
41#[doc = "Reader of field `AFSEL2`"]
42pub type AFSEL2_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `AFSEL2`"]
44pub struct AFSEL2_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> AFSEL2_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 << 8)) | (((value as u32) & 0x0f) << 8);
52        self.w
53    }
54}
55#[doc = "Reader of field `AFSEL1`"]
56pub type AFSEL1_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `AFSEL1`"]
58pub struct AFSEL1_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> AFSEL1_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 << 4)) | (((value as u32) & 0x0f) << 4);
66        self.w
67    }
68}
69#[doc = "Reader of field `AFSEL0`"]
70pub type AFSEL0_R = crate::R<u8, u8>;
71#[doc = "Write proxy for field `AFSEL0`"]
72pub struct AFSEL0_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> AFSEL0_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) | ((value as u32) & 0x0f);
80        self.w
81    }
82}
83impl R {
84    #[doc = "Bits 16:19 - Alternate function selection for port x bit y (y = 0..7)"]
85    #[inline(always)]
86    pub fn afsel4(&self) -> AFSEL4_R {
87        AFSEL4_R::new(((self.bits >> 16) & 0x0f) as u8)
88    }
89    #[doc = "Bits 12:15 - Alternate function selection for port x bit y (y = 0..7)"]
90    #[inline(always)]
91    pub fn afsel3(&self) -> AFSEL3_R {
92        AFSEL3_R::new(((self.bits >> 12) & 0x0f) as u8)
93    }
94    #[doc = "Bits 8:11 - Alternate function selection for port x bit y (y = 0..7)"]
95    #[inline(always)]
96    pub fn afsel2(&self) -> AFSEL2_R {
97        AFSEL2_R::new(((self.bits >> 8) & 0x0f) as u8)
98    }
99    #[doc = "Bits 4:7 - Alternate function selection for port x bit y (y = 0..7)"]
100    #[inline(always)]
101    pub fn afsel1(&self) -> AFSEL1_R {
102        AFSEL1_R::new(((self.bits >> 4) & 0x0f) as u8)
103    }
104    #[doc = "Bits 0:3 - Alternate function selection for port x bit y (y = 0..7)"]
105    #[inline(always)]
106    pub fn afsel0(&self) -> AFSEL0_R {
107        AFSEL0_R::new((self.bits & 0x0f) as u8)
108    }
109}
110impl W {
111    #[doc = "Bits 16:19 - Alternate function selection for port x bit y (y = 0..7)"]
112    #[inline(always)]
113    pub fn afsel4(&mut self) -> AFSEL4_W {
114        AFSEL4_W { w: self }
115    }
116    #[doc = "Bits 12:15 - Alternate function selection for port x bit y (y = 0..7)"]
117    #[inline(always)]
118    pub fn afsel3(&mut self) -> AFSEL3_W {
119        AFSEL3_W { w: self }
120    }
121    #[doc = "Bits 8:11 - Alternate function selection for port x bit y (y = 0..7)"]
122    #[inline(always)]
123    pub fn afsel2(&mut self) -> AFSEL2_W {
124        AFSEL2_W { w: self }
125    }
126    #[doc = "Bits 4:7 - Alternate function selection for port x bit y (y = 0..7)"]
127    #[inline(always)]
128    pub fn afsel1(&mut self) -> AFSEL1_W {
129        AFSEL1_W { w: self }
130    }
131    #[doc = "Bits 0:3 - Alternate function selection for port x bit y (y = 0..7)"]
132    #[inline(always)]
133    pub fn afsel0(&mut self) -> AFSEL0_W {
134        AFSEL0_W { w: self }
135    }
136}