stm32l4x2_pac/gpioa/
idr.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5impl super::IDR {
6    #[doc = r" Reads the contents of the register"]
7    #[inline]
8    pub fn read(&self) -> R {
9        R {
10            bits: self.register.get(),
11        }
12    }
13}
14#[doc = "Possible values of the field `IDR15`"]
15#[derive(Clone, Copy, Debug, PartialEq)]
16pub enum IDR15R {
17    #[doc = "Input is logic high"]
18    HIGH,
19    #[doc = "Input is logic low"]
20    LOW,
21}
22impl IDR15R {
23    #[doc = r" Returns `true` if the bit is clear (0)"]
24    #[inline]
25    pub fn bit_is_clear(&self) -> bool {
26        !self.bit()
27    }
28    #[doc = r" Returns `true` if the bit is set (1)"]
29    #[inline]
30    pub fn bit_is_set(&self) -> bool {
31        self.bit()
32    }
33    #[doc = r" Value of the field as raw bits"]
34    #[inline]
35    pub fn bit(&self) -> bool {
36        match *self {
37            IDR15R::HIGH => true,
38            IDR15R::LOW => false,
39        }
40    }
41    #[allow(missing_docs)]
42    #[doc(hidden)]
43    #[inline]
44    pub fn _from(value: bool) -> IDR15R {
45        match value {
46            true => IDR15R::HIGH,
47            false => IDR15R::LOW,
48        }
49    }
50    #[doc = "Checks if the value of the field is `HIGH`"]
51    #[inline]
52    pub fn is_high(&self) -> bool {
53        *self == IDR15R::HIGH
54    }
55    #[doc = "Checks if the value of the field is `LOW`"]
56    #[inline]
57    pub fn is_low(&self) -> bool {
58        *self == IDR15R::LOW
59    }
60}
61#[doc = "Possible values of the field `IDR14`"]
62pub type IDR14R = IDR15R;
63#[doc = "Possible values of the field `IDR13`"]
64pub type IDR13R = IDR15R;
65#[doc = "Possible values of the field `IDR12`"]
66pub type IDR12R = IDR15R;
67#[doc = "Possible values of the field `IDR11`"]
68pub type IDR11R = IDR15R;
69#[doc = "Possible values of the field `IDR10`"]
70pub type IDR10R = IDR15R;
71#[doc = "Possible values of the field `IDR9`"]
72pub type IDR9R = IDR15R;
73#[doc = "Possible values of the field `IDR8`"]
74pub type IDR8R = IDR15R;
75#[doc = "Possible values of the field `IDR7`"]
76pub type IDR7R = IDR15R;
77#[doc = "Possible values of the field `IDR6`"]
78pub type IDR6R = IDR15R;
79#[doc = "Possible values of the field `IDR5`"]
80pub type IDR5R = IDR15R;
81#[doc = "Possible values of the field `IDR4`"]
82pub type IDR4R = IDR15R;
83#[doc = "Possible values of the field `IDR3`"]
84pub type IDR3R = IDR15R;
85#[doc = "Possible values of the field `IDR2`"]
86pub type IDR2R = IDR15R;
87#[doc = "Possible values of the field `IDR1`"]
88pub type IDR1R = IDR15R;
89#[doc = "Possible values of the field `IDR0`"]
90pub type IDR0R = IDR15R;
91impl R {
92    #[doc = r" Value of the register as raw bits"]
93    #[inline]
94    pub fn bits(&self) -> u32 {
95        self.bits
96    }
97    #[doc = "Bit 15 - Port input data (y = 0..15)"]
98    #[inline]
99    pub fn idr15(&self) -> IDR15R {
100        IDR15R::_from({
101            const MASK: bool = true;
102            const OFFSET: u8 = 15;
103            ((self.bits >> OFFSET) & MASK as u32) != 0
104        })
105    }
106    #[doc = "Bit 14 - Port input data (y = 0..15)"]
107    #[inline]
108    pub fn idr14(&self) -> IDR14R {
109        IDR14R::_from({
110            const MASK: bool = true;
111            const OFFSET: u8 = 14;
112            ((self.bits >> OFFSET) & MASK as u32) != 0
113        })
114    }
115    #[doc = "Bit 13 - Port input data (y = 0..15)"]
116    #[inline]
117    pub fn idr13(&self) -> IDR13R {
118        IDR13R::_from({
119            const MASK: bool = true;
120            const OFFSET: u8 = 13;
121            ((self.bits >> OFFSET) & MASK as u32) != 0
122        })
123    }
124    #[doc = "Bit 12 - Port input data (y = 0..15)"]
125    #[inline]
126    pub fn idr12(&self) -> IDR12R {
127        IDR12R::_from({
128            const MASK: bool = true;
129            const OFFSET: u8 = 12;
130            ((self.bits >> OFFSET) & MASK as u32) != 0
131        })
132    }
133    #[doc = "Bit 11 - Port input data (y = 0..15)"]
134    #[inline]
135    pub fn idr11(&self) -> IDR11R {
136        IDR11R::_from({
137            const MASK: bool = true;
138            const OFFSET: u8 = 11;
139            ((self.bits >> OFFSET) & MASK as u32) != 0
140        })
141    }
142    #[doc = "Bit 10 - Port input data (y = 0..15)"]
143    #[inline]
144    pub fn idr10(&self) -> IDR10R {
145        IDR10R::_from({
146            const MASK: bool = true;
147            const OFFSET: u8 = 10;
148            ((self.bits >> OFFSET) & MASK as u32) != 0
149        })
150    }
151    #[doc = "Bit 9 - Port input data (y = 0..15)"]
152    #[inline]
153    pub fn idr9(&self) -> IDR9R {
154        IDR9R::_from({
155            const MASK: bool = true;
156            const OFFSET: u8 = 9;
157            ((self.bits >> OFFSET) & MASK as u32) != 0
158        })
159    }
160    #[doc = "Bit 8 - Port input data (y = 0..15)"]
161    #[inline]
162    pub fn idr8(&self) -> IDR8R {
163        IDR8R::_from({
164            const MASK: bool = true;
165            const OFFSET: u8 = 8;
166            ((self.bits >> OFFSET) & MASK as u32) != 0
167        })
168    }
169    #[doc = "Bit 7 - Port input data (y = 0..15)"]
170    #[inline]
171    pub fn idr7(&self) -> IDR7R {
172        IDR7R::_from({
173            const MASK: bool = true;
174            const OFFSET: u8 = 7;
175            ((self.bits >> OFFSET) & MASK as u32) != 0
176        })
177    }
178    #[doc = "Bit 6 - Port input data (y = 0..15)"]
179    #[inline]
180    pub fn idr6(&self) -> IDR6R {
181        IDR6R::_from({
182            const MASK: bool = true;
183            const OFFSET: u8 = 6;
184            ((self.bits >> OFFSET) & MASK as u32) != 0
185        })
186    }
187    #[doc = "Bit 5 - Port input data (y = 0..15)"]
188    #[inline]
189    pub fn idr5(&self) -> IDR5R {
190        IDR5R::_from({
191            const MASK: bool = true;
192            const OFFSET: u8 = 5;
193            ((self.bits >> OFFSET) & MASK as u32) != 0
194        })
195    }
196    #[doc = "Bit 4 - Port input data (y = 0..15)"]
197    #[inline]
198    pub fn idr4(&self) -> IDR4R {
199        IDR4R::_from({
200            const MASK: bool = true;
201            const OFFSET: u8 = 4;
202            ((self.bits >> OFFSET) & MASK as u32) != 0
203        })
204    }
205    #[doc = "Bit 3 - Port input data (y = 0..15)"]
206    #[inline]
207    pub fn idr3(&self) -> IDR3R {
208        IDR3R::_from({
209            const MASK: bool = true;
210            const OFFSET: u8 = 3;
211            ((self.bits >> OFFSET) & MASK as u32) != 0
212        })
213    }
214    #[doc = "Bit 2 - Port input data (y = 0..15)"]
215    #[inline]
216    pub fn idr2(&self) -> IDR2R {
217        IDR2R::_from({
218            const MASK: bool = true;
219            const OFFSET: u8 = 2;
220            ((self.bits >> OFFSET) & MASK as u32) != 0
221        })
222    }
223    #[doc = "Bit 1 - Port input data (y = 0..15)"]
224    #[inline]
225    pub fn idr1(&self) -> IDR1R {
226        IDR1R::_from({
227            const MASK: bool = true;
228            const OFFSET: u8 = 1;
229            ((self.bits >> OFFSET) & MASK as u32) != 0
230        })
231    }
232    #[doc = "Bit 0 - Port input data (y = 0..15)"]
233    #[inline]
234    pub fn idr0(&self) -> IDR0R {
235        IDR0R::_from({
236            const MASK: bool = true;
237            const OFFSET: u8 = 0;
238            ((self.bits >> OFFSET) & MASK as u32) != 0
239        })
240    }
241}