stm32wb_pac/gpioe/
moder.rs

1#[doc = "Reader of register MODER"]
2pub type R = crate::R<u32, super::MODER>;
3#[doc = "Writer for register MODER"]
4pub type W = crate::W<u32, super::MODER>;
5#[doc = "Register MODER `reset()`'s with value 0x03ff"]
6impl crate::ResetValue for super::MODER {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x03ff
11    }
12}
13#[doc = "Reader of field `MODER4`"]
14pub type MODER4_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `MODER4`"]
16pub struct MODER4_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> MODER4_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 `MODER3`"]
28pub type MODER3_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `MODER3`"]
30pub struct MODER3_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> MODER3_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 `MODER2`"]
42pub type MODER2_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `MODER2`"]
44pub struct MODER2_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> MODER2_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 `MODER1`"]
56pub type MODER1_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `MODER1`"]
58pub struct MODER1_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> MODER1_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 `MODER0`"]
70pub type MODER0_R = crate::R<u8, u8>;
71#[doc = "Write proxy for field `MODER0`"]
72pub struct MODER0_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> MODER0_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 moder4(&self) -> MODER4_R {
87        MODER4_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 moder3(&self) -> MODER3_R {
92        MODER3_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 moder2(&self) -> MODER2_R {
97        MODER2_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 moder1(&self) -> MODER1_R {
102        MODER1_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 moder0(&self) -> MODER0_R {
107        MODER0_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 moder4(&mut self) -> MODER4_W {
114        MODER4_W { w: self }
115    }
116    #[doc = "Bits 6:7 - Port x configuration bits (y = 0..15)"]
117    #[inline(always)]
118    pub fn moder3(&mut self) -> MODER3_W {
119        MODER3_W { w: self }
120    }
121    #[doc = "Bits 4:5 - Port x configuration bits (y = 0..15)"]
122    #[inline(always)]
123    pub fn moder2(&mut self) -> MODER2_W {
124        MODER2_W { w: self }
125    }
126    #[doc = "Bits 2:3 - Port x configuration bits (y = 0..15)"]
127    #[inline(always)]
128    pub fn moder1(&mut self) -> MODER1_W {
129        MODER1_W { w: self }
130    }
131    #[doc = "Bits 0:1 - Port x configuration bits (y = 0..15)"]
132    #[inline(always)]
133    pub fn moder0(&mut self) -> MODER0_W {
134        MODER0_W { w: self }
135    }
136}