mcxa_pac/flexio0/
pinstat.rs

1#[doc = "Register `PINSTAT` reader"]
2pub type R = crate::R<PinstatSpec>;
3#[doc = "Register `PINSTAT` writer"]
4pub type W = crate::W<PinstatSpec>;
5#[doc = "Pin Status Flag\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u32)]
9pub enum Psf {
10    #[doc = "0: Clear"]
11    Clr = 0,
12    #[doc = "1: Set"]
13    Set = 1,
14}
15impl From<Psf> for u32 {
16    #[inline(always)]
17    fn from(variant: Psf) -> Self {
18        variant as _
19    }
20}
21impl crate::FieldSpec for Psf {
22    type Ux = u32;
23}
24impl crate::IsEnum for Psf {}
25#[doc = "Field `PSF` reader - Pin Status Flag"]
26pub type PsfR = crate::FieldReader<Psf>;
27impl PsfR {
28    #[doc = "Get enumerated values variant"]
29    #[inline(always)]
30    pub const fn variant(&self) -> Option<Psf> {
31        match self.bits {
32            0 => Some(Psf::Clr),
33            1 => Some(Psf::Set),
34            _ => None,
35        }
36    }
37    #[doc = "Clear"]
38    #[inline(always)]
39    pub fn is_clr(&self) -> bool {
40        *self == Psf::Clr
41    }
42    #[doc = "Set"]
43    #[inline(always)]
44    pub fn is_set(&self) -> bool {
45        *self == Psf::Set
46    }
47}
48#[doc = "Field `PSF` writer - Pin Status Flag"]
49pub type PsfW<'a, REG> = crate::FieldWriter<'a, REG, 32, Psf>;
50impl<'a, REG> PsfW<'a, REG>
51where
52    REG: crate::Writable + crate::RegisterSpec,
53    REG::Ux: From<u32>,
54{
55    #[doc = "Clear"]
56    #[inline(always)]
57    pub fn clr(self) -> &'a mut crate::W<REG> {
58        self.variant(Psf::Clr)
59    }
60    #[doc = "Set"]
61    #[inline(always)]
62    pub fn set_(self) -> &'a mut crate::W<REG> {
63        self.variant(Psf::Set)
64    }
65}
66impl R {
67    #[doc = "Bits 0:31 - Pin Status Flag"]
68    #[inline(always)]
69    pub fn psf(&self) -> PsfR {
70        PsfR::new(self.bits)
71    }
72}
73#[cfg(feature = "debug")]
74impl core::fmt::Debug for R {
75    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
76        f.debug_struct("PINSTAT").field("psf", &self.psf()).finish()
77    }
78}
79impl W {
80    #[doc = "Bits 0:31 - Pin Status Flag"]
81    #[inline(always)]
82    pub fn psf(&mut self) -> PsfW<'_, PinstatSpec> {
83        PsfW::new(self, 0)
84    }
85}
86#[doc = "Pin Status\n\nYou can [`read`](crate::Reg::read) this register and get [`pinstat::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pinstat::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
87pub struct PinstatSpec;
88impl crate::RegisterSpec for PinstatSpec {
89    type Ux = u32;
90}
91#[doc = "`read()` method returns [`pinstat::R`](R) reader structure"]
92impl crate::Readable for PinstatSpec {}
93#[doc = "`write(|w| ..)` method takes [`pinstat::W`](W) writer structure"]
94impl crate::Writable for PinstatSpec {
95    type Safety = crate::Unsafe;
96    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0xffff_ffff;
97}
98#[doc = "`reset()` method sets PINSTAT to value 0"]
99impl crate::Resettable for PinstatSpec {}