mcxa_pac/usb0/
otgstat.rs

1#[doc = "Register `OTGSTAT` reader"]
2pub type R = crate::R<OtgstatSpec>;
3#[doc = "Line State Stable\n\nValue on reset: 0"]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum Linestatestable {
7    #[doc = "0: Unstable"]
8    LinestNotStable = 0,
9    #[doc = "1: Stable"]
10    LinestStable = 1,
11}
12impl From<Linestatestable> for bool {
13    #[inline(always)]
14    fn from(variant: Linestatestable) -> Self {
15        variant as u8 != 0
16    }
17}
18#[doc = "Field `LINESTATESTABLE` reader - Line State Stable"]
19pub type LinestatestableR = crate::BitReader<Linestatestable>;
20impl LinestatestableR {
21    #[doc = "Get enumerated values variant"]
22    #[inline(always)]
23    pub const fn variant(&self) -> Linestatestable {
24        match self.bits {
25            false => Linestatestable::LinestNotStable,
26            true => Linestatestable::LinestStable,
27        }
28    }
29    #[doc = "Unstable"]
30    #[inline(always)]
31    pub fn is_linest_not_stable(&self) -> bool {
32        *self == Linestatestable::LinestNotStable
33    }
34    #[doc = "Stable"]
35    #[inline(always)]
36    pub fn is_linest_stable(&self) -> bool {
37        *self == Linestatestable::LinestStable
38    }
39}
40#[doc = "Field `ONEMSEC` reader - Reserved for 1 ms count"]
41pub type OnemsecR = crate::BitReader;
42impl R {
43    #[doc = "Bit 5 - Line State Stable"]
44    #[inline(always)]
45    pub fn linestatestable(&self) -> LinestatestableR {
46        LinestatestableR::new(((self.bits >> 5) & 1) != 0)
47    }
48    #[doc = "Bit 6 - Reserved for 1 ms count"]
49    #[inline(always)]
50    pub fn onemsec(&self) -> OnemsecR {
51        OnemsecR::new(((self.bits >> 6) & 1) != 0)
52    }
53}
54#[cfg(feature = "debug")]
55impl core::fmt::Debug for R {
56    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
57        f.debug_struct("OTGSTAT")
58            .field("linestatestable", &self.linestatestable())
59            .field("onemsec", &self.onemsec())
60            .finish()
61    }
62}
63#[doc = "OTG Status\n\nYou can [`read`](crate::Reg::read) this register and get [`otgstat::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
64pub struct OtgstatSpec;
65impl crate::RegisterSpec for OtgstatSpec {
66    type Ux = u8;
67}
68#[doc = "`read()` method returns [`otgstat::R`](R) reader structure"]
69impl crate::Readable for OtgstatSpec {}
70#[doc = "`reset()` method sets OTGSTAT to value 0"]
71impl crate::Resettable for OtgstatSpec {}