mcxa_pac/cdog0/
flags.rs

1#[doc = "Register `FLAGS` reader"]
2pub type R = crate::R<FlagsSpec>;
3#[doc = "Register `FLAGS` writer"]
4pub type W = crate::W<FlagsSpec>;
5#[doc = "TIMEOUT fault flag\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum ToFlag {
9    #[doc = "0: A TIMEOUT fault has not occurred"]
10    NoFlag = 0,
11    #[doc = "1: A TIMEOUT fault has occurred"]
12    Flag = 1,
13}
14impl From<ToFlag> for bool {
15    #[inline(always)]
16    fn from(variant: ToFlag) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `TO_FLAG` reader - TIMEOUT fault flag"]
21pub type ToFlagR = crate::BitReader<ToFlag>;
22impl ToFlagR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> ToFlag {
26        match self.bits {
27            false => ToFlag::NoFlag,
28            true => ToFlag::Flag,
29        }
30    }
31    #[doc = "A TIMEOUT fault has not occurred"]
32    #[inline(always)]
33    pub fn is_no_flag(&self) -> bool {
34        *self == ToFlag::NoFlag
35    }
36    #[doc = "A TIMEOUT fault has occurred"]
37    #[inline(always)]
38    pub fn is_flag(&self) -> bool {
39        *self == ToFlag::Flag
40    }
41}
42#[doc = "Field `TO_FLAG` writer - TIMEOUT fault flag"]
43pub type ToFlagW<'a, REG> = crate::BitWriter1C<'a, REG, ToFlag>;
44impl<'a, REG> ToFlagW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "A TIMEOUT fault has not occurred"]
49    #[inline(always)]
50    pub fn no_flag(self) -> &'a mut crate::W<REG> {
51        self.variant(ToFlag::NoFlag)
52    }
53    #[doc = "A TIMEOUT fault has occurred"]
54    #[inline(always)]
55    pub fn flag(self) -> &'a mut crate::W<REG> {
56        self.variant(ToFlag::Flag)
57    }
58}
59#[doc = "MISCOMPARE fault flag\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum MiscomFlag {
63    #[doc = "0: A MISCOMPARE fault has not occurred"]
64    NoFlag = 0,
65    #[doc = "1: A MISCOMPARE fault has occurred"]
66    Flag = 1,
67}
68impl From<MiscomFlag> for bool {
69    #[inline(always)]
70    fn from(variant: MiscomFlag) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `MISCOM_FLAG` reader - MISCOMPARE fault flag"]
75pub type MiscomFlagR = crate::BitReader<MiscomFlag>;
76impl MiscomFlagR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> MiscomFlag {
80        match self.bits {
81            false => MiscomFlag::NoFlag,
82            true => MiscomFlag::Flag,
83        }
84    }
85    #[doc = "A MISCOMPARE fault has not occurred"]
86    #[inline(always)]
87    pub fn is_no_flag(&self) -> bool {
88        *self == MiscomFlag::NoFlag
89    }
90    #[doc = "A MISCOMPARE fault has occurred"]
91    #[inline(always)]
92    pub fn is_flag(&self) -> bool {
93        *self == MiscomFlag::Flag
94    }
95}
96#[doc = "Field `MISCOM_FLAG` writer - MISCOMPARE fault flag"]
97pub type MiscomFlagW<'a, REG> = crate::BitWriter1C<'a, REG, MiscomFlag>;
98impl<'a, REG> MiscomFlagW<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "A MISCOMPARE fault has not occurred"]
103    #[inline(always)]
104    pub fn no_flag(self) -> &'a mut crate::W<REG> {
105        self.variant(MiscomFlag::NoFlag)
106    }
107    #[doc = "A MISCOMPARE fault has occurred"]
108    #[inline(always)]
109    pub fn flag(self) -> &'a mut crate::W<REG> {
110        self.variant(MiscomFlag::Flag)
111    }
112}
113#[doc = "SEQUENCE fault flag\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum SeqFlag {
117    #[doc = "0: A SEQUENCE fault has not occurred"]
118    NoFlag = 0,
119    #[doc = "1: A SEQUENCE fault has occurred"]
120    Flag = 1,
121}
122impl From<SeqFlag> for bool {
123    #[inline(always)]
124    fn from(variant: SeqFlag) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `SEQ_FLAG` reader - SEQUENCE fault flag"]
129pub type SeqFlagR = crate::BitReader<SeqFlag>;
130impl SeqFlagR {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub const fn variant(&self) -> SeqFlag {
134        match self.bits {
135            false => SeqFlag::NoFlag,
136            true => SeqFlag::Flag,
137        }
138    }
139    #[doc = "A SEQUENCE fault has not occurred"]
140    #[inline(always)]
141    pub fn is_no_flag(&self) -> bool {
142        *self == SeqFlag::NoFlag
143    }
144    #[doc = "A SEQUENCE fault has occurred"]
145    #[inline(always)]
146    pub fn is_flag(&self) -> bool {
147        *self == SeqFlag::Flag
148    }
149}
150#[doc = "Field `SEQ_FLAG` writer - SEQUENCE fault flag"]
151pub type SeqFlagW<'a, REG> = crate::BitWriter1C<'a, REG, SeqFlag>;
152impl<'a, REG> SeqFlagW<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155{
156    #[doc = "A SEQUENCE fault has not occurred"]
157    #[inline(always)]
158    pub fn no_flag(self) -> &'a mut crate::W<REG> {
159        self.variant(SeqFlag::NoFlag)
160    }
161    #[doc = "A SEQUENCE fault has occurred"]
162    #[inline(always)]
163    pub fn flag(self) -> &'a mut crate::W<REG> {
164        self.variant(SeqFlag::Flag)
165    }
166}
167#[doc = "CONTROL fault flag\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum CntFlag {
171    #[doc = "0: A CONTROL fault has not occurred"]
172    NoFlag = 0,
173    #[doc = "1: A CONTROL fault has occurred"]
174    Flag = 1,
175}
176impl From<CntFlag> for bool {
177    #[inline(always)]
178    fn from(variant: CntFlag) -> Self {
179        variant as u8 != 0
180    }
181}
182#[doc = "Field `CNT_FLAG` reader - CONTROL fault flag"]
183pub type CntFlagR = crate::BitReader<CntFlag>;
184impl CntFlagR {
185    #[doc = "Get enumerated values variant"]
186    #[inline(always)]
187    pub const fn variant(&self) -> CntFlag {
188        match self.bits {
189            false => CntFlag::NoFlag,
190            true => CntFlag::Flag,
191        }
192    }
193    #[doc = "A CONTROL fault has not occurred"]
194    #[inline(always)]
195    pub fn is_no_flag(&self) -> bool {
196        *self == CntFlag::NoFlag
197    }
198    #[doc = "A CONTROL fault has occurred"]
199    #[inline(always)]
200    pub fn is_flag(&self) -> bool {
201        *self == CntFlag::Flag
202    }
203}
204#[doc = "Field `CNT_FLAG` writer - CONTROL fault flag"]
205pub type CntFlagW<'a, REG> = crate::BitWriter1C<'a, REG, CntFlag>;
206impl<'a, REG> CntFlagW<'a, REG>
207where
208    REG: crate::Writable + crate::RegisterSpec,
209{
210    #[doc = "A CONTROL fault has not occurred"]
211    #[inline(always)]
212    pub fn no_flag(self) -> &'a mut crate::W<REG> {
213        self.variant(CntFlag::NoFlag)
214    }
215    #[doc = "A CONTROL fault has occurred"]
216    #[inline(always)]
217    pub fn flag(self) -> &'a mut crate::W<REG> {
218        self.variant(CntFlag::Flag)
219    }
220}
221#[doc = "STATE fault flag\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum StateFlag {
225    #[doc = "0: A STATE fault has not occurred"]
226    NoFlag = 0,
227    #[doc = "1: A STATE fault has occurred"]
228    Flag = 1,
229}
230impl From<StateFlag> for bool {
231    #[inline(always)]
232    fn from(variant: StateFlag) -> Self {
233        variant as u8 != 0
234    }
235}
236#[doc = "Field `STATE_FLAG` reader - STATE fault flag"]
237pub type StateFlagR = crate::BitReader<StateFlag>;
238impl StateFlagR {
239    #[doc = "Get enumerated values variant"]
240    #[inline(always)]
241    pub const fn variant(&self) -> StateFlag {
242        match self.bits {
243            false => StateFlag::NoFlag,
244            true => StateFlag::Flag,
245        }
246    }
247    #[doc = "A STATE fault has not occurred"]
248    #[inline(always)]
249    pub fn is_no_flag(&self) -> bool {
250        *self == StateFlag::NoFlag
251    }
252    #[doc = "A STATE fault has occurred"]
253    #[inline(always)]
254    pub fn is_flag(&self) -> bool {
255        *self == StateFlag::Flag
256    }
257}
258#[doc = "Field `STATE_FLAG` writer - STATE fault flag"]
259pub type StateFlagW<'a, REG> = crate::BitWriter1C<'a, REG, StateFlag>;
260impl<'a, REG> StateFlagW<'a, REG>
261where
262    REG: crate::Writable + crate::RegisterSpec,
263{
264    #[doc = "A STATE fault has not occurred"]
265    #[inline(always)]
266    pub fn no_flag(self) -> &'a mut crate::W<REG> {
267        self.variant(StateFlag::NoFlag)
268    }
269    #[doc = "A STATE fault has occurred"]
270    #[inline(always)]
271    pub fn flag(self) -> &'a mut crate::W<REG> {
272        self.variant(StateFlag::Flag)
273    }
274}
275#[doc = "ADDRESS fault flag\n\nValue on reset: 0"]
276#[cfg_attr(feature = "defmt", derive(defmt::Format))]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278pub enum AddrFlag {
279    #[doc = "0: An ADDRESS fault has not occurred"]
280    NoFlag = 0,
281    #[doc = "1: An ADDRESS fault has occurred"]
282    Flag = 1,
283}
284impl From<AddrFlag> for bool {
285    #[inline(always)]
286    fn from(variant: AddrFlag) -> Self {
287        variant as u8 != 0
288    }
289}
290#[doc = "Field `ADDR_FLAG` reader - ADDRESS fault flag"]
291pub type AddrFlagR = crate::BitReader<AddrFlag>;
292impl AddrFlagR {
293    #[doc = "Get enumerated values variant"]
294    #[inline(always)]
295    pub const fn variant(&self) -> AddrFlag {
296        match self.bits {
297            false => AddrFlag::NoFlag,
298            true => AddrFlag::Flag,
299        }
300    }
301    #[doc = "An ADDRESS fault has not occurred"]
302    #[inline(always)]
303    pub fn is_no_flag(&self) -> bool {
304        *self == AddrFlag::NoFlag
305    }
306    #[doc = "An ADDRESS fault has occurred"]
307    #[inline(always)]
308    pub fn is_flag(&self) -> bool {
309        *self == AddrFlag::Flag
310    }
311}
312#[doc = "Field `ADDR_FLAG` writer - ADDRESS fault flag"]
313pub type AddrFlagW<'a, REG> = crate::BitWriter1C<'a, REG, AddrFlag>;
314impl<'a, REG> AddrFlagW<'a, REG>
315where
316    REG: crate::Writable + crate::RegisterSpec,
317{
318    #[doc = "An ADDRESS fault has not occurred"]
319    #[inline(always)]
320    pub fn no_flag(self) -> &'a mut crate::W<REG> {
321        self.variant(AddrFlag::NoFlag)
322    }
323    #[doc = "An ADDRESS fault has occurred"]
324    #[inline(always)]
325    pub fn flag(self) -> &'a mut crate::W<REG> {
326        self.variant(AddrFlag::Flag)
327    }
328}
329#[doc = "Power-on reset flag\n\nValue on reset: 1"]
330#[cfg_attr(feature = "defmt", derive(defmt::Format))]
331#[derive(Clone, Copy, Debug, PartialEq, Eq)]
332pub enum PorFlag {
333    #[doc = "0: A Power-on reset event has not occurred"]
334    NoFlag = 0,
335    #[doc = "1: A Power-on reset event has occurred"]
336    Flag = 1,
337}
338impl From<PorFlag> for bool {
339    #[inline(always)]
340    fn from(variant: PorFlag) -> Self {
341        variant as u8 != 0
342    }
343}
344#[doc = "Field `POR_FLAG` reader - Power-on reset flag"]
345pub type PorFlagR = crate::BitReader<PorFlag>;
346impl PorFlagR {
347    #[doc = "Get enumerated values variant"]
348    #[inline(always)]
349    pub const fn variant(&self) -> PorFlag {
350        match self.bits {
351            false => PorFlag::NoFlag,
352            true => PorFlag::Flag,
353        }
354    }
355    #[doc = "A Power-on reset event has not occurred"]
356    #[inline(always)]
357    pub fn is_no_flag(&self) -> bool {
358        *self == PorFlag::NoFlag
359    }
360    #[doc = "A Power-on reset event has occurred"]
361    #[inline(always)]
362    pub fn is_flag(&self) -> bool {
363        *self == PorFlag::Flag
364    }
365}
366#[doc = "Field `POR_FLAG` writer - Power-on reset flag"]
367pub type PorFlagW<'a, REG> = crate::BitWriter1C<'a, REG, PorFlag>;
368impl<'a, REG> PorFlagW<'a, REG>
369where
370    REG: crate::Writable + crate::RegisterSpec,
371{
372    #[doc = "A Power-on reset event has not occurred"]
373    #[inline(always)]
374    pub fn no_flag(self) -> &'a mut crate::W<REG> {
375        self.variant(PorFlag::NoFlag)
376    }
377    #[doc = "A Power-on reset event has occurred"]
378    #[inline(always)]
379    pub fn flag(self) -> &'a mut crate::W<REG> {
380        self.variant(PorFlag::Flag)
381    }
382}
383impl R {
384    #[doc = "Bit 0 - TIMEOUT fault flag"]
385    #[inline(always)]
386    pub fn to_flag(&self) -> ToFlagR {
387        ToFlagR::new((self.bits & 1) != 0)
388    }
389    #[doc = "Bit 1 - MISCOMPARE fault flag"]
390    #[inline(always)]
391    pub fn miscom_flag(&self) -> MiscomFlagR {
392        MiscomFlagR::new(((self.bits >> 1) & 1) != 0)
393    }
394    #[doc = "Bit 2 - SEQUENCE fault flag"]
395    #[inline(always)]
396    pub fn seq_flag(&self) -> SeqFlagR {
397        SeqFlagR::new(((self.bits >> 2) & 1) != 0)
398    }
399    #[doc = "Bit 3 - CONTROL fault flag"]
400    #[inline(always)]
401    pub fn cnt_flag(&self) -> CntFlagR {
402        CntFlagR::new(((self.bits >> 3) & 1) != 0)
403    }
404    #[doc = "Bit 4 - STATE fault flag"]
405    #[inline(always)]
406    pub fn state_flag(&self) -> StateFlagR {
407        StateFlagR::new(((self.bits >> 4) & 1) != 0)
408    }
409    #[doc = "Bit 5 - ADDRESS fault flag"]
410    #[inline(always)]
411    pub fn addr_flag(&self) -> AddrFlagR {
412        AddrFlagR::new(((self.bits >> 5) & 1) != 0)
413    }
414    #[doc = "Bit 16 - Power-on reset flag"]
415    #[inline(always)]
416    pub fn por_flag(&self) -> PorFlagR {
417        PorFlagR::new(((self.bits >> 16) & 1) != 0)
418    }
419}
420#[cfg(feature = "debug")]
421impl core::fmt::Debug for R {
422    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
423        f.debug_struct("FLAGS")
424            .field("to_flag", &self.to_flag())
425            .field("miscom_flag", &self.miscom_flag())
426            .field("seq_flag", &self.seq_flag())
427            .field("cnt_flag", &self.cnt_flag())
428            .field("state_flag", &self.state_flag())
429            .field("addr_flag", &self.addr_flag())
430            .field("por_flag", &self.por_flag())
431            .finish()
432    }
433}
434impl W {
435    #[doc = "Bit 0 - TIMEOUT fault flag"]
436    #[inline(always)]
437    pub fn to_flag(&mut self) -> ToFlagW<'_, FlagsSpec> {
438        ToFlagW::new(self, 0)
439    }
440    #[doc = "Bit 1 - MISCOMPARE fault flag"]
441    #[inline(always)]
442    pub fn miscom_flag(&mut self) -> MiscomFlagW<'_, FlagsSpec> {
443        MiscomFlagW::new(self, 1)
444    }
445    #[doc = "Bit 2 - SEQUENCE fault flag"]
446    #[inline(always)]
447    pub fn seq_flag(&mut self) -> SeqFlagW<'_, FlagsSpec> {
448        SeqFlagW::new(self, 2)
449    }
450    #[doc = "Bit 3 - CONTROL fault flag"]
451    #[inline(always)]
452    pub fn cnt_flag(&mut self) -> CntFlagW<'_, FlagsSpec> {
453        CntFlagW::new(self, 3)
454    }
455    #[doc = "Bit 4 - STATE fault flag"]
456    #[inline(always)]
457    pub fn state_flag(&mut self) -> StateFlagW<'_, FlagsSpec> {
458        StateFlagW::new(self, 4)
459    }
460    #[doc = "Bit 5 - ADDRESS fault flag"]
461    #[inline(always)]
462    pub fn addr_flag(&mut self) -> AddrFlagW<'_, FlagsSpec> {
463        AddrFlagW::new(self, 5)
464    }
465    #[doc = "Bit 16 - Power-on reset flag"]
466    #[inline(always)]
467    pub fn por_flag(&mut self) -> PorFlagW<'_, FlagsSpec> {
468        PorFlagW::new(self, 16)
469    }
470}
471#[doc = "Flags Register\n\nYou can [`read`](crate::Reg::read) this register and get [`flags::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`flags::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
472pub struct FlagsSpec;
473impl crate::RegisterSpec for FlagsSpec {
474    type Ux = u32;
475}
476#[doc = "`read()` method returns [`flags::R`](R) reader structure"]
477impl crate::Readable for FlagsSpec {}
478#[doc = "`write(|w| ..)` method takes [`flags::W`](W) writer structure"]
479impl crate::Writable for FlagsSpec {
480    type Safety = crate::Unsafe;
481    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x0001_003f;
482}
483#[doc = "`reset()` method sets FLAGS to value 0x0001_0000"]
484impl crate::Resettable for FlagsSpec {
485    const RESET_VALUE: u32 = 0x0001_0000;
486}