mimxrt595s/flexcomm0/
pselid.rs1#[doc = "Register `PSELID` reader"]
2pub struct R(crate::R<PSELID_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PSELID_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PSELID_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PSELID_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PSELID` writer"]
17pub struct W(crate::W<PSELID_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PSELID_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<PSELID_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PSELID_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `PERSEL` reader - Peripheral Select"]
38pub type PERSEL_R = crate::FieldReader<u8, PERSEL_A>;
39#[doc = "Peripheral Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum PERSEL_A {
43 #[doc = "0: No peripheral selected."]
44 NO_PERIPH_SELECTED = 0,
45 #[doc = "1: USART function selected"]
46 USART = 1,
47 #[doc = "2: SPI function selected"]
48 SPI = 2,
49 #[doc = "3: I2C"]
50 I2C = 3,
51 #[doc = "4: I2S Transmit"]
52 I2S_TRANSMIT = 4,
53 #[doc = "5: I2S Receive"]
54 I2S_RECEIVE = 5,
55}
56impl From<PERSEL_A> for u8 {
57 #[inline(always)]
58 fn from(variant: PERSEL_A) -> Self {
59 variant as _
60 }
61}
62impl PERSEL_R {
63 #[doc = "Get enumerated values variant"]
64 #[inline(always)]
65 pub fn variant(&self) -> Option<PERSEL_A> {
66 match self.bits {
67 0 => Some(PERSEL_A::NO_PERIPH_SELECTED),
68 1 => Some(PERSEL_A::USART),
69 2 => Some(PERSEL_A::SPI),
70 3 => Some(PERSEL_A::I2C),
71 4 => Some(PERSEL_A::I2S_TRANSMIT),
72 5 => Some(PERSEL_A::I2S_RECEIVE),
73 _ => None,
74 }
75 }
76 #[doc = "Checks if the value of the field is `NO_PERIPH_SELECTED`"]
77 #[inline(always)]
78 pub fn is_no_periph_selected(&self) -> bool {
79 *self == PERSEL_A::NO_PERIPH_SELECTED
80 }
81 #[doc = "Checks if the value of the field is `USART`"]
82 #[inline(always)]
83 pub fn is_usart(&self) -> bool {
84 *self == PERSEL_A::USART
85 }
86 #[doc = "Checks if the value of the field is `SPI`"]
87 #[inline(always)]
88 pub fn is_spi(&self) -> bool {
89 *self == PERSEL_A::SPI
90 }
91 #[doc = "Checks if the value of the field is `I2C`"]
92 #[inline(always)]
93 pub fn is_i2c(&self) -> bool {
94 *self == PERSEL_A::I2C
95 }
96 #[doc = "Checks if the value of the field is `I2S_TRANSMIT`"]
97 #[inline(always)]
98 pub fn is_i2s_transmit(&self) -> bool {
99 *self == PERSEL_A::I2S_TRANSMIT
100 }
101 #[doc = "Checks if the value of the field is `I2S_RECEIVE`"]
102 #[inline(always)]
103 pub fn is_i2s_receive(&self) -> bool {
104 *self == PERSEL_A::I2S_RECEIVE
105 }
106}
107#[doc = "Field `PERSEL` writer - Peripheral Select"]
108pub type PERSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PSELID_SPEC, u8, PERSEL_A, 3, O>;
109impl<'a, const O: u8> PERSEL_W<'a, O> {
110 #[doc = "No peripheral selected."]
111 #[inline(always)]
112 pub fn no_periph_selected(self) -> &'a mut W {
113 self.variant(PERSEL_A::NO_PERIPH_SELECTED)
114 }
115 #[doc = "USART function selected"]
116 #[inline(always)]
117 pub fn usart(self) -> &'a mut W {
118 self.variant(PERSEL_A::USART)
119 }
120 #[doc = "SPI function selected"]
121 #[inline(always)]
122 pub fn spi(self) -> &'a mut W {
123 self.variant(PERSEL_A::SPI)
124 }
125 #[doc = "I2C"]
126 #[inline(always)]
127 pub fn i2c(self) -> &'a mut W {
128 self.variant(PERSEL_A::I2C)
129 }
130 #[doc = "I2S Transmit"]
131 #[inline(always)]
132 pub fn i2s_transmit(self) -> &'a mut W {
133 self.variant(PERSEL_A::I2S_TRANSMIT)
134 }
135 #[doc = "I2S Receive"]
136 #[inline(always)]
137 pub fn i2s_receive(self) -> &'a mut W {
138 self.variant(PERSEL_A::I2S_RECEIVE)
139 }
140}
141#[doc = "Field `LOCK` reader - Lock the peripheral select"]
142pub type LOCK_R = crate::BitReader<LOCK_A>;
143#[doc = "Lock the peripheral select\n\nValue on reset: 0"]
144#[derive(Clone, Copy, Debug, PartialEq, Eq)]
145pub enum LOCK_A {
146 #[doc = "0: Peripheral select can be changed by software."]
147 UNLOCKED = 0,
148 #[doc = "1: Peripheral select is locked and cannot be changed until this Flexcomm module or the entire device is reset."]
149 LOCKED = 1,
150}
151impl From<LOCK_A> for bool {
152 #[inline(always)]
153 fn from(variant: LOCK_A) -> Self {
154 variant as u8 != 0
155 }
156}
157impl LOCK_R {
158 #[doc = "Get enumerated values variant"]
159 #[inline(always)]
160 pub fn variant(&self) -> LOCK_A {
161 match self.bits {
162 false => LOCK_A::UNLOCKED,
163 true => LOCK_A::LOCKED,
164 }
165 }
166 #[doc = "Checks if the value of the field is `UNLOCKED`"]
167 #[inline(always)]
168 pub fn is_unlocked(&self) -> bool {
169 *self == LOCK_A::UNLOCKED
170 }
171 #[doc = "Checks if the value of the field is `LOCKED`"]
172 #[inline(always)]
173 pub fn is_locked(&self) -> bool {
174 *self == LOCK_A::LOCKED
175 }
176}
177#[doc = "Field `LOCK` writer - Lock the peripheral select"]
178pub type LOCK_W<'a, const O: u8> = crate::BitWriter<'a, u32, PSELID_SPEC, LOCK_A, O>;
179impl<'a, const O: u8> LOCK_W<'a, O> {
180 #[doc = "Peripheral select can be changed by software."]
181 #[inline(always)]
182 pub fn unlocked(self) -> &'a mut W {
183 self.variant(LOCK_A::UNLOCKED)
184 }
185 #[doc = "Peripheral select is locked and cannot be changed until this Flexcomm module or the entire device is reset."]
186 #[inline(always)]
187 pub fn locked(self) -> &'a mut W {
188 self.variant(LOCK_A::LOCKED)
189 }
190}
191#[doc = "Field `USARTPRESENT` reader - USART present indicator"]
192pub type USARTPRESENT_R = crate::BitReader<USARTPRESENT_A>;
193#[doc = "USART present indicator\n\nValue on reset: 0"]
194#[derive(Clone, Copy, Debug, PartialEq, Eq)]
195pub enum USARTPRESENT_A {
196 #[doc = "0: This Flexcomm module does not include the USART function."]
197 NOT_PRESENT = 0,
198 #[doc = "1: This Flexcomm module includes the USART function."]
199 PRESENT = 1,
200}
201impl From<USARTPRESENT_A> for bool {
202 #[inline(always)]
203 fn from(variant: USARTPRESENT_A) -> Self {
204 variant as u8 != 0
205 }
206}
207impl USARTPRESENT_R {
208 #[doc = "Get enumerated values variant"]
209 #[inline(always)]
210 pub fn variant(&self) -> USARTPRESENT_A {
211 match self.bits {
212 false => USARTPRESENT_A::NOT_PRESENT,
213 true => USARTPRESENT_A::PRESENT,
214 }
215 }
216 #[doc = "Checks if the value of the field is `NOT_PRESENT`"]
217 #[inline(always)]
218 pub fn is_not_present(&self) -> bool {
219 *self == USARTPRESENT_A::NOT_PRESENT
220 }
221 #[doc = "Checks if the value of the field is `PRESENT`"]
222 #[inline(always)]
223 pub fn is_present(&self) -> bool {
224 *self == USARTPRESENT_A::PRESENT
225 }
226}
227#[doc = "Field `SPIPRESENT` reader - SPI present indicator"]
228pub type SPIPRESENT_R = crate::BitReader<SPIPRESENT_A>;
229#[doc = "SPI present indicator\n\nValue on reset: 0"]
230#[derive(Clone, Copy, Debug, PartialEq, Eq)]
231pub enum SPIPRESENT_A {
232 #[doc = "0: This Flexcomm module does not include the SPI function."]
233 NOT_PRESENT = 0,
234 #[doc = "1: This Flexcomm module includes the SPI function."]
235 PRESENT = 1,
236}
237impl From<SPIPRESENT_A> for bool {
238 #[inline(always)]
239 fn from(variant: SPIPRESENT_A) -> Self {
240 variant as u8 != 0
241 }
242}
243impl SPIPRESENT_R {
244 #[doc = "Get enumerated values variant"]
245 #[inline(always)]
246 pub fn variant(&self) -> SPIPRESENT_A {
247 match self.bits {
248 false => SPIPRESENT_A::NOT_PRESENT,
249 true => SPIPRESENT_A::PRESENT,
250 }
251 }
252 #[doc = "Checks if the value of the field is `NOT_PRESENT`"]
253 #[inline(always)]
254 pub fn is_not_present(&self) -> bool {
255 *self == SPIPRESENT_A::NOT_PRESENT
256 }
257 #[doc = "Checks if the value of the field is `PRESENT`"]
258 #[inline(always)]
259 pub fn is_present(&self) -> bool {
260 *self == SPIPRESENT_A::PRESENT
261 }
262}
263#[doc = "Field `I2CPRESENT` reader - I2C present indicator"]
264pub type I2CPRESENT_R = crate::BitReader<I2CPRESENT_A>;
265#[doc = "I2C present indicator\n\nValue on reset: 0"]
266#[derive(Clone, Copy, Debug, PartialEq, Eq)]
267pub enum I2CPRESENT_A {
268 #[doc = "0: I2C Not Present"]
269 NOT_PRESENT = 0,
270 #[doc = "1: I2C Present"]
271 PRESENT = 1,
272}
273impl From<I2CPRESENT_A> for bool {
274 #[inline(always)]
275 fn from(variant: I2CPRESENT_A) -> Self {
276 variant as u8 != 0
277 }
278}
279impl I2CPRESENT_R {
280 #[doc = "Get enumerated values variant"]
281 #[inline(always)]
282 pub fn variant(&self) -> I2CPRESENT_A {
283 match self.bits {
284 false => I2CPRESENT_A::NOT_PRESENT,
285 true => I2CPRESENT_A::PRESENT,
286 }
287 }
288 #[doc = "Checks if the value of the field is `NOT_PRESENT`"]
289 #[inline(always)]
290 pub fn is_not_present(&self) -> bool {
291 *self == I2CPRESENT_A::NOT_PRESENT
292 }
293 #[doc = "Checks if the value of the field is `PRESENT`"]
294 #[inline(always)]
295 pub fn is_present(&self) -> bool {
296 *self == I2CPRESENT_A::PRESENT
297 }
298}
299#[doc = "Field `I2SPRESENT` reader - I2S Present"]
300pub type I2SPRESENT_R = crate::BitReader<I2SPRESENT_A>;
301#[doc = "I2S Present\n\nValue on reset: 0"]
302#[derive(Clone, Copy, Debug, PartialEq, Eq)]
303pub enum I2SPRESENT_A {
304 #[doc = "0: I2S Not Present"]
305 NOT_PRESENT = 0,
306 #[doc = "1: I2S Present"]
307 PRESENT = 1,
308}
309impl From<I2SPRESENT_A> for bool {
310 #[inline(always)]
311 fn from(variant: I2SPRESENT_A) -> Self {
312 variant as u8 != 0
313 }
314}
315impl I2SPRESENT_R {
316 #[doc = "Get enumerated values variant"]
317 #[inline(always)]
318 pub fn variant(&self) -> I2SPRESENT_A {
319 match self.bits {
320 false => I2SPRESENT_A::NOT_PRESENT,
321 true => I2SPRESENT_A::PRESENT,
322 }
323 }
324 #[doc = "Checks if the value of the field is `NOT_PRESENT`"]
325 #[inline(always)]
326 pub fn is_not_present(&self) -> bool {
327 *self == I2SPRESENT_A::NOT_PRESENT
328 }
329 #[doc = "Checks if the value of the field is `PRESENT`"]
330 #[inline(always)]
331 pub fn is_present(&self) -> bool {
332 *self == I2SPRESENT_A::PRESENT
333 }
334}
335#[doc = "Field `ID` reader - Flexcomm ID"]
336pub type ID_R = crate::FieldReader<u32, u32>;
337impl R {
338 #[doc = "Bits 0:2 - Peripheral Select"]
339 #[inline(always)]
340 pub fn persel(&self) -> PERSEL_R {
341 PERSEL_R::new((self.bits & 7) as u8)
342 }
343 #[doc = "Bit 3 - Lock the peripheral select"]
344 #[inline(always)]
345 pub fn lock(&self) -> LOCK_R {
346 LOCK_R::new(((self.bits >> 3) & 1) != 0)
347 }
348 #[doc = "Bit 4 - USART present indicator"]
349 #[inline(always)]
350 pub fn usartpresent(&self) -> USARTPRESENT_R {
351 USARTPRESENT_R::new(((self.bits >> 4) & 1) != 0)
352 }
353 #[doc = "Bit 5 - SPI present indicator"]
354 #[inline(always)]
355 pub fn spipresent(&self) -> SPIPRESENT_R {
356 SPIPRESENT_R::new(((self.bits >> 5) & 1) != 0)
357 }
358 #[doc = "Bit 6 - I2C present indicator"]
359 #[inline(always)]
360 pub fn i2cpresent(&self) -> I2CPRESENT_R {
361 I2CPRESENT_R::new(((self.bits >> 6) & 1) != 0)
362 }
363 #[doc = "Bit 7 - I2S Present"]
364 #[inline(always)]
365 pub fn i2spresent(&self) -> I2SPRESENT_R {
366 I2SPRESENT_R::new(((self.bits >> 7) & 1) != 0)
367 }
368 #[doc = "Bits 12:31 - Flexcomm ID"]
369 #[inline(always)]
370 pub fn id(&self) -> ID_R {
371 ID_R::new((self.bits >> 12) & 0x000f_ffff)
372 }
373}
374impl W {
375 #[doc = "Bits 0:2 - Peripheral Select"]
376 #[inline(always)]
377 #[must_use]
378 pub fn persel(&mut self) -> PERSEL_W<0> {
379 PERSEL_W::new(self)
380 }
381 #[doc = "Bit 3 - Lock the peripheral select"]
382 #[inline(always)]
383 #[must_use]
384 pub fn lock(&mut self) -> LOCK_W<3> {
385 LOCK_W::new(self)
386 }
387 #[doc = "Writes raw bits to the register."]
388 #[inline(always)]
389 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
390 self.0.bits(bits);
391 self
392 }
393}
394#[doc = "Peripheral Select and Flexcomm module ID\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 [pselid](index.html) module"]
395pub struct PSELID_SPEC;
396impl crate::RegisterSpec for PSELID_SPEC {
397 type Ux = u32;
398}
399#[doc = "`read()` method returns [pselid::R](R) reader structure"]
400impl crate::Readable for PSELID_SPEC {
401 type Reader = R;
402}
403#[doc = "`write(|w| ..)` method takes [pselid::W](W) writer structure"]
404impl crate::Writable for PSELID_SPEC {
405 type Writer = W;
406 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
407 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
408}
409#[doc = "`reset()` method sets PSELID to value 0x0010_1000"]
410impl crate::Resettable for PSELID_SPEC {
411 const RESET_VALUE: Self::Ux = 0x0010_1000;
412}