mcxa_pac/gpio0/
psor.rs

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