mcxa_pac/flexio0/
trgstat.rs

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