stm32wb_pac/gpioh/
bsrr.rs

1#[doc = "Writer for register BSRR"]
2pub type W = crate::W<u32, super::BSRR>;
3#[doc = "Register BSRR `reset()`'s with value 0"]
4impl crate::ResetValue for super::BSRR {
5    type Type = u32;
6    #[inline(always)]
7    fn reset_value() -> Self::Type {
8        0
9    }
10}
11#[doc = "Write proxy for field `BR3`"]
12pub struct BR3_W<'a> {
13    w: &'a mut W,
14}
15impl<'a> BR3_W<'a> {
16    #[doc = r"Sets the field bit"]
17    #[inline(always)]
18    pub fn set_bit(self) -> &'a mut W {
19        self.bit(true)
20    }
21    #[doc = r"Clears the field bit"]
22    #[inline(always)]
23    pub fn clear_bit(self) -> &'a mut W {
24        self.bit(false)
25    }
26    #[doc = r"Writes raw bits to the field"]
27    #[inline(always)]
28    pub fn bit(self, value: bool) -> &'a mut W {
29        self.w.bits = (self.w.bits & !(0x01 << 19)) | (((value as u32) & 0x01) << 19);
30        self.w
31    }
32}
33#[doc = "Write proxy for field `BR1`"]
34pub struct BR1_W<'a> {
35    w: &'a mut W,
36}
37impl<'a> BR1_W<'a> {
38    #[doc = r"Sets the field bit"]
39    #[inline(always)]
40    pub fn set_bit(self) -> &'a mut W {
41        self.bit(true)
42    }
43    #[doc = r"Clears the field bit"]
44    #[inline(always)]
45    pub fn clear_bit(self) -> &'a mut W {
46        self.bit(false)
47    }
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub fn bit(self, value: bool) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x01 << 17)) | (((value as u32) & 0x01) << 17);
52        self.w
53    }
54}
55#[doc = "Write proxy for field `BR0`"]
56pub struct BR0_W<'a> {
57    w: &'a mut W,
58}
59impl<'a> BR0_W<'a> {
60    #[doc = r"Sets the field bit"]
61    #[inline(always)]
62    pub fn set_bit(self) -> &'a mut W {
63        self.bit(true)
64    }
65    #[doc = r"Clears the field bit"]
66    #[inline(always)]
67    pub fn clear_bit(self) -> &'a mut W {
68        self.bit(false)
69    }
70    #[doc = r"Writes raw bits to the field"]
71    #[inline(always)]
72    pub fn bit(self, value: bool) -> &'a mut W {
73        self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
74        self.w
75    }
76}
77#[doc = "Write proxy for field `BS3`"]
78pub struct BS3_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> BS3_W<'a> {
82    #[doc = r"Sets the field bit"]
83    #[inline(always)]
84    pub fn set_bit(self) -> &'a mut W {
85        self.bit(true)
86    }
87    #[doc = r"Clears the field bit"]
88    #[inline(always)]
89    pub fn clear_bit(self) -> &'a mut W {
90        self.bit(false)
91    }
92    #[doc = r"Writes raw bits to the field"]
93    #[inline(always)]
94    pub fn bit(self, value: bool) -> &'a mut W {
95        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
96        self.w
97    }
98}
99#[doc = "Write proxy for field `BS1`"]
100pub struct BS1_W<'a> {
101    w: &'a mut W,
102}
103impl<'a> BS1_W<'a> {
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W {
107        self.bit(true)
108    }
109    #[doc = r"Clears the field bit"]
110    #[inline(always)]
111    pub fn clear_bit(self) -> &'a mut W {
112        self.bit(false)
113    }
114    #[doc = r"Writes raw bits to the field"]
115    #[inline(always)]
116    pub fn bit(self, value: bool) -> &'a mut W {
117        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
118        self.w
119    }
120}
121#[doc = "Write proxy for field `BS0`"]
122pub struct BS0_W<'a> {
123    w: &'a mut W,
124}
125impl<'a> BS0_W<'a> {
126    #[doc = r"Sets the field bit"]
127    #[inline(always)]
128    pub fn set_bit(self) -> &'a mut W {
129        self.bit(true)
130    }
131    #[doc = r"Clears the field bit"]
132    #[inline(always)]
133    pub fn clear_bit(self) -> &'a mut W {
134        self.bit(false)
135    }
136    #[doc = r"Writes raw bits to the field"]
137    #[inline(always)]
138    pub fn bit(self, value: bool) -> &'a mut W {
139        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
140        self.w
141    }
142}
143impl W {
144    #[doc = "Bit 19 - Port x reset bit y (y = 0..15)"]
145    #[inline(always)]
146    pub fn br3(&mut self) -> BR3_W {
147        BR3_W { w: self }
148    }
149    #[doc = "Bit 17 - Port x reset bit y (y = 0..15)"]
150    #[inline(always)]
151    pub fn br1(&mut self) -> BR1_W {
152        BR1_W { w: self }
153    }
154    #[doc = "Bit 16 - Port x set bit y (y= 0..15)"]
155    #[inline(always)]
156    pub fn br0(&mut self) -> BR0_W {
157        BR0_W { w: self }
158    }
159    #[doc = "Bit 3 - Port x set bit y (y= 0..15)"]
160    #[inline(always)]
161    pub fn bs3(&mut self) -> BS3_W {
162        BS3_W { w: self }
163    }
164    #[doc = "Bit 1 - Port x set bit y (y= 0..15)"]
165    #[inline(always)]
166    pub fn bs1(&mut self) -> BS1_W {
167        BS1_W { w: self }
168    }
169    #[doc = "Bit 0 - Port x set bit y (y= 0..15)"]
170    #[inline(always)]
171    pub fn bs0(&mut self) -> BS0_W {
172        BS0_W { w: self }
173    }
174}