1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#[doc = "Register `FSMSTATUS` reader"]
pub type R = crate::R<FSMSTATUS_SPEC>;
#[doc = "Field `FSMSTATE` reader - Fine State Machine Status"]
pub type FSMSTATE_R = crate::FieldReader<FSMSTATESELECT_A>;
#[doc = "Fine State Machine Status\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum FSMSTATESELECT_A {
    #[doc = "1: OFF (L3). It corresponds to the powered-off, disconnected, and disabled state"]
    OFF = 1,
    #[doc = "2: ON (L0). It corresponds to the Idle and Active states"]
    ON = 2,
    #[doc = "4: SUSPEND (L2)"]
    SUSPEND = 4,
    #[doc = "8: SLEEP (L1)"]
    SLEEP = 8,
    #[doc = "16: DNRESUME. Down Stream Resume."]
    DNRESUME = 16,
    #[doc = "32: UPRESUME. Up Stream Resume."]
    UPRESUME = 32,
    #[doc = "64: RESET. USB lines Reset."]
    RESET = 64,
}
impl From<FSMSTATESELECT_A> for u8 {
    #[inline(always)]
    fn from(variant: FSMSTATESELECT_A) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for FSMSTATESELECT_A {
    type Ux = u8;
}
impl FSMSTATE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<FSMSTATESELECT_A> {
        match self.bits {
            1 => Some(FSMSTATESELECT_A::OFF),
            2 => Some(FSMSTATESELECT_A::ON),
            4 => Some(FSMSTATESELECT_A::SUSPEND),
            8 => Some(FSMSTATESELECT_A::SLEEP),
            16 => Some(FSMSTATESELECT_A::DNRESUME),
            32 => Some(FSMSTATESELECT_A::UPRESUME),
            64 => Some(FSMSTATESELECT_A::RESET),
            _ => None,
        }
    }
    #[doc = "OFF (L3). It corresponds to the powered-off, disconnected, and disabled state"]
    #[inline(always)]
    pub fn is_off(&self) -> bool {
        *self == FSMSTATESELECT_A::OFF
    }
    #[doc = "ON (L0). It corresponds to the Idle and Active states"]
    #[inline(always)]
    pub fn is_on(&self) -> bool {
        *self == FSMSTATESELECT_A::ON
    }
    #[doc = "SUSPEND (L2)"]
    #[inline(always)]
    pub fn is_suspend(&self) -> bool {
        *self == FSMSTATESELECT_A::SUSPEND
    }
    #[doc = "SLEEP (L1)"]
    #[inline(always)]
    pub fn is_sleep(&self) -> bool {
        *self == FSMSTATESELECT_A::SLEEP
    }
    #[doc = "DNRESUME. Down Stream Resume."]
    #[inline(always)]
    pub fn is_dnresume(&self) -> bool {
        *self == FSMSTATESELECT_A::DNRESUME
    }
    #[doc = "UPRESUME. Up Stream Resume."]
    #[inline(always)]
    pub fn is_upresume(&self) -> bool {
        *self == FSMSTATESELECT_A::UPRESUME
    }
    #[doc = "RESET. USB lines Reset."]
    #[inline(always)]
    pub fn is_reset(&self) -> bool {
        *self == FSMSTATESELECT_A::RESET
    }
}
impl R {
    #[doc = "Bits 0:6 - Fine State Machine Status"]
    #[inline(always)]
    pub fn fsmstate(&self) -> FSMSTATE_R {
        FSMSTATE_R::new(self.bits & 0x7f)
    }
}
#[doc = "Finite State Machine Status\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`fsmstatus::R`](R).  See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct FSMSTATUS_SPEC;
impl crate::RegisterSpec for FSMSTATUS_SPEC {
    type Ux = u8;
}
#[doc = "`read()` method returns [`fsmstatus::R`](R) reader structure"]
impl crate::Readable for FSMSTATUS_SPEC {}
#[doc = "`reset()` method sets FSMSTATUS to value 0x01"]
impl crate::Resettable for FSMSTATUS_SPEC {
    const RESET_VALUE: Self::Ux = 0x01;
}