stm32l0/stm32l0x1/gpiob/
ospeedr.rs

1#[doc = "Register `OSPEEDR` reader"]
2pub struct R(crate::R<OSPEEDR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<OSPEEDR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<OSPEEDR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<OSPEEDR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `OSPEEDR` writer"]
17pub struct W(crate::W<OSPEEDR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<OSPEEDR_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<OSPEEDR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<OSPEEDR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Port x configuration bits (y = 0..15)"]
38pub use OSPEED0_A as OSPEED15_A;
39#[doc = "Port x configuration bits (y = 0..15)"]
40pub use OSPEED0_A as OSPEED14_A;
41#[doc = "Port x configuration bits (y = 0..15)"]
42pub use OSPEED0_A as OSPEED13_A;
43#[doc = "Port x configuration bits (y = 0..15)"]
44pub use OSPEED0_A as OSPEED12_A;
45#[doc = "Port x configuration bits (y = 0..15)"]
46pub use OSPEED0_A as OSPEED11_A;
47#[doc = "Port x configuration bits (y = 0..15)"]
48pub use OSPEED0_A as OSPEED10_A;
49#[doc = "Port x configuration bits (y = 0..15)"]
50pub use OSPEED0_A as OSPEED9_A;
51#[doc = "Port x configuration bits (y = 0..15)"]
52pub use OSPEED0_A as OSPEED8_A;
53#[doc = "Port x configuration bits (y = 0..15)"]
54pub use OSPEED0_A as OSPEED7_A;
55#[doc = "Port x configuration bits (y = 0..15)"]
56pub use OSPEED0_A as OSPEED6_A;
57#[doc = "Port x configuration bits (y = 0..15)"]
58pub use OSPEED0_A as OSPEED5_A;
59#[doc = "Port x configuration bits (y = 0..15)"]
60pub use OSPEED0_A as OSPEED4_A;
61#[doc = "Port x configuration bits (y = 0..15)"]
62pub use OSPEED0_A as OSPEED3_A;
63#[doc = "Port x configuration bits (y = 0..15)"]
64pub use OSPEED0_A as OSPEED2_A;
65#[doc = "Port x configuration bits (y = 0..15)"]
66pub use OSPEED0_A as OSPEED1_A;
67#[doc = "Field `OSPEED15` reader - Port x configuration bits (y = 0..15)"]
68pub use OSPEED0_R as OSPEED15_R;
69#[doc = "Field `OSPEED14` reader - Port x configuration bits (y = 0..15)"]
70pub use OSPEED0_R as OSPEED14_R;
71#[doc = "Field `OSPEED13` reader - Port x configuration bits (y = 0..15)"]
72pub use OSPEED0_R as OSPEED13_R;
73#[doc = "Field `OSPEED12` reader - Port x configuration bits (y = 0..15)"]
74pub use OSPEED0_R as OSPEED12_R;
75#[doc = "Field `OSPEED11` reader - Port x configuration bits (y = 0..15)"]
76pub use OSPEED0_R as OSPEED11_R;
77#[doc = "Field `OSPEED10` reader - Port x configuration bits (y = 0..15)"]
78pub use OSPEED0_R as OSPEED10_R;
79#[doc = "Field `OSPEED9` reader - Port x configuration bits (y = 0..15)"]
80pub use OSPEED0_R as OSPEED9_R;
81#[doc = "Field `OSPEED8` reader - Port x configuration bits (y = 0..15)"]
82pub use OSPEED0_R as OSPEED8_R;
83#[doc = "Field `OSPEED7` reader - Port x configuration bits (y = 0..15)"]
84pub use OSPEED0_R as OSPEED7_R;
85#[doc = "Field `OSPEED6` reader - Port x configuration bits (y = 0..15)"]
86pub use OSPEED0_R as OSPEED6_R;
87#[doc = "Field `OSPEED5` reader - Port x configuration bits (y = 0..15)"]
88pub use OSPEED0_R as OSPEED5_R;
89#[doc = "Field `OSPEED4` reader - Port x configuration bits (y = 0..15)"]
90pub use OSPEED0_R as OSPEED4_R;
91#[doc = "Field `OSPEED3` reader - Port x configuration bits (y = 0..15)"]
92pub use OSPEED0_R as OSPEED3_R;
93#[doc = "Field `OSPEED2` reader - Port x configuration bits (y = 0..15)"]
94pub use OSPEED0_R as OSPEED2_R;
95#[doc = "Field `OSPEED1` reader - Port x configuration bits (y = 0..15)"]
96pub use OSPEED0_R as OSPEED1_R;
97#[doc = "Field `OSPEED15` writer - Port x configuration bits (y = 0..15)"]
98pub use OSPEED0_W as OSPEED15_W;
99#[doc = "Field `OSPEED14` writer - Port x configuration bits (y = 0..15)"]
100pub use OSPEED0_W as OSPEED14_W;
101#[doc = "Field `OSPEED13` writer - Port x configuration bits (y = 0..15)"]
102pub use OSPEED0_W as OSPEED13_W;
103#[doc = "Field `OSPEED12` writer - Port x configuration bits (y = 0..15)"]
104pub use OSPEED0_W as OSPEED12_W;
105#[doc = "Field `OSPEED11` writer - Port x configuration bits (y = 0..15)"]
106pub use OSPEED0_W as OSPEED11_W;
107#[doc = "Field `OSPEED10` writer - Port x configuration bits (y = 0..15)"]
108pub use OSPEED0_W as OSPEED10_W;
109#[doc = "Field `OSPEED9` writer - Port x configuration bits (y = 0..15)"]
110pub use OSPEED0_W as OSPEED9_W;
111#[doc = "Field `OSPEED8` writer - Port x configuration bits (y = 0..15)"]
112pub use OSPEED0_W as OSPEED8_W;
113#[doc = "Field `OSPEED7` writer - Port x configuration bits (y = 0..15)"]
114pub use OSPEED0_W as OSPEED7_W;
115#[doc = "Field `OSPEED6` writer - Port x configuration bits (y = 0..15)"]
116pub use OSPEED0_W as OSPEED6_W;
117#[doc = "Field `OSPEED5` writer - Port x configuration bits (y = 0..15)"]
118pub use OSPEED0_W as OSPEED5_W;
119#[doc = "Field `OSPEED4` writer - Port x configuration bits (y = 0..15)"]
120pub use OSPEED0_W as OSPEED4_W;
121#[doc = "Field `OSPEED3` writer - Port x configuration bits (y = 0..15)"]
122pub use OSPEED0_W as OSPEED3_W;
123#[doc = "Field `OSPEED2` writer - Port x configuration bits (y = 0..15)"]
124pub use OSPEED0_W as OSPEED2_W;
125#[doc = "Field `OSPEED1` writer - Port x configuration bits (y = 0..15)"]
126pub use OSPEED0_W as OSPEED1_W;
127#[doc = "Port x configuration bits (y = 0..15)\n\nValue on reset: 0"]
128#[derive(Clone, Copy, Debug, PartialEq)]
129#[repr(u8)]
130pub enum OSPEED0_A {
131    #[doc = "0: Low speed"]
132    LowSpeed = 0,
133    #[doc = "1: Medium speed"]
134    MediumSpeed = 1,
135    #[doc = "2: High speed"]
136    HighSpeed = 2,
137    #[doc = "3: Very high speed"]
138    VeryHighSpeed = 3,
139}
140impl From<OSPEED0_A> for u8 {
141    #[inline(always)]
142    fn from(variant: OSPEED0_A) -> Self {
143        variant as _
144    }
145}
146#[doc = "Field `OSPEED0` reader - Port x configuration bits (y = 0..15)"]
147pub type OSPEED0_R = crate::FieldReader<u8, OSPEED0_A>;
148impl OSPEED0_R {
149    #[doc = "Get enumerated values variant"]
150    #[inline(always)]
151    pub fn variant(&self) -> OSPEED0_A {
152        match self.bits {
153            0 => OSPEED0_A::LowSpeed,
154            1 => OSPEED0_A::MediumSpeed,
155            2 => OSPEED0_A::HighSpeed,
156            3 => OSPEED0_A::VeryHighSpeed,
157            _ => unreachable!(),
158        }
159    }
160    #[doc = "Checks if the value of the field is `LowSpeed`"]
161    #[inline(always)]
162    pub fn is_low_speed(&self) -> bool {
163        *self == OSPEED0_A::LowSpeed
164    }
165    #[doc = "Checks if the value of the field is `MediumSpeed`"]
166    #[inline(always)]
167    pub fn is_medium_speed(&self) -> bool {
168        *self == OSPEED0_A::MediumSpeed
169    }
170    #[doc = "Checks if the value of the field is `HighSpeed`"]
171    #[inline(always)]
172    pub fn is_high_speed(&self) -> bool {
173        *self == OSPEED0_A::HighSpeed
174    }
175    #[doc = "Checks if the value of the field is `VeryHighSpeed`"]
176    #[inline(always)]
177    pub fn is_very_high_speed(&self) -> bool {
178        *self == OSPEED0_A::VeryHighSpeed
179    }
180}
181#[doc = "Field `OSPEED0` writer - Port x configuration bits (y = 0..15)"]
182pub type OSPEED0_W<'a, const O: u8> =
183    crate::FieldWriterSafe<'a, u32, OSPEEDR_SPEC, u8, OSPEED0_A, 2, O>;
184impl<'a, const O: u8> OSPEED0_W<'a, O> {
185    #[doc = "Low speed"]
186    #[inline(always)]
187    pub fn low_speed(self) -> &'a mut W {
188        self.variant(OSPEED0_A::LowSpeed)
189    }
190    #[doc = "Medium speed"]
191    #[inline(always)]
192    pub fn medium_speed(self) -> &'a mut W {
193        self.variant(OSPEED0_A::MediumSpeed)
194    }
195    #[doc = "High speed"]
196    #[inline(always)]
197    pub fn high_speed(self) -> &'a mut W {
198        self.variant(OSPEED0_A::HighSpeed)
199    }
200    #[doc = "Very high speed"]
201    #[inline(always)]
202    pub fn very_high_speed(self) -> &'a mut W {
203        self.variant(OSPEED0_A::VeryHighSpeed)
204    }
205}
206impl R {
207    #[doc = "Bits 30:31 - Port x configuration bits (y = 0..15)"]
208    #[inline(always)]
209    pub fn ospeed15(&self) -> OSPEED15_R {
210        OSPEED15_R::new(((self.bits >> 30) & 3) as u8)
211    }
212    #[doc = "Bits 28:29 - Port x configuration bits (y = 0..15)"]
213    #[inline(always)]
214    pub fn ospeed14(&self) -> OSPEED14_R {
215        OSPEED14_R::new(((self.bits >> 28) & 3) as u8)
216    }
217    #[doc = "Bits 26:27 - Port x configuration bits (y = 0..15)"]
218    #[inline(always)]
219    pub fn ospeed13(&self) -> OSPEED13_R {
220        OSPEED13_R::new(((self.bits >> 26) & 3) as u8)
221    }
222    #[doc = "Bits 24:25 - Port x configuration bits (y = 0..15)"]
223    #[inline(always)]
224    pub fn ospeed12(&self) -> OSPEED12_R {
225        OSPEED12_R::new(((self.bits >> 24) & 3) as u8)
226    }
227    #[doc = "Bits 22:23 - Port x configuration bits (y = 0..15)"]
228    #[inline(always)]
229    pub fn ospeed11(&self) -> OSPEED11_R {
230        OSPEED11_R::new(((self.bits >> 22) & 3) as u8)
231    }
232    #[doc = "Bits 20:21 - Port x configuration bits (y = 0..15)"]
233    #[inline(always)]
234    pub fn ospeed10(&self) -> OSPEED10_R {
235        OSPEED10_R::new(((self.bits >> 20) & 3) as u8)
236    }
237    #[doc = "Bits 18:19 - Port x configuration bits (y = 0..15)"]
238    #[inline(always)]
239    pub fn ospeed9(&self) -> OSPEED9_R {
240        OSPEED9_R::new(((self.bits >> 18) & 3) as u8)
241    }
242    #[doc = "Bits 16:17 - Port x configuration bits (y = 0..15)"]
243    #[inline(always)]
244    pub fn ospeed8(&self) -> OSPEED8_R {
245        OSPEED8_R::new(((self.bits >> 16) & 3) as u8)
246    }
247    #[doc = "Bits 14:15 - Port x configuration bits (y = 0..15)"]
248    #[inline(always)]
249    pub fn ospeed7(&self) -> OSPEED7_R {
250        OSPEED7_R::new(((self.bits >> 14) & 3) as u8)
251    }
252    #[doc = "Bits 12:13 - Port x configuration bits (y = 0..15)"]
253    #[inline(always)]
254    pub fn ospeed6(&self) -> OSPEED6_R {
255        OSPEED6_R::new(((self.bits >> 12) & 3) as u8)
256    }
257    #[doc = "Bits 10:11 - Port x configuration bits (y = 0..15)"]
258    #[inline(always)]
259    pub fn ospeed5(&self) -> OSPEED5_R {
260        OSPEED5_R::new(((self.bits >> 10) & 3) as u8)
261    }
262    #[doc = "Bits 8:9 - Port x configuration bits (y = 0..15)"]
263    #[inline(always)]
264    pub fn ospeed4(&self) -> OSPEED4_R {
265        OSPEED4_R::new(((self.bits >> 8) & 3) as u8)
266    }
267    #[doc = "Bits 6:7 - Port x configuration bits (y = 0..15)"]
268    #[inline(always)]
269    pub fn ospeed3(&self) -> OSPEED3_R {
270        OSPEED3_R::new(((self.bits >> 6) & 3) as u8)
271    }
272    #[doc = "Bits 4:5 - Port x configuration bits (y = 0..15)"]
273    #[inline(always)]
274    pub fn ospeed2(&self) -> OSPEED2_R {
275        OSPEED2_R::new(((self.bits >> 4) & 3) as u8)
276    }
277    #[doc = "Bits 2:3 - Port x configuration bits (y = 0..15)"]
278    #[inline(always)]
279    pub fn ospeed1(&self) -> OSPEED1_R {
280        OSPEED1_R::new(((self.bits >> 2) & 3) as u8)
281    }
282    #[doc = "Bits 0:1 - Port x configuration bits (y = 0..15)"]
283    #[inline(always)]
284    pub fn ospeed0(&self) -> OSPEED0_R {
285        OSPEED0_R::new((self.bits & 3) as u8)
286    }
287}
288impl W {
289    #[doc = "Bits 30:31 - Port x configuration bits (y = 0..15)"]
290    #[inline(always)]
291    pub fn ospeed15(&mut self) -> OSPEED15_W<30> {
292        OSPEED15_W::new(self)
293    }
294    #[doc = "Bits 28:29 - Port x configuration bits (y = 0..15)"]
295    #[inline(always)]
296    pub fn ospeed14(&mut self) -> OSPEED14_W<28> {
297        OSPEED14_W::new(self)
298    }
299    #[doc = "Bits 26:27 - Port x configuration bits (y = 0..15)"]
300    #[inline(always)]
301    pub fn ospeed13(&mut self) -> OSPEED13_W<26> {
302        OSPEED13_W::new(self)
303    }
304    #[doc = "Bits 24:25 - Port x configuration bits (y = 0..15)"]
305    #[inline(always)]
306    pub fn ospeed12(&mut self) -> OSPEED12_W<24> {
307        OSPEED12_W::new(self)
308    }
309    #[doc = "Bits 22:23 - Port x configuration bits (y = 0..15)"]
310    #[inline(always)]
311    pub fn ospeed11(&mut self) -> OSPEED11_W<22> {
312        OSPEED11_W::new(self)
313    }
314    #[doc = "Bits 20:21 - Port x configuration bits (y = 0..15)"]
315    #[inline(always)]
316    pub fn ospeed10(&mut self) -> OSPEED10_W<20> {
317        OSPEED10_W::new(self)
318    }
319    #[doc = "Bits 18:19 - Port x configuration bits (y = 0..15)"]
320    #[inline(always)]
321    pub fn ospeed9(&mut self) -> OSPEED9_W<18> {
322        OSPEED9_W::new(self)
323    }
324    #[doc = "Bits 16:17 - Port x configuration bits (y = 0..15)"]
325    #[inline(always)]
326    pub fn ospeed8(&mut self) -> OSPEED8_W<16> {
327        OSPEED8_W::new(self)
328    }
329    #[doc = "Bits 14:15 - Port x configuration bits (y = 0..15)"]
330    #[inline(always)]
331    pub fn ospeed7(&mut self) -> OSPEED7_W<14> {
332        OSPEED7_W::new(self)
333    }
334    #[doc = "Bits 12:13 - Port x configuration bits (y = 0..15)"]
335    #[inline(always)]
336    pub fn ospeed6(&mut self) -> OSPEED6_W<12> {
337        OSPEED6_W::new(self)
338    }
339    #[doc = "Bits 10:11 - Port x configuration bits (y = 0..15)"]
340    #[inline(always)]
341    pub fn ospeed5(&mut self) -> OSPEED5_W<10> {
342        OSPEED5_W::new(self)
343    }
344    #[doc = "Bits 8:9 - Port x configuration bits (y = 0..15)"]
345    #[inline(always)]
346    pub fn ospeed4(&mut self) -> OSPEED4_W<8> {
347        OSPEED4_W::new(self)
348    }
349    #[doc = "Bits 6:7 - Port x configuration bits (y = 0..15)"]
350    #[inline(always)]
351    pub fn ospeed3(&mut self) -> OSPEED3_W<6> {
352        OSPEED3_W::new(self)
353    }
354    #[doc = "Bits 4:5 - Port x configuration bits (y = 0..15)"]
355    #[inline(always)]
356    pub fn ospeed2(&mut self) -> OSPEED2_W<4> {
357        OSPEED2_W::new(self)
358    }
359    #[doc = "Bits 2:3 - Port x configuration bits (y = 0..15)"]
360    #[inline(always)]
361    pub fn ospeed1(&mut self) -> OSPEED1_W<2> {
362        OSPEED1_W::new(self)
363    }
364    #[doc = "Bits 0:1 - Port x configuration bits (y = 0..15)"]
365    #[inline(always)]
366    pub fn ospeed0(&mut self) -> OSPEED0_W<0> {
367        OSPEED0_W::new(self)
368    }
369    #[doc = "Writes raw bits to the register."]
370    #[inline(always)]
371    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
372        self.0.bits(bits);
373        self
374    }
375}
376#[doc = "GPIO port output speed register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ospeedr](index.html) module"]
377pub struct OSPEEDR_SPEC;
378impl crate::RegisterSpec for OSPEEDR_SPEC {
379    type Ux = u32;
380}
381#[doc = "`read()` method returns [ospeedr::R](R) reader structure"]
382impl crate::Readable for OSPEEDR_SPEC {
383    type Reader = R;
384}
385#[doc = "`write(|w| ..)` method takes [ospeedr::W](W) writer structure"]
386impl crate::Writable for OSPEEDR_SPEC {
387    type Writer = W;
388}
389#[doc = "`reset()` method sets OSPEEDR to value 0"]
390impl crate::Resettable for OSPEEDR_SPEC {
391    #[inline(always)]
392    fn reset_value() -> Self::Ux {
393        0
394    }
395}