mcxa_pac/usb0/
clk_recover_int_status.rs

1#[doc = "Register `CLK_RECOVER_INT_STATUS` reader"]
2pub type R = crate::R<ClkRecoverIntStatusSpec>;
3#[doc = "Register `CLK_RECOVER_INT_STATUS` writer"]
4pub type W = crate::W<ClkRecoverIntStatusSpec>;
5#[doc = "Overflow Error Interrupt Status Flag\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum OvfError {
9    #[doc = "0: Interrupt did not occur"]
10    IntNo = 0,
11    #[doc = "1: Unmasked interrupt occurred"]
12    IntYes = 1,
13}
14impl From<OvfError> for bool {
15    #[inline(always)]
16    fn from(variant: OvfError) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `OVF_ERROR` reader - Overflow Error Interrupt Status Flag"]
21pub type OvfErrorR = crate::BitReader<OvfError>;
22impl OvfErrorR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> OvfError {
26        match self.bits {
27            false => OvfError::IntNo,
28            true => OvfError::IntYes,
29        }
30    }
31    #[doc = "Interrupt did not occur"]
32    #[inline(always)]
33    pub fn is_int_no(&self) -> bool {
34        *self == OvfError::IntNo
35    }
36    #[doc = "Unmasked interrupt occurred"]
37    #[inline(always)]
38    pub fn is_int_yes(&self) -> bool {
39        *self == OvfError::IntYes
40    }
41}
42#[doc = "Field `OVF_ERROR` writer - Overflow Error Interrupt Status Flag"]
43pub type OvfErrorW<'a, REG> = crate::BitWriter1C<'a, REG, OvfError>;
44impl<'a, REG> OvfErrorW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Interrupt did not occur"]
49    #[inline(always)]
50    pub fn int_no(self) -> &'a mut crate::W<REG> {
51        self.variant(OvfError::IntNo)
52    }
53    #[doc = "Unmasked interrupt occurred"]
54    #[inline(always)]
55    pub fn int_yes(self) -> &'a mut crate::W<REG> {
56        self.variant(OvfError::IntYes)
57    }
58}
59impl R {
60    #[doc = "Bit 4 - Overflow Error Interrupt Status Flag"]
61    #[inline(always)]
62    pub fn ovf_error(&self) -> OvfErrorR {
63        OvfErrorR::new(((self.bits >> 4) & 1) != 0)
64    }
65}
66#[cfg(feature = "debug")]
67impl core::fmt::Debug for R {
68    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
69        f.debug_struct("CLK_RECOVER_INT_STATUS")
70            .field("ovf_error", &self.ovf_error())
71            .finish()
72    }
73}
74impl W {
75    #[doc = "Bit 4 - Overflow Error Interrupt Status Flag"]
76    #[inline(always)]
77    pub fn ovf_error(&mut self) -> OvfErrorW<'_, ClkRecoverIntStatusSpec> {
78        OvfErrorW::new(self, 4)
79    }
80}
81#[doc = "Clock Recovery Separated Interrupt Status\n\nYou can [`read`](crate::Reg::read) this register and get [`clk_recover_int_status::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`clk_recover_int_status::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
82pub struct ClkRecoverIntStatusSpec;
83impl crate::RegisterSpec for ClkRecoverIntStatusSpec {
84    type Ux = u8;
85}
86#[doc = "`read()` method returns [`clk_recover_int_status::R`](R) reader structure"]
87impl crate::Readable for ClkRecoverIntStatusSpec {}
88#[doc = "`write(|w| ..)` method takes [`clk_recover_int_status::W`](W) writer structure"]
89impl crate::Writable for ClkRecoverIntStatusSpec {
90    type Safety = crate::Unsafe;
91    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0x10;
92}
93#[doc = "`reset()` method sets CLK_RECOVER_INT_STATUS to value 0"]
94impl crate::Resettable for ClkRecoverIntStatusSpec {}