mcxa_pac/gpio0/
pcor.rs

1#[doc = "Register `PCOR` reader"]
2pub type R = crate::R<PcorSpec>;
3#[doc = "Register `PCOR` writer"]
4pub type W = crate::W<PcorSpec>;
5#[doc = "Port Clear Output\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Ptco {
9    #[doc = "0: No change"]
10    Ptco0 = 0,
11    #[doc = "1: Corresponding field in PDOR becomes 0"]
12    Ptco1 = 1,
13}
14impl From<Ptco> for bool {
15    #[inline(always)]
16    fn from(variant: Ptco) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `PTCO(0-31)` reader - Port Clear Output"]
21pub type PtcoR = crate::BitReader<Ptco>;
22impl PtcoR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Ptco {
26        match self.bits {
27            false => Ptco::Ptco0,
28            true => Ptco::Ptco1,
29        }
30    }
31    #[doc = "No change"]
32    #[inline(always)]
33    pub fn is_ptco0(&self) -> bool {
34        *self == Ptco::Ptco0
35    }
36    #[doc = "Corresponding field in PDOR becomes 0"]
37    #[inline(always)]
38    pub fn is_ptco1(&self) -> bool {
39        *self == Ptco::Ptco1
40    }
41}
42#[doc = "Field `PTCO(0-31)` writer - Port Clear Output"]
43pub type PtcoW<'a, REG> = crate::BitWriter<'a, REG, Ptco>;
44impl<'a, REG> PtcoW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "No change"]
49    #[inline(always)]
50    pub fn ptco0(self) -> &'a mut crate::W<REG> {
51        self.variant(Ptco::Ptco0)
52    }
53    #[doc = "Corresponding field in PDOR becomes 0"]
54    #[inline(always)]
55    pub fn ptco1(self) -> &'a mut crate::W<REG> {
56        self.variant(Ptco::Ptco1)
57    }
58}
59impl R {
60    #[doc = "Port Clear Output"]
61    #[doc = ""]
62    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `PTCO0` field.</div>"]
63    #[inline(always)]
64    pub fn ptco(&self, n: u8) -> PtcoR {
65        #[allow(clippy::no_effect)]
66        [(); 32][n as usize];
67        PtcoR::new(((self.bits >> n) & 1) != 0)
68    }
69    #[doc = "Iterator for array of:"]
70    #[doc = "Port Clear Output"]
71    #[inline(always)]
72    pub fn ptco_iter(&self) -> impl Iterator<Item = PtcoR> + '_ {
73        (0..32).map(move |n| PtcoR::new(((self.bits >> n) & 1) != 0))
74    }
75    #[doc = "Bit 0 - Port Clear Output"]
76    #[inline(always)]
77    pub fn ptco0(&self) -> PtcoR {
78        PtcoR::new((self.bits & 1) != 0)
79    }
80    #[doc = "Bit 1 - Port Clear Output"]
81    #[inline(always)]
82    pub fn ptco1(&self) -> PtcoR {
83        PtcoR::new(((self.bits >> 1) & 1) != 0)
84    }
85    #[doc = "Bit 2 - Port Clear Output"]
86    #[inline(always)]
87    pub fn ptco2(&self) -> PtcoR {
88        PtcoR::new(((self.bits >> 2) & 1) != 0)
89    }
90    #[doc = "Bit 3 - Port Clear Output"]
91    #[inline(always)]
92    pub fn ptco3(&self) -> PtcoR {
93        PtcoR::new(((self.bits >> 3) & 1) != 0)
94    }
95    #[doc = "Bit 4 - Port Clear Output"]
96    #[inline(always)]
97    pub fn ptco4(&self) -> PtcoR {
98        PtcoR::new(((self.bits >> 4) & 1) != 0)
99    }
100    #[doc = "Bit 5 - Port Clear Output"]
101    #[inline(always)]
102    pub fn ptco5(&self) -> PtcoR {
103        PtcoR::new(((self.bits >> 5) & 1) != 0)
104    }
105    #[doc = "Bit 6 - Port Clear Output"]
106    #[inline(always)]
107    pub fn ptco6(&self) -> PtcoR {
108        PtcoR::new(((self.bits >> 6) & 1) != 0)
109    }
110    #[doc = "Bit 7 - Port Clear Output"]
111    #[inline(always)]
112    pub fn ptco7(&self) -> PtcoR {
113        PtcoR::new(((self.bits >> 7) & 1) != 0)
114    }
115    #[doc = "Bit 8 - Port Clear Output"]
116    #[inline(always)]
117    pub fn ptco8(&self) -> PtcoR {
118        PtcoR::new(((self.bits >> 8) & 1) != 0)
119    }
120    #[doc = "Bit 9 - Port Clear Output"]
121    #[inline(always)]
122    pub fn ptco9(&self) -> PtcoR {
123        PtcoR::new(((self.bits >> 9) & 1) != 0)
124    }
125    #[doc = "Bit 10 - Port Clear Output"]
126    #[inline(always)]
127    pub fn ptco10(&self) -> PtcoR {
128        PtcoR::new(((self.bits >> 10) & 1) != 0)
129    }
130    #[doc = "Bit 11 - Port Clear Output"]
131    #[inline(always)]
132    pub fn ptco11(&self) -> PtcoR {
133        PtcoR::new(((self.bits >> 11) & 1) != 0)
134    }
135    #[doc = "Bit 12 - Port Clear Output"]
136    #[inline(always)]
137    pub fn ptco12(&self) -> PtcoR {
138        PtcoR::new(((self.bits >> 12) & 1) != 0)
139    }
140    #[doc = "Bit 13 - Port Clear Output"]
141    #[inline(always)]
142    pub fn ptco13(&self) -> PtcoR {
143        PtcoR::new(((self.bits >> 13) & 1) != 0)
144    }
145    #[doc = "Bit 14 - Port Clear Output"]
146    #[inline(always)]
147    pub fn ptco14(&self) -> PtcoR {
148        PtcoR::new(((self.bits >> 14) & 1) != 0)
149    }
150    #[doc = "Bit 15 - Port Clear Output"]
151    #[inline(always)]
152    pub fn ptco15(&self) -> PtcoR {
153        PtcoR::new(((self.bits >> 15) & 1) != 0)
154    }
155    #[doc = "Bit 16 - Port Clear Output"]
156    #[inline(always)]
157    pub fn ptco16(&self) -> PtcoR {
158        PtcoR::new(((self.bits >> 16) & 1) != 0)
159    }
160    #[doc = "Bit 17 - Port Clear Output"]
161    #[inline(always)]
162    pub fn ptco17(&self) -> PtcoR {
163        PtcoR::new(((self.bits >> 17) & 1) != 0)
164    }
165    #[doc = "Bit 18 - Port Clear Output"]
166    #[inline(always)]
167    pub fn ptco18(&self) -> PtcoR {
168        PtcoR::new(((self.bits >> 18) & 1) != 0)
169    }
170    #[doc = "Bit 19 - Port Clear Output"]
171    #[inline(always)]
172    pub fn ptco19(&self) -> PtcoR {
173        PtcoR::new(((self.bits >> 19) & 1) != 0)
174    }
175    #[doc = "Bit 20 - Port Clear Output"]
176    #[inline(always)]
177    pub fn ptco20(&self) -> PtcoR {
178        PtcoR::new(((self.bits >> 20) & 1) != 0)
179    }
180    #[doc = "Bit 21 - Port Clear Output"]
181    #[inline(always)]
182    pub fn ptco21(&self) -> PtcoR {
183        PtcoR::new(((self.bits >> 21) & 1) != 0)
184    }
185    #[doc = "Bit 22 - Port Clear Output"]
186    #[inline(always)]
187    pub fn ptco22(&self) -> PtcoR {
188        PtcoR::new(((self.bits >> 22) & 1) != 0)
189    }
190    #[doc = "Bit 23 - Port Clear Output"]
191    #[inline(always)]
192    pub fn ptco23(&self) -> PtcoR {
193        PtcoR::new(((self.bits >> 23) & 1) != 0)
194    }
195    #[doc = "Bit 24 - Port Clear Output"]
196    #[inline(always)]
197    pub fn ptco24(&self) -> PtcoR {
198        PtcoR::new(((self.bits >> 24) & 1) != 0)
199    }
200    #[doc = "Bit 25 - Port Clear Output"]
201    #[inline(always)]
202    pub fn ptco25(&self) -> PtcoR {
203        PtcoR::new(((self.bits >> 25) & 1) != 0)
204    }
205    #[doc = "Bit 26 - Port Clear Output"]
206    #[inline(always)]
207    pub fn ptco26(&self) -> PtcoR {
208        PtcoR::new(((self.bits >> 26) & 1) != 0)
209    }
210    #[doc = "Bit 27 - Port Clear Output"]
211    #[inline(always)]
212    pub fn ptco27(&self) -> PtcoR {
213        PtcoR::new(((self.bits >> 27) & 1) != 0)
214    }
215    #[doc = "Bit 28 - Port Clear Output"]
216    #[inline(always)]
217    pub fn ptco28(&self) -> PtcoR {
218        PtcoR::new(((self.bits >> 28) & 1) != 0)
219    }
220    #[doc = "Bit 29 - Port Clear Output"]
221    #[inline(always)]
222    pub fn ptco29(&self) -> PtcoR {
223        PtcoR::new(((self.bits >> 29) & 1) != 0)
224    }
225    #[doc = "Bit 30 - Port Clear Output"]
226    #[inline(always)]
227    pub fn ptco30(&self) -> PtcoR {
228        PtcoR::new(((self.bits >> 30) & 1) != 0)
229    }
230    #[doc = "Bit 31 - Port Clear Output"]
231    #[inline(always)]
232    pub fn ptco31(&self) -> PtcoR {
233        PtcoR::new(((self.bits >> 31) & 1) != 0)
234    }
235}
236#[cfg(feature = "debug")]
237impl core::fmt::Debug for R {
238    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
239        f.debug_struct("PCOR")
240            .field("ptco0", &self.ptco0())
241            .field("ptco1", &self.ptco1())
242            .field("ptco2", &self.ptco2())
243            .field("ptco3", &self.ptco3())
244            .field("ptco4", &self.ptco4())
245            .field("ptco5", &self.ptco5())
246            .field("ptco6", &self.ptco6())
247            .field("ptco7", &self.ptco7())
248            .field("ptco8", &self.ptco8())
249            .field("ptco9", &self.ptco9())
250            .field("ptco10", &self.ptco10())
251            .field("ptco11", &self.ptco11())
252            .field("ptco12", &self.ptco12())
253            .field("ptco13", &self.ptco13())
254            .field("ptco14", &self.ptco14())
255            .field("ptco15", &self.ptco15())
256            .field("ptco16", &self.ptco16())
257            .field("ptco17", &self.ptco17())
258            .field("ptco18", &self.ptco18())
259            .field("ptco19", &self.ptco19())
260            .field("ptco20", &self.ptco20())
261            .field("ptco21", &self.ptco21())
262            .field("ptco22", &self.ptco22())
263            .field("ptco23", &self.ptco23())
264            .field("ptco24", &self.ptco24())
265            .field("ptco25", &self.ptco25())
266            .field("ptco26", &self.ptco26())
267            .field("ptco27", &self.ptco27())
268            .field("ptco28", &self.ptco28())
269            .field("ptco29", &self.ptco29())
270            .field("ptco30", &self.ptco30())
271            .field("ptco31", &self.ptco31())
272            .finish()
273    }
274}
275impl W {
276    #[doc = "Port Clear Output"]
277    #[doc = ""]
278    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `PTCO0` field.</div>"]
279    #[inline(always)]
280    pub fn ptco(&mut self, n: u8) -> PtcoW<'_, PcorSpec> {
281        #[allow(clippy::no_effect)]
282        [(); 32][n as usize];
283        PtcoW::new(self, n)
284    }
285    #[doc = "Bit 0 - Port Clear Output"]
286    #[inline(always)]
287    pub fn ptco0(&mut self) -> PtcoW<'_, PcorSpec> {
288        PtcoW::new(self, 0)
289    }
290    #[doc = "Bit 1 - Port Clear Output"]
291    #[inline(always)]
292    pub fn ptco1(&mut self) -> PtcoW<'_, PcorSpec> {
293        PtcoW::new(self, 1)
294    }
295    #[doc = "Bit 2 - Port Clear Output"]
296    #[inline(always)]
297    pub fn ptco2(&mut self) -> PtcoW<'_, PcorSpec> {
298        PtcoW::new(self, 2)
299    }
300    #[doc = "Bit 3 - Port Clear Output"]
301    #[inline(always)]
302    pub fn ptco3(&mut self) -> PtcoW<'_, PcorSpec> {
303        PtcoW::new(self, 3)
304    }
305    #[doc = "Bit 4 - Port Clear Output"]
306    #[inline(always)]
307    pub fn ptco4(&mut self) -> PtcoW<'_, PcorSpec> {
308        PtcoW::new(self, 4)
309    }
310    #[doc = "Bit 5 - Port Clear Output"]
311    #[inline(always)]
312    pub fn ptco5(&mut self) -> PtcoW<'_, PcorSpec> {
313        PtcoW::new(self, 5)
314    }
315    #[doc = "Bit 6 - Port Clear Output"]
316    #[inline(always)]
317    pub fn ptco6(&mut self) -> PtcoW<'_, PcorSpec> {
318        PtcoW::new(self, 6)
319    }
320    #[doc = "Bit 7 - Port Clear Output"]
321    #[inline(always)]
322    pub fn ptco7(&mut self) -> PtcoW<'_, PcorSpec> {
323        PtcoW::new(self, 7)
324    }
325    #[doc = "Bit 8 - Port Clear Output"]
326    #[inline(always)]
327    pub fn ptco8(&mut self) -> PtcoW<'_, PcorSpec> {
328        PtcoW::new(self, 8)
329    }
330    #[doc = "Bit 9 - Port Clear Output"]
331    #[inline(always)]
332    pub fn ptco9(&mut self) -> PtcoW<'_, PcorSpec> {
333        PtcoW::new(self, 9)
334    }
335    #[doc = "Bit 10 - Port Clear Output"]
336    #[inline(always)]
337    pub fn ptco10(&mut self) -> PtcoW<'_, PcorSpec> {
338        PtcoW::new(self, 10)
339    }
340    #[doc = "Bit 11 - Port Clear Output"]
341    #[inline(always)]
342    pub fn ptco11(&mut self) -> PtcoW<'_, PcorSpec> {
343        PtcoW::new(self, 11)
344    }
345    #[doc = "Bit 12 - Port Clear Output"]
346    #[inline(always)]
347    pub fn ptco12(&mut self) -> PtcoW<'_, PcorSpec> {
348        PtcoW::new(self, 12)
349    }
350    #[doc = "Bit 13 - Port Clear Output"]
351    #[inline(always)]
352    pub fn ptco13(&mut self) -> PtcoW<'_, PcorSpec> {
353        PtcoW::new(self, 13)
354    }
355    #[doc = "Bit 14 - Port Clear Output"]
356    #[inline(always)]
357    pub fn ptco14(&mut self) -> PtcoW<'_, PcorSpec> {
358        PtcoW::new(self, 14)
359    }
360    #[doc = "Bit 15 - Port Clear Output"]
361    #[inline(always)]
362    pub fn ptco15(&mut self) -> PtcoW<'_, PcorSpec> {
363        PtcoW::new(self, 15)
364    }
365    #[doc = "Bit 16 - Port Clear Output"]
366    #[inline(always)]
367    pub fn ptco16(&mut self) -> PtcoW<'_, PcorSpec> {
368        PtcoW::new(self, 16)
369    }
370    #[doc = "Bit 17 - Port Clear Output"]
371    #[inline(always)]
372    pub fn ptco17(&mut self) -> PtcoW<'_, PcorSpec> {
373        PtcoW::new(self, 17)
374    }
375    #[doc = "Bit 18 - Port Clear Output"]
376    #[inline(always)]
377    pub fn ptco18(&mut self) -> PtcoW<'_, PcorSpec> {
378        PtcoW::new(self, 18)
379    }
380    #[doc = "Bit 19 - Port Clear Output"]
381    #[inline(always)]
382    pub fn ptco19(&mut self) -> PtcoW<'_, PcorSpec> {
383        PtcoW::new(self, 19)
384    }
385    #[doc = "Bit 20 - Port Clear Output"]
386    #[inline(always)]
387    pub fn ptco20(&mut self) -> PtcoW<'_, PcorSpec> {
388        PtcoW::new(self, 20)
389    }
390    #[doc = "Bit 21 - Port Clear Output"]
391    #[inline(always)]
392    pub fn ptco21(&mut self) -> PtcoW<'_, PcorSpec> {
393        PtcoW::new(self, 21)
394    }
395    #[doc = "Bit 22 - Port Clear Output"]
396    #[inline(always)]
397    pub fn ptco22(&mut self) -> PtcoW<'_, PcorSpec> {
398        PtcoW::new(self, 22)
399    }
400    #[doc = "Bit 23 - Port Clear Output"]
401    #[inline(always)]
402    pub fn ptco23(&mut self) -> PtcoW<'_, PcorSpec> {
403        PtcoW::new(self, 23)
404    }
405    #[doc = "Bit 24 - Port Clear Output"]
406    #[inline(always)]
407    pub fn ptco24(&mut self) -> PtcoW<'_, PcorSpec> {
408        PtcoW::new(self, 24)
409    }
410    #[doc = "Bit 25 - Port Clear Output"]
411    #[inline(always)]
412    pub fn ptco25(&mut self) -> PtcoW<'_, PcorSpec> {
413        PtcoW::new(self, 25)
414    }
415    #[doc = "Bit 26 - Port Clear Output"]
416    #[inline(always)]
417    pub fn ptco26(&mut self) -> PtcoW<'_, PcorSpec> {
418        PtcoW::new(self, 26)
419    }
420    #[doc = "Bit 27 - Port Clear Output"]
421    #[inline(always)]
422    pub fn ptco27(&mut self) -> PtcoW<'_, PcorSpec> {
423        PtcoW::new(self, 27)
424    }
425    #[doc = "Bit 28 - Port Clear Output"]
426    #[inline(always)]
427    pub fn ptco28(&mut self) -> PtcoW<'_, PcorSpec> {
428        PtcoW::new(self, 28)
429    }
430    #[doc = "Bit 29 - Port Clear Output"]
431    #[inline(always)]
432    pub fn ptco29(&mut self) -> PtcoW<'_, PcorSpec> {
433        PtcoW::new(self, 29)
434    }
435    #[doc = "Bit 30 - Port Clear Output"]
436    #[inline(always)]
437    pub fn ptco30(&mut self) -> PtcoW<'_, PcorSpec> {
438        PtcoW::new(self, 30)
439    }
440    #[doc = "Bit 31 - Port Clear Output"]
441    #[inline(always)]
442    pub fn ptco31(&mut self) -> PtcoW<'_, PcorSpec> {
443        PtcoW::new(self, 31)
444    }
445}
446#[doc = "Port Clear Output\n\nYou can [`read`](crate::Reg::read) this register and get [`pcor::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pcor::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
447pub struct PcorSpec;
448impl crate::RegisterSpec for PcorSpec {
449    type Ux = u32;
450}
451#[doc = "`read()` method returns [`pcor::R`](R) reader structure"]
452impl crate::Readable for PcorSpec {}
453#[doc = "`write(|w| ..)` method takes [`pcor::W`](W) writer structure"]
454impl crate::Writable for PcorSpec {
455    type Safety = crate::Unsafe;
456}
457#[doc = "`reset()` method sets PCOR to value 0"]
458impl crate::Resettable for PcorSpec {}