mcxa_pac/utick0/
stat.rs

1#[doc = "Register `STAT` reader"]
2pub type R = crate::R<StatSpec>;
3#[doc = "Register `STAT` writer"]
4pub type W = crate::W<StatSpec>;
5#[doc = "Interrupt Flag\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Intr {
9    #[doc = "0: Not pending"]
10    Nopendinginterrupt = 0,
11    #[doc = "1: Pending"]
12    Pendinginterrupt = 1,
13}
14impl From<Intr> for bool {
15    #[inline(always)]
16    fn from(variant: Intr) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `INTR` reader - Interrupt Flag"]
21pub type IntrR = crate::BitReader<Intr>;
22impl IntrR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Intr {
26        match self.bits {
27            false => Intr::Nopendinginterrupt,
28            true => Intr::Pendinginterrupt,
29        }
30    }
31    #[doc = "Not pending"]
32    #[inline(always)]
33    pub fn is_nopendinginterrupt(&self) -> bool {
34        *self == Intr::Nopendinginterrupt
35    }
36    #[doc = "Pending"]
37    #[inline(always)]
38    pub fn is_pendinginterrupt(&self) -> bool {
39        *self == Intr::Pendinginterrupt
40    }
41}
42#[doc = "Field `INTR` writer - Interrupt Flag"]
43pub type IntrW<'a, REG> = crate::BitWriter1C<'a, REG, Intr>;
44impl<'a, REG> IntrW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Not pending"]
49    #[inline(always)]
50    pub fn nopendinginterrupt(self) -> &'a mut crate::W<REG> {
51        self.variant(Intr::Nopendinginterrupt)
52    }
53    #[doc = "Pending"]
54    #[inline(always)]
55    pub fn pendinginterrupt(self) -> &'a mut crate::W<REG> {
56        self.variant(Intr::Pendinginterrupt)
57    }
58}
59#[doc = "Timer Active Flag\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Active {
63    #[doc = "0: Inactive (stopped)"]
64    Timerisnotactive = 0,
65    #[doc = "1: Active"]
66    Timerisactive = 1,
67}
68impl From<Active> for bool {
69    #[inline(always)]
70    fn from(variant: Active) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `ACTIVE` reader - Timer Active Flag"]
75pub type ActiveR = crate::BitReader<Active>;
76impl ActiveR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Active {
80        match self.bits {
81            false => Active::Timerisnotactive,
82            true => Active::Timerisactive,
83        }
84    }
85    #[doc = "Inactive (stopped)"]
86    #[inline(always)]
87    pub fn is_timerisnotactive(&self) -> bool {
88        *self == Active::Timerisnotactive
89    }
90    #[doc = "Active"]
91    #[inline(always)]
92    pub fn is_timerisactive(&self) -> bool {
93        *self == Active::Timerisactive
94    }
95}
96impl R {
97    #[doc = "Bit 0 - Interrupt Flag"]
98    #[inline(always)]
99    pub fn intr(&self) -> IntrR {
100        IntrR::new((self.bits & 1) != 0)
101    }
102    #[doc = "Bit 1 - Timer Active Flag"]
103    #[inline(always)]
104    pub fn active(&self) -> ActiveR {
105        ActiveR::new(((self.bits >> 1) & 1) != 0)
106    }
107}
108#[cfg(feature = "debug")]
109impl core::fmt::Debug for R {
110    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
111        f.debug_struct("STAT")
112            .field("intr", &self.intr())
113            .field("active", &self.active())
114            .finish()
115    }
116}
117impl W {
118    #[doc = "Bit 0 - Interrupt Flag"]
119    #[inline(always)]
120    pub fn intr(&mut self) -> IntrW<'_, StatSpec> {
121        IntrW::new(self, 0)
122    }
123}
124#[doc = "Status\n\nYou can [`read`](crate::Reg::read) this register and get [`stat::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`stat::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
125pub struct StatSpec;
126impl crate::RegisterSpec for StatSpec {
127    type Ux = u32;
128}
129#[doc = "`read()` method returns [`stat::R`](R) reader structure"]
130impl crate::Readable for StatSpec {}
131#[doc = "`write(|w| ..)` method takes [`stat::W`](W) writer structure"]
132impl crate::Writable for StatSpec {
133    type Safety = crate::Unsafe;
134    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x01;
135}
136#[doc = "`reset()` method sets STAT to value 0"]
137impl crate::Resettable for StatSpec {}