corstone300_pac/fpgaio/
switches.rs1#[doc = "Register `SWITCHES` reader"]
6pub struct R(crate::R<SWITCHES_SPEC>);
7impl core::ops::Deref for R {
8 type Target = crate::R<SWITCHES_SPEC>;
9 #[inline(always)]
10 fn deref(&self) -> &Self::Target {
11 &self.0
12 }
13}
14impl From<crate::R<SWITCHES_SPEC>> for R {
15 #[inline(always)]
16 fn from(reader: crate::R<SWITCHES_SPEC>) -> Self {
17 R(reader)
18 }
19}
20#[doc = "Field `SW0` reader - "]
21pub type SW0_R = crate::BitReader<SW0_A>;
22#[doc = "\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq, Eq)]
24pub enum SW0_A {
25 #[doc = "0: Switch is Off"]
26 OFF = 0,
27 #[doc = "1: Switch is On"]
28 ON = 1,
29}
30impl From<SW0_A> for bool {
31 #[inline(always)]
32 fn from(variant: SW0_A) -> Self {
33 variant as u8 != 0
34 }
35}
36impl SW0_R {
37 #[doc = "Get enumerated values variant"]
38 #[inline(always)]
39 pub fn variant(&self) -> SW0_A {
40 match self.bits {
41 false => SW0_A::OFF,
42 true => SW0_A::ON,
43 }
44 }
45 #[doc = "Checks if the value of the field is `OFF`"]
46 #[inline(always)]
47 pub fn is_off(&self) -> bool {
48 *self == SW0_A::OFF
49 }
50 #[doc = "Checks if the value of the field is `ON`"]
51 #[inline(always)]
52 pub fn is_on(&self) -> bool {
53 *self == SW0_A::ON
54 }
55}
56#[doc = "Field `SW1` reader - "]
57pub type SW1_R = crate::BitReader<SW1_A>;
58#[doc = "\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum SW1_A {
61 #[doc = "0: Switch is Off"]
62 OFF = 0,
63 #[doc = "1: Switch is On"]
64 ON = 1,
65}
66impl From<SW1_A> for bool {
67 #[inline(always)]
68 fn from(variant: SW1_A) -> Self {
69 variant as u8 != 0
70 }
71}
72impl SW1_R {
73 #[doc = "Get enumerated values variant"]
74 #[inline(always)]
75 pub fn variant(&self) -> SW1_A {
76 match self.bits {
77 false => SW1_A::OFF,
78 true => SW1_A::ON,
79 }
80 }
81 #[doc = "Checks if the value of the field is `OFF`"]
82 #[inline(always)]
83 pub fn is_off(&self) -> bool {
84 *self == SW1_A::OFF
85 }
86 #[doc = "Checks if the value of the field is `ON`"]
87 #[inline(always)]
88 pub fn is_on(&self) -> bool {
89 *self == SW1_A::ON
90 }
91}
92#[doc = "Field `SW2` reader - "]
93pub type SW2_R = crate::BitReader<SW2_A>;
94#[doc = "\n\nValue on reset: 0"]
95#[derive(Clone, Copy, Debug, PartialEq, Eq)]
96pub enum SW2_A {
97 #[doc = "0: Switch is Off"]
98 OFF = 0,
99 #[doc = "1: Switch is On"]
100 ON = 1,
101}
102impl From<SW2_A> for bool {
103 #[inline(always)]
104 fn from(variant: SW2_A) -> Self {
105 variant as u8 != 0
106 }
107}
108impl SW2_R {
109 #[doc = "Get enumerated values variant"]
110 #[inline(always)]
111 pub fn variant(&self) -> SW2_A {
112 match self.bits {
113 false => SW2_A::OFF,
114 true => SW2_A::ON,
115 }
116 }
117 #[doc = "Checks if the value of the field is `OFF`"]
118 #[inline(always)]
119 pub fn is_off(&self) -> bool {
120 *self == SW2_A::OFF
121 }
122 #[doc = "Checks if the value of the field is `ON`"]
123 #[inline(always)]
124 pub fn is_on(&self) -> bool {
125 *self == SW2_A::ON
126 }
127}
128#[doc = "Field `SW3` reader - "]
129pub type SW3_R = crate::BitReader<SW3_A>;
130#[doc = "\n\nValue on reset: 0"]
131#[derive(Clone, Copy, Debug, PartialEq, Eq)]
132pub enum SW3_A {
133 #[doc = "0: Switch is Off"]
134 OFF = 0,
135 #[doc = "1: Switch is On"]
136 ON = 1,
137}
138impl From<SW3_A> for bool {
139 #[inline(always)]
140 fn from(variant: SW3_A) -> Self {
141 variant as u8 != 0
142 }
143}
144impl SW3_R {
145 #[doc = "Get enumerated values variant"]
146 #[inline(always)]
147 pub fn variant(&self) -> SW3_A {
148 match self.bits {
149 false => SW3_A::OFF,
150 true => SW3_A::ON,
151 }
152 }
153 #[doc = "Checks if the value of the field is `OFF`"]
154 #[inline(always)]
155 pub fn is_off(&self) -> bool {
156 *self == SW3_A::OFF
157 }
158 #[doc = "Checks if the value of the field is `ON`"]
159 #[inline(always)]
160 pub fn is_on(&self) -> bool {
161 *self == SW3_A::ON
162 }
163}
164#[doc = "Field `SW4` reader - "]
165pub type SW4_R = crate::BitReader<SW4_A>;
166#[doc = "\n\nValue on reset: 0"]
167#[derive(Clone, Copy, Debug, PartialEq, Eq)]
168pub enum SW4_A {
169 #[doc = "0: Switch is Off"]
170 OFF = 0,
171 #[doc = "1: Switch is On"]
172 ON = 1,
173}
174impl From<SW4_A> for bool {
175 #[inline(always)]
176 fn from(variant: SW4_A) -> Self {
177 variant as u8 != 0
178 }
179}
180impl SW4_R {
181 #[doc = "Get enumerated values variant"]
182 #[inline(always)]
183 pub fn variant(&self) -> SW4_A {
184 match self.bits {
185 false => SW4_A::OFF,
186 true => SW4_A::ON,
187 }
188 }
189 #[doc = "Checks if the value of the field is `OFF`"]
190 #[inline(always)]
191 pub fn is_off(&self) -> bool {
192 *self == SW4_A::OFF
193 }
194 #[doc = "Checks if the value of the field is `ON`"]
195 #[inline(always)]
196 pub fn is_on(&self) -> bool {
197 *self == SW4_A::ON
198 }
199}
200#[doc = "Field `SW5` reader - "]
201pub type SW5_R = crate::BitReader<SW5_A>;
202#[doc = "\n\nValue on reset: 0"]
203#[derive(Clone, Copy, Debug, PartialEq, Eq)]
204pub enum SW5_A {
205 #[doc = "0: Switch is Off"]
206 OFF = 0,
207 #[doc = "1: Switch is On"]
208 ON = 1,
209}
210impl From<SW5_A> for bool {
211 #[inline(always)]
212 fn from(variant: SW5_A) -> Self {
213 variant as u8 != 0
214 }
215}
216impl SW5_R {
217 #[doc = "Get enumerated values variant"]
218 #[inline(always)]
219 pub fn variant(&self) -> SW5_A {
220 match self.bits {
221 false => SW5_A::OFF,
222 true => SW5_A::ON,
223 }
224 }
225 #[doc = "Checks if the value of the field is `OFF`"]
226 #[inline(always)]
227 pub fn is_off(&self) -> bool {
228 *self == SW5_A::OFF
229 }
230 #[doc = "Checks if the value of the field is `ON`"]
231 #[inline(always)]
232 pub fn is_on(&self) -> bool {
233 *self == SW5_A::ON
234 }
235}
236#[doc = "Field `SW6` reader - "]
237pub type SW6_R = crate::BitReader<SW6_A>;
238#[doc = "\n\nValue on reset: 0"]
239#[derive(Clone, Copy, Debug, PartialEq, Eq)]
240pub enum SW6_A {
241 #[doc = "0: Switch is Off"]
242 OFF = 0,
243 #[doc = "1: Switch is On"]
244 ON = 1,
245}
246impl From<SW6_A> for bool {
247 #[inline(always)]
248 fn from(variant: SW6_A) -> Self {
249 variant as u8 != 0
250 }
251}
252impl SW6_R {
253 #[doc = "Get enumerated values variant"]
254 #[inline(always)]
255 pub fn variant(&self) -> SW6_A {
256 match self.bits {
257 false => SW6_A::OFF,
258 true => SW6_A::ON,
259 }
260 }
261 #[doc = "Checks if the value of the field is `OFF`"]
262 #[inline(always)]
263 pub fn is_off(&self) -> bool {
264 *self == SW6_A::OFF
265 }
266 #[doc = "Checks if the value of the field is `ON`"]
267 #[inline(always)]
268 pub fn is_on(&self) -> bool {
269 *self == SW6_A::ON
270 }
271}
272#[doc = "Field `SW7` reader - "]
273pub type SW7_R = crate::BitReader<SW7_A>;
274#[doc = "\n\nValue on reset: 0"]
275#[derive(Clone, Copy, Debug, PartialEq, Eq)]
276pub enum SW7_A {
277 #[doc = "0: Switch is Off"]
278 OFF = 0,
279 #[doc = "1: Switch is On"]
280 ON = 1,
281}
282impl From<SW7_A> for bool {
283 #[inline(always)]
284 fn from(variant: SW7_A) -> Self {
285 variant as u8 != 0
286 }
287}
288impl SW7_R {
289 #[doc = "Get enumerated values variant"]
290 #[inline(always)]
291 pub fn variant(&self) -> SW7_A {
292 match self.bits {
293 false => SW7_A::OFF,
294 true => SW7_A::ON,
295 }
296 }
297 #[doc = "Checks if the value of the field is `OFF`"]
298 #[inline(always)]
299 pub fn is_off(&self) -> bool {
300 *self == SW7_A::OFF
301 }
302 #[doc = "Checks if the value of the field is `ON`"]
303 #[inline(always)]
304 pub fn is_on(&self) -> bool {
305 *self == SW7_A::ON
306 }
307}
308impl R {
309 #[doc = "Bit 0"]
310 #[inline(always)]
311 pub fn sw0(&self) -> SW0_R {
312 SW0_R::new((self.bits & 1) != 0)
313 }
314 #[doc = "Bit 1"]
315 #[inline(always)]
316 pub fn sw1(&self) -> SW1_R {
317 SW1_R::new(((self.bits >> 1) & 1) != 0)
318 }
319 #[doc = "Bit 2"]
320 #[inline(always)]
321 pub fn sw2(&self) -> SW2_R {
322 SW2_R::new(((self.bits >> 2) & 1) != 0)
323 }
324 #[doc = "Bit 3"]
325 #[inline(always)]
326 pub fn sw3(&self) -> SW3_R {
327 SW3_R::new(((self.bits >> 3) & 1) != 0)
328 }
329 #[doc = "Bit 4"]
330 #[inline(always)]
331 pub fn sw4(&self) -> SW4_R {
332 SW4_R::new(((self.bits >> 4) & 1) != 0)
333 }
334 #[doc = "Bit 5"]
335 #[inline(always)]
336 pub fn sw5(&self) -> SW5_R {
337 SW5_R::new(((self.bits >> 5) & 1) != 0)
338 }
339 #[doc = "Bit 6"]
340 #[inline(always)]
341 pub fn sw6(&self) -> SW6_R {
342 SW6_R::new(((self.bits >> 6) & 1) != 0)
343 }
344 #[doc = "Bit 7"]
345 #[inline(always)]
346 pub fn sw7(&self) -> SW7_R {
347 SW7_R::new(((self.bits >> 7) & 1) != 0)
348 }
349}
350#[doc = "User Switches\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [switches](index.html) module"]
351pub struct SWITCHES_SPEC;
352impl crate::RegisterSpec for SWITCHES_SPEC {
353 type Ux = u32;
354}
355#[doc = "`read()` method returns [switches::R](R) reader structure"]
356impl crate::Readable for SWITCHES_SPEC {
357 type Reader = R;
358}
359#[doc = "`reset()` method sets SWITCHES to value 0"]
360impl crate::Resettable for SWITCHES_SPEC {
361 #[inline(always)]
362 fn reset_value() -> Self::Ux {
363 0
364 }
365}