efm32gg940_pac/usb/
dsts.rs

1#[doc = "Register `DSTS` reader"]
2pub struct R(crate::R<DSTS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DSTS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DSTS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DSTS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `SUSPSTS` reader - Suspend Status"]
17pub type SUSPSTS_R = crate::BitReader<bool>;
18#[doc = "Enumerated Speed\n\nValue on reset: 1"]
19#[derive(Clone, Copy, Debug, PartialEq)]
20#[repr(u8)]
21pub enum ENUMSPD_A {
22    #[doc = "2: Low speed (PHY clock is running at 6 MHz)."]
23    LS = 2,
24    #[doc = "3: Full speed (PHY clock is running at 48 MHz)."]
25    FS = 3,
26}
27impl From<ENUMSPD_A> for u8 {
28    #[inline(always)]
29    fn from(variant: ENUMSPD_A) -> Self {
30        variant as _
31    }
32}
33#[doc = "Field `ENUMSPD` reader - Enumerated Speed"]
34pub type ENUMSPD_R = crate::FieldReader<u8, ENUMSPD_A>;
35impl ENUMSPD_R {
36    #[doc = "Get enumerated values variant"]
37    #[inline(always)]
38    pub fn variant(&self) -> Option<ENUMSPD_A> {
39        match self.bits {
40            2 => Some(ENUMSPD_A::LS),
41            3 => Some(ENUMSPD_A::FS),
42            _ => None,
43        }
44    }
45    #[doc = "Checks if the value of the field is `LS`"]
46    #[inline(always)]
47    pub fn is_ls(&self) -> bool {
48        *self == ENUMSPD_A::LS
49    }
50    #[doc = "Checks if the value of the field is `FS`"]
51    #[inline(always)]
52    pub fn is_fs(&self) -> bool {
53        *self == ENUMSPD_A::FS
54    }
55}
56#[doc = "Field `ERRTICERR` reader - Erratic Error"]
57pub type ERRTICERR_R = crate::BitReader<bool>;
58#[doc = "Field `SOFFN` reader - Frame Number of the Received SOF"]
59pub type SOFFN_R = crate::FieldReader<u16, u16>;
60impl R {
61    #[doc = "Bit 0 - Suspend Status"]
62    #[inline(always)]
63    pub fn suspsts(&self) -> SUSPSTS_R {
64        SUSPSTS_R::new((self.bits & 1) != 0)
65    }
66    #[doc = "Bits 1:2 - Enumerated Speed"]
67    #[inline(always)]
68    pub fn enumspd(&self) -> ENUMSPD_R {
69        ENUMSPD_R::new(((self.bits >> 1) & 3) as u8)
70    }
71    #[doc = "Bit 3 - Erratic Error"]
72    #[inline(always)]
73    pub fn errticerr(&self) -> ERRTICERR_R {
74        ERRTICERR_R::new(((self.bits >> 3) & 1) != 0)
75    }
76    #[doc = "Bits 8:21 - Frame Number of the Received SOF"]
77    #[inline(always)]
78    pub fn soffn(&self) -> SOFFN_R {
79        SOFFN_R::new(((self.bits >> 8) & 0x3fff) as u16)
80    }
81}
82#[doc = "Device Status Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [dsts](index.html) module"]
83pub struct DSTS_SPEC;
84impl crate::RegisterSpec for DSTS_SPEC {
85    type Ux = u32;
86}
87#[doc = "`read()` method returns [dsts::R](R) reader structure"]
88impl crate::Readable for DSTS_SPEC {
89    type Reader = R;
90}
91#[doc = "`reset()` method sets DSTS to value 0x02"]
92impl crate::Resettable for DSTS_SPEC {
93    #[inline(always)]
94    fn reset_value() -> Self::Ux {
95        0x02
96    }
97}