stm32f1/stm32f102/gpioa/
bsrr.rs

1#[doc = "Register `BSRR` writer"]
2pub struct W(crate::W<BSRR_SPEC>);
3impl core::ops::Deref for W {
4    type Target = crate::W<BSRR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl core::ops::DerefMut for W {
11    #[inline(always)]
12    fn deref_mut(&mut self) -> &mut Self::Target {
13        &mut self.0
14    }
15}
16impl From<crate::W<BSRR_SPEC>> for W {
17    #[inline(always)]
18    fn from(writer: crate::W<BSRR_SPEC>) -> Self {
19        W(writer)
20    }
21}
22#[doc = "Set bit 0\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq)]
24pub enum BS0_AW {
25    #[doc = "1: Sets the corresponding ODRx bit"]
26    Set = 1,
27}
28impl From<BS0_AW> for bool {
29    #[inline(always)]
30    fn from(variant: BS0_AW) -> Self {
31        variant as u8 != 0
32    }
33}
34#[doc = "Field `BS0` writer - Set bit 0"]
35pub type BS0_W<'a, const O: u8> = crate::BitWriter<'a, u32, BSRR_SPEC, BS0_AW, O>;
36impl<'a, const O: u8> BS0_W<'a, O> {
37    #[doc = "Sets the corresponding ODRx bit"]
38    #[inline(always)]
39    pub fn set(self) -> &'a mut W {
40        self.variant(BS0_AW::Set)
41    }
42}
43#[doc = "Set bit 1"]
44pub use BS0_AW as BS1_AW;
45#[doc = "Set bit 1"]
46pub use BS0_AW as BS2_AW;
47#[doc = "Set bit 3"]
48pub use BS0_AW as BS3_AW;
49#[doc = "Set bit 4"]
50pub use BS0_AW as BS4_AW;
51#[doc = "Set bit 5"]
52pub use BS0_AW as BS5_AW;
53#[doc = "Set bit 6"]
54pub use BS0_AW as BS6_AW;
55#[doc = "Set bit 7"]
56pub use BS0_AW as BS7_AW;
57#[doc = "Set bit 8"]
58pub use BS0_AW as BS8_AW;
59#[doc = "Set bit 9"]
60pub use BS0_AW as BS9_AW;
61#[doc = "Set bit 10"]
62pub use BS0_AW as BS10_AW;
63#[doc = "Set bit 11"]
64pub use BS0_AW as BS11_AW;
65#[doc = "Set bit 12"]
66pub use BS0_AW as BS12_AW;
67#[doc = "Set bit 13"]
68pub use BS0_AW as BS13_AW;
69#[doc = "Set bit 14"]
70pub use BS0_AW as BS14_AW;
71#[doc = "Set bit 15"]
72pub use BS0_AW as BS15_AW;
73#[doc = "Field `BS1` writer - Set bit 1"]
74pub use BS0_W as BS1_W;
75#[doc = "Field `BS2` writer - Set bit 1"]
76pub use BS0_W as BS2_W;
77#[doc = "Field `BS3` writer - Set bit 3"]
78pub use BS0_W as BS3_W;
79#[doc = "Field `BS4` writer - Set bit 4"]
80pub use BS0_W as BS4_W;
81#[doc = "Field `BS5` writer - Set bit 5"]
82pub use BS0_W as BS5_W;
83#[doc = "Field `BS6` writer - Set bit 6"]
84pub use BS0_W as BS6_W;
85#[doc = "Field `BS7` writer - Set bit 7"]
86pub use BS0_W as BS7_W;
87#[doc = "Field `BS8` writer - Set bit 8"]
88pub use BS0_W as BS8_W;
89#[doc = "Field `BS9` writer - Set bit 9"]
90pub use BS0_W as BS9_W;
91#[doc = "Field `BS10` writer - Set bit 10"]
92pub use BS0_W as BS10_W;
93#[doc = "Field `BS11` writer - Set bit 11"]
94pub use BS0_W as BS11_W;
95#[doc = "Field `BS12` writer - Set bit 12"]
96pub use BS0_W as BS12_W;
97#[doc = "Field `BS13` writer - Set bit 13"]
98pub use BS0_W as BS13_W;
99#[doc = "Field `BS14` writer - Set bit 14"]
100pub use BS0_W as BS14_W;
101#[doc = "Field `BS15` writer - Set bit 15"]
102pub use BS0_W as BS15_W;
103#[doc = "Reset bit 0\n\nValue on reset: 0"]
104#[derive(Clone, Copy, Debug, PartialEq)]
105pub enum BR0_AW {
106    #[doc = "1: Resets the corresponding ODRx bit"]
107    Reset = 1,
108}
109impl From<BR0_AW> for bool {
110    #[inline(always)]
111    fn from(variant: BR0_AW) -> Self {
112        variant as u8 != 0
113    }
114}
115#[doc = "Field `BR0` writer - Reset bit 0"]
116pub type BR0_W<'a, const O: u8> = crate::BitWriter<'a, u32, BSRR_SPEC, BR0_AW, O>;
117impl<'a, const O: u8> BR0_W<'a, O> {
118    #[doc = "Resets the corresponding ODRx bit"]
119    #[inline(always)]
120    pub fn reset(self) -> &'a mut W {
121        self.variant(BR0_AW::Reset)
122    }
123}
124#[doc = "Reset bit 1"]
125pub use BR0_AW as BR1_AW;
126#[doc = "Reset bit 2"]
127pub use BR0_AW as BR2_AW;
128#[doc = "Reset bit 3"]
129pub use BR0_AW as BR3_AW;
130#[doc = "Reset bit 4"]
131pub use BR0_AW as BR4_AW;
132#[doc = "Reset bit 5"]
133pub use BR0_AW as BR5_AW;
134#[doc = "Reset bit 6"]
135pub use BR0_AW as BR6_AW;
136#[doc = "Reset bit 7"]
137pub use BR0_AW as BR7_AW;
138#[doc = "Reset bit 8"]
139pub use BR0_AW as BR8_AW;
140#[doc = "Reset bit 9"]
141pub use BR0_AW as BR9_AW;
142#[doc = "Reset bit 10"]
143pub use BR0_AW as BR10_AW;
144#[doc = "Reset bit 11"]
145pub use BR0_AW as BR11_AW;
146#[doc = "Reset bit 12"]
147pub use BR0_AW as BR12_AW;
148#[doc = "Reset bit 13"]
149pub use BR0_AW as BR13_AW;
150#[doc = "Reset bit 14"]
151pub use BR0_AW as BR14_AW;
152#[doc = "Reset bit 15"]
153pub use BR0_AW as BR15_AW;
154#[doc = "Field `BR1` writer - Reset bit 1"]
155pub use BR0_W as BR1_W;
156#[doc = "Field `BR2` writer - Reset bit 2"]
157pub use BR0_W as BR2_W;
158#[doc = "Field `BR3` writer - Reset bit 3"]
159pub use BR0_W as BR3_W;
160#[doc = "Field `BR4` writer - Reset bit 4"]
161pub use BR0_W as BR4_W;
162#[doc = "Field `BR5` writer - Reset bit 5"]
163pub use BR0_W as BR5_W;
164#[doc = "Field `BR6` writer - Reset bit 6"]
165pub use BR0_W as BR6_W;
166#[doc = "Field `BR7` writer - Reset bit 7"]
167pub use BR0_W as BR7_W;
168#[doc = "Field `BR8` writer - Reset bit 8"]
169pub use BR0_W as BR8_W;
170#[doc = "Field `BR9` writer - Reset bit 9"]
171pub use BR0_W as BR9_W;
172#[doc = "Field `BR10` writer - Reset bit 10"]
173pub use BR0_W as BR10_W;
174#[doc = "Field `BR11` writer - Reset bit 11"]
175pub use BR0_W as BR11_W;
176#[doc = "Field `BR12` writer - Reset bit 12"]
177pub use BR0_W as BR12_W;
178#[doc = "Field `BR13` writer - Reset bit 13"]
179pub use BR0_W as BR13_W;
180#[doc = "Field `BR14` writer - Reset bit 14"]
181pub use BR0_W as BR14_W;
182#[doc = "Field `BR15` writer - Reset bit 15"]
183pub use BR0_W as BR15_W;
184impl W {
185    #[doc = "Bit 0 - Set bit 0"]
186    #[inline(always)]
187    pub fn bs0(&mut self) -> BS0_W<0> {
188        BS0_W::new(self)
189    }
190    #[doc = "Bit 1 - Set bit 1"]
191    #[inline(always)]
192    pub fn bs1(&mut self) -> BS1_W<1> {
193        BS1_W::new(self)
194    }
195    #[doc = "Bit 2 - Set bit 1"]
196    #[inline(always)]
197    pub fn bs2(&mut self) -> BS2_W<2> {
198        BS2_W::new(self)
199    }
200    #[doc = "Bit 3 - Set bit 3"]
201    #[inline(always)]
202    pub fn bs3(&mut self) -> BS3_W<3> {
203        BS3_W::new(self)
204    }
205    #[doc = "Bit 4 - Set bit 4"]
206    #[inline(always)]
207    pub fn bs4(&mut self) -> BS4_W<4> {
208        BS4_W::new(self)
209    }
210    #[doc = "Bit 5 - Set bit 5"]
211    #[inline(always)]
212    pub fn bs5(&mut self) -> BS5_W<5> {
213        BS5_W::new(self)
214    }
215    #[doc = "Bit 6 - Set bit 6"]
216    #[inline(always)]
217    pub fn bs6(&mut self) -> BS6_W<6> {
218        BS6_W::new(self)
219    }
220    #[doc = "Bit 7 - Set bit 7"]
221    #[inline(always)]
222    pub fn bs7(&mut self) -> BS7_W<7> {
223        BS7_W::new(self)
224    }
225    #[doc = "Bit 8 - Set bit 8"]
226    #[inline(always)]
227    pub fn bs8(&mut self) -> BS8_W<8> {
228        BS8_W::new(self)
229    }
230    #[doc = "Bit 9 - Set bit 9"]
231    #[inline(always)]
232    pub fn bs9(&mut self) -> BS9_W<9> {
233        BS9_W::new(self)
234    }
235    #[doc = "Bit 10 - Set bit 10"]
236    #[inline(always)]
237    pub fn bs10(&mut self) -> BS10_W<10> {
238        BS10_W::new(self)
239    }
240    #[doc = "Bit 11 - Set bit 11"]
241    #[inline(always)]
242    pub fn bs11(&mut self) -> BS11_W<11> {
243        BS11_W::new(self)
244    }
245    #[doc = "Bit 12 - Set bit 12"]
246    #[inline(always)]
247    pub fn bs12(&mut self) -> BS12_W<12> {
248        BS12_W::new(self)
249    }
250    #[doc = "Bit 13 - Set bit 13"]
251    #[inline(always)]
252    pub fn bs13(&mut self) -> BS13_W<13> {
253        BS13_W::new(self)
254    }
255    #[doc = "Bit 14 - Set bit 14"]
256    #[inline(always)]
257    pub fn bs14(&mut self) -> BS14_W<14> {
258        BS14_W::new(self)
259    }
260    #[doc = "Bit 15 - Set bit 15"]
261    #[inline(always)]
262    pub fn bs15(&mut self) -> BS15_W<15> {
263        BS15_W::new(self)
264    }
265    #[doc = "Bit 16 - Reset bit 0"]
266    #[inline(always)]
267    pub fn br0(&mut self) -> BR0_W<16> {
268        BR0_W::new(self)
269    }
270    #[doc = "Bit 17 - Reset bit 1"]
271    #[inline(always)]
272    pub fn br1(&mut self) -> BR1_W<17> {
273        BR1_W::new(self)
274    }
275    #[doc = "Bit 18 - Reset bit 2"]
276    #[inline(always)]
277    pub fn br2(&mut self) -> BR2_W<18> {
278        BR2_W::new(self)
279    }
280    #[doc = "Bit 19 - Reset bit 3"]
281    #[inline(always)]
282    pub fn br3(&mut self) -> BR3_W<19> {
283        BR3_W::new(self)
284    }
285    #[doc = "Bit 20 - Reset bit 4"]
286    #[inline(always)]
287    pub fn br4(&mut self) -> BR4_W<20> {
288        BR4_W::new(self)
289    }
290    #[doc = "Bit 21 - Reset bit 5"]
291    #[inline(always)]
292    pub fn br5(&mut self) -> BR5_W<21> {
293        BR5_W::new(self)
294    }
295    #[doc = "Bit 22 - Reset bit 6"]
296    #[inline(always)]
297    pub fn br6(&mut self) -> BR6_W<22> {
298        BR6_W::new(self)
299    }
300    #[doc = "Bit 23 - Reset bit 7"]
301    #[inline(always)]
302    pub fn br7(&mut self) -> BR7_W<23> {
303        BR7_W::new(self)
304    }
305    #[doc = "Bit 24 - Reset bit 8"]
306    #[inline(always)]
307    pub fn br8(&mut self) -> BR8_W<24> {
308        BR8_W::new(self)
309    }
310    #[doc = "Bit 25 - Reset bit 9"]
311    #[inline(always)]
312    pub fn br9(&mut self) -> BR9_W<25> {
313        BR9_W::new(self)
314    }
315    #[doc = "Bit 26 - Reset bit 10"]
316    #[inline(always)]
317    pub fn br10(&mut self) -> BR10_W<26> {
318        BR10_W::new(self)
319    }
320    #[doc = "Bit 27 - Reset bit 11"]
321    #[inline(always)]
322    pub fn br11(&mut self) -> BR11_W<27> {
323        BR11_W::new(self)
324    }
325    #[doc = "Bit 28 - Reset bit 12"]
326    #[inline(always)]
327    pub fn br12(&mut self) -> BR12_W<28> {
328        BR12_W::new(self)
329    }
330    #[doc = "Bit 29 - Reset bit 13"]
331    #[inline(always)]
332    pub fn br13(&mut self) -> BR13_W<29> {
333        BR13_W::new(self)
334    }
335    #[doc = "Bit 30 - Reset bit 14"]
336    #[inline(always)]
337    pub fn br14(&mut self) -> BR14_W<30> {
338        BR14_W::new(self)
339    }
340    #[doc = "Bit 31 - Reset bit 15"]
341    #[inline(always)]
342    pub fn br15(&mut self) -> BR15_W<31> {
343        BR15_W::new(self)
344    }
345    #[doc = "Writes raw bits to the register."]
346    #[inline(always)]
347    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
348        self.0.bits(bits);
349        self
350    }
351}
352#[doc = "Port bit set/reset register (GPIOn_BSRR)\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [bsrr](index.html) module"]
353pub struct BSRR_SPEC;
354impl crate::RegisterSpec for BSRR_SPEC {
355    type Ux = u32;
356}
357#[doc = "`write(|w| ..)` method takes [bsrr::W](W) writer structure"]
358impl crate::Writable for BSRR_SPEC {
359    type Writer = W;
360}
361#[doc = "`reset()` method sets BSRR to value 0"]
362impl crate::Resettable for BSRR_SPEC {
363    #[inline(always)]
364    fn reset_value() -> Self::Ux {
365        0
366    }
367}