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
#[doc = "Reader of register LPMATTR"]
pub type R = crate::R<u16, super::LPMATTR>;
#[doc = "Link State\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LS_A {
    #[doc = "1: Sleep State (L1)"]
    L1,
}
impl From<LS_A> for u8 {
    #[inline(always)]
    fn from(variant: LS_A) -> Self {
        match variant {
            LS_A::L1 => 1,
        }
    }
}
#[doc = "Reader of field `LS`"]
pub type LS_R = crate::R<u8, LS_A>;
impl LS_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, LS_A> {
        use crate::Variant::*;
        match self.bits {
            1 => Val(LS_A::L1),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `L1`"]
    #[inline(always)]
    pub fn is_l1(&self) -> bool {
        *self == LS_A::L1
    }
}
#[doc = "Reader of field `HIRD`"]
pub type HIRD_R = crate::R<u8, u8>;
#[doc = "Reader of field `RMTWAK`"]
pub type RMTWAK_R = crate::R<bool, bool>;
#[doc = "Reader of field `ENDPT`"]
pub type ENDPT_R = crate::R<u8, u8>;
impl R {
    #[doc = "Bits 0:3 - Link State"]
    #[inline(always)]
    pub fn ls(&self) -> LS_R {
        LS_R::new((self.bits & 0x0f) as u8)
    }
    #[doc = "Bits 4:7 - Host Initiated Resume Duration"]
    #[inline(always)]
    pub fn hird(&self) -> HIRD_R {
        HIRD_R::new(((self.bits >> 4) & 0x0f) as u8)
    }
    #[doc = "Bit 8 - Remote Wake"]
    #[inline(always)]
    pub fn rmtwak(&self) -> RMTWAK_R {
        RMTWAK_R::new(((self.bits >> 8) & 0x01) != 0)
    }
    #[doc = "Bits 12:15 - Endpoint"]
    #[inline(always)]
    pub fn endpt(&self) -> ENDPT_R {
        ENDPT_R::new(((self.bits >> 12) & 0x0f) as u8)
    }
}