Skip to main content

mcxa_pac/flexpwm0/
sm3sts.rs

1#[doc = "Register `SM3STS` reader"]
2pub type R = crate::R<Sm3stsSpec>;
3#[doc = "Register `SM3STS` writer"]
4pub type W = crate::W<Sm3stsSpec>;
5#[doc = "Compare Flags\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 Cmpf {
10    #[doc = "0: No compare event has occurred for a particular VALx value."]
11    NoEvent = 0,
12    #[doc = "1: A compare event has occurred for a particular VALx value."]
13    Event = 1,
14}
15impl From<Cmpf> for u8 {
16    #[inline(always)]
17    fn from(variant: Cmpf) -> Self {
18        variant as _
19    }
20}
21impl crate::FieldSpec for Cmpf {
22    type Ux = u8;
23}
24impl crate::IsEnum for Cmpf {}
25#[doc = "Field `CMPF` reader - Compare Flags"]
26pub type CmpfR = crate::FieldReader<Cmpf>;
27impl CmpfR {
28    #[doc = "Get enumerated values variant"]
29    #[inline(always)]
30    pub const fn variant(&self) -> Option<Cmpf> {
31        match self.bits {
32            0 => Some(Cmpf::NoEvent),
33            1 => Some(Cmpf::Event),
34            _ => None,
35        }
36    }
37    #[doc = "No compare event has occurred for a particular VALx value."]
38    #[inline(always)]
39    pub fn is_no_event(&self) -> bool {
40        *self == Cmpf::NoEvent
41    }
42    #[doc = "A compare event has occurred for a particular VALx value."]
43    #[inline(always)]
44    pub fn is_event(&self) -> bool {
45        *self == Cmpf::Event
46    }
47}
48#[doc = "Field `CMPF` writer - Compare Flags"]
49pub type CmpfW<'a, REG> = crate::FieldWriter<'a, REG, 6, Cmpf>;
50impl<'a, REG> CmpfW<'a, REG>
51where
52    REG: crate::Writable + crate::RegisterSpec,
53    REG::Ux: From<u8>,
54{
55    #[doc = "No compare event has occurred for a particular VALx value."]
56    #[inline(always)]
57    pub fn no_event(self) -> &'a mut crate::W<REG> {
58        self.variant(Cmpf::NoEvent)
59    }
60    #[doc = "A compare event has occurred for a particular VALx value."]
61    #[inline(always)]
62    pub fn event(self) -> &'a mut crate::W<REG> {
63        self.variant(Cmpf::Event)
64    }
65}
66#[doc = "Field `CFX0` reader - Capture Flag X0"]
67pub type Cfx0R = crate::BitReader;
68#[doc = "Field `CFX0` writer - Capture Flag X0"]
69pub type Cfx0W<'a, REG> = crate::BitWriter1C<'a, REG>;
70#[doc = "Field `CFX1` reader - Capture Flag X1"]
71pub type Cfx1R = crate::BitReader;
72#[doc = "Field `CFX1` writer - Capture Flag X1"]
73pub type Cfx1W<'a, REG> = crate::BitWriter1C<'a, REG>;
74#[doc = "Reload Flag\n\nValue on reset: 0"]
75#[cfg_attr(feature = "defmt", derive(defmt::Format))]
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77pub enum Rf {
78    #[doc = "0: No new reload cycle since last STS\\[RF\\] clearing"]
79    NoFlag = 0,
80    #[doc = "1: New reload cycle since last STS\\[RF\\] clearing"]
81    Flag = 1,
82}
83impl From<Rf> for bool {
84    #[inline(always)]
85    fn from(variant: Rf) -> Self {
86        variant as u8 != 0
87    }
88}
89#[doc = "Field `RF` reader - Reload Flag"]
90pub type RfR = crate::BitReader<Rf>;
91impl RfR {
92    #[doc = "Get enumerated values variant"]
93    #[inline(always)]
94    pub const fn variant(&self) -> Rf {
95        match self.bits {
96            false => Rf::NoFlag,
97            true => Rf::Flag,
98        }
99    }
100    #[doc = "No new reload cycle since last STS\\[RF\\] clearing"]
101    #[inline(always)]
102    pub fn is_no_flag(&self) -> bool {
103        *self == Rf::NoFlag
104    }
105    #[doc = "New reload cycle since last STS\\[RF\\] clearing"]
106    #[inline(always)]
107    pub fn is_flag(&self) -> bool {
108        *self == Rf::Flag
109    }
110}
111#[doc = "Field `RF` writer - Reload Flag"]
112pub type RfW<'a, REG> = crate::BitWriter1C<'a, REG, Rf>;
113impl<'a, REG> RfW<'a, REG>
114where
115    REG: crate::Writable + crate::RegisterSpec,
116{
117    #[doc = "No new reload cycle since last STS\\[RF\\] clearing"]
118    #[inline(always)]
119    pub fn no_flag(self) -> &'a mut crate::W<REG> {
120        self.variant(Rf::NoFlag)
121    }
122    #[doc = "New reload cycle since last STS\\[RF\\] clearing"]
123    #[inline(always)]
124    pub fn flag(self) -> &'a mut crate::W<REG> {
125        self.variant(Rf::Flag)
126    }
127}
128#[doc = "Reload Error Flag\n\nValue on reset: 0"]
129#[cfg_attr(feature = "defmt", derive(defmt::Format))]
130#[derive(Clone, Copy, Debug, PartialEq, Eq)]
131pub enum Ref {
132    #[doc = "0: No reload error occurred."]
133    NoFlag = 0,
134    #[doc = "1: Reload signal occurred with non-coherent data and MCTRL\\[LDOK\\] = 0."]
135    Flag = 1,
136}
137impl From<Ref> for bool {
138    #[inline(always)]
139    fn from(variant: Ref) -> Self {
140        variant as u8 != 0
141    }
142}
143#[doc = "Field `REF` reader - Reload Error Flag"]
144pub type RefR = crate::BitReader<Ref>;
145impl RefR {
146    #[doc = "Get enumerated values variant"]
147    #[inline(always)]
148    pub const fn variant(&self) -> Ref {
149        match self.bits {
150            false => Ref::NoFlag,
151            true => Ref::Flag,
152        }
153    }
154    #[doc = "No reload error occurred."]
155    #[inline(always)]
156    pub fn is_no_flag(&self) -> bool {
157        *self == Ref::NoFlag
158    }
159    #[doc = "Reload signal occurred with non-coherent data and MCTRL\\[LDOK\\] = 0."]
160    #[inline(always)]
161    pub fn is_flag(&self) -> bool {
162        *self == Ref::Flag
163    }
164}
165#[doc = "Field `REF` writer - Reload Error Flag"]
166pub type RefW<'a, REG> = crate::BitWriter1C<'a, REG, Ref>;
167impl<'a, REG> RefW<'a, REG>
168where
169    REG: crate::Writable + crate::RegisterSpec,
170{
171    #[doc = "No reload error occurred."]
172    #[inline(always)]
173    pub fn no_flag(self) -> &'a mut crate::W<REG> {
174        self.variant(Ref::NoFlag)
175    }
176    #[doc = "Reload signal occurred with non-coherent data and MCTRL\\[LDOK\\] = 0."]
177    #[inline(always)]
178    pub fn flag(self) -> &'a mut crate::W<REG> {
179        self.variant(Ref::Flag)
180    }
181}
182#[doc = "Registers Updated Flag\n\nValue on reset: 0"]
183#[cfg_attr(feature = "defmt", derive(defmt::Format))]
184#[derive(Clone, Copy, Debug, PartialEq, Eq)]
185pub enum Ruf {
186    #[doc = "0: No register update has occurred since last reload."]
187    NoFlag = 0,
188    #[doc = "1: At least one of the double buffered registers has been updated since the last reload."]
189    Flag = 1,
190}
191impl From<Ruf> for bool {
192    #[inline(always)]
193    fn from(variant: Ruf) -> Self {
194        variant as u8 != 0
195    }
196}
197#[doc = "Field `RUF` reader - Registers Updated Flag"]
198pub type RufR = crate::BitReader<Ruf>;
199impl RufR {
200    #[doc = "Get enumerated values variant"]
201    #[inline(always)]
202    pub const fn variant(&self) -> Ruf {
203        match self.bits {
204            false => Ruf::NoFlag,
205            true => Ruf::Flag,
206        }
207    }
208    #[doc = "No register update has occurred since last reload."]
209    #[inline(always)]
210    pub fn is_no_flag(&self) -> bool {
211        *self == Ruf::NoFlag
212    }
213    #[doc = "At least one of the double buffered registers has been updated since the last reload."]
214    #[inline(always)]
215    pub fn is_flag(&self) -> bool {
216        *self == Ruf::Flag
217    }
218}
219impl R {
220    #[doc = "Bits 0:5 - Compare Flags"]
221    #[inline(always)]
222    pub fn cmpf(&self) -> CmpfR {
223        CmpfR::new((self.bits & 0x3f) as u8)
224    }
225    #[doc = "Bit 6 - Capture Flag X0"]
226    #[inline(always)]
227    pub fn cfx0(&self) -> Cfx0R {
228        Cfx0R::new(((self.bits >> 6) & 1) != 0)
229    }
230    #[doc = "Bit 7 - Capture Flag X1"]
231    #[inline(always)]
232    pub fn cfx1(&self) -> Cfx1R {
233        Cfx1R::new(((self.bits >> 7) & 1) != 0)
234    }
235    #[doc = "Bit 12 - Reload Flag"]
236    #[inline(always)]
237    pub fn rf(&self) -> RfR {
238        RfR::new(((self.bits >> 12) & 1) != 0)
239    }
240    #[doc = "Bit 13 - Reload Error Flag"]
241    #[inline(always)]
242    pub fn ref_(&self) -> RefR {
243        RefR::new(((self.bits >> 13) & 1) != 0)
244    }
245    #[doc = "Bit 14 - Registers Updated Flag"]
246    #[inline(always)]
247    pub fn ruf(&self) -> RufR {
248        RufR::new(((self.bits >> 14) & 1) != 0)
249    }
250}
251#[cfg(feature = "debug")]
252impl core::fmt::Debug for R {
253    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
254        f.debug_struct("SM3STS")
255            .field("cmpf", &self.cmpf())
256            .field("cfx0", &self.cfx0())
257            .field("cfx1", &self.cfx1())
258            .field("rf", &self.rf())
259            .field("ref_", &self.ref_())
260            .field("ruf", &self.ruf())
261            .finish()
262    }
263}
264impl W {
265    #[doc = "Bits 0:5 - Compare Flags"]
266    #[inline(always)]
267    pub fn cmpf(&mut self) -> CmpfW<'_, Sm3stsSpec> {
268        CmpfW::new(self, 0)
269    }
270    #[doc = "Bit 6 - Capture Flag X0"]
271    #[inline(always)]
272    pub fn cfx0(&mut self) -> Cfx0W<'_, Sm3stsSpec> {
273        Cfx0W::new(self, 6)
274    }
275    #[doc = "Bit 7 - Capture Flag X1"]
276    #[inline(always)]
277    pub fn cfx1(&mut self) -> Cfx1W<'_, Sm3stsSpec> {
278        Cfx1W::new(self, 7)
279    }
280    #[doc = "Bit 12 - Reload Flag"]
281    #[inline(always)]
282    pub fn rf(&mut self) -> RfW<'_, Sm3stsSpec> {
283        RfW::new(self, 12)
284    }
285    #[doc = "Bit 13 - Reload Error Flag"]
286    #[inline(always)]
287    pub fn ref_(&mut self) -> RefW<'_, Sm3stsSpec> {
288        RefW::new(self, 13)
289    }
290}
291#[doc = "Status Register\n\nYou can [`read`](crate::Reg::read) this register and get [`sm3sts::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sm3sts::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
292pub struct Sm3stsSpec;
293impl crate::RegisterSpec for Sm3stsSpec {
294    type Ux = u16;
295}
296#[doc = "`read()` method returns [`sm3sts::R`](R) reader structure"]
297impl crate::Readable for Sm3stsSpec {}
298#[doc = "`write(|w| ..)` method takes [`sm3sts::W`](W) writer structure"]
299impl crate::Writable for Sm3stsSpec {
300    type Safety = crate::Unsafe;
301    const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0x30ff;
302}
303#[doc = "`reset()` method sets SM3STS to value 0"]
304impl crate::Resettable for Sm3stsSpec {}