atsamd11c/usb/device/
status.rs

1#[doc = "Register `STATUS` reader"]
2pub type R = crate::R<StatusSpec>;
3#[doc = "Speed Status\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5#[repr(u8)]
6pub enum Speedselect {
7    #[doc = "0: Full-speed mode"]
8    Fs = 0,
9    #[doc = "1: High-speed mode"]
10    Hs = 1,
11    #[doc = "2: Low-speed mode"]
12    Ls = 2,
13}
14impl From<Speedselect> for u8 {
15    #[inline(always)]
16    fn from(variant: Speedselect) -> Self {
17        variant as _
18    }
19}
20impl crate::FieldSpec for Speedselect {
21    type Ux = u8;
22}
23impl crate::IsEnum for Speedselect {}
24#[doc = "Field `SPEED` reader - Speed Status"]
25pub type SpeedR = crate::FieldReader<Speedselect>;
26impl SpeedR {
27    #[doc = "Get enumerated values variant"]
28    #[inline(always)]
29    pub const fn variant(&self) -> Option<Speedselect> {
30        match self.bits {
31            0 => Some(Speedselect::Fs),
32            1 => Some(Speedselect::Hs),
33            2 => Some(Speedselect::Ls),
34            _ => None,
35        }
36    }
37    #[doc = "Full-speed mode"]
38    #[inline(always)]
39    pub fn is_fs(&self) -> bool {
40        *self == Speedselect::Fs
41    }
42    #[doc = "High-speed mode"]
43    #[inline(always)]
44    pub fn is_hs(&self) -> bool {
45        *self == Speedselect::Hs
46    }
47    #[doc = "Low-speed mode"]
48    #[inline(always)]
49    pub fn is_ls(&self) -> bool {
50        *self == Speedselect::Ls
51    }
52}
53#[doc = "USB Line State Status\n\nValue on reset: 1"]
54#[derive(Clone, Copy, Debug, PartialEq, Eq)]
55#[repr(u8)]
56pub enum Linestateselect {
57    #[doc = "0: SE0/RESET"]
58    _0 = 0,
59    #[doc = "1: FS-J or LS-K State"]
60    _1 = 1,
61    #[doc = "2: FS-K or LS-J State"]
62    _2 = 2,
63}
64impl From<Linestateselect> for u8 {
65    #[inline(always)]
66    fn from(variant: Linestateselect) -> Self {
67        variant as _
68    }
69}
70impl crate::FieldSpec for Linestateselect {
71    type Ux = u8;
72}
73impl crate::IsEnum for Linestateselect {}
74#[doc = "Field `LINESTATE` reader - USB Line State Status"]
75pub type LinestateR = crate::FieldReader<Linestateselect>;
76impl LinestateR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Option<Linestateselect> {
80        match self.bits {
81            0 => Some(Linestateselect::_0),
82            1 => Some(Linestateselect::_1),
83            2 => Some(Linestateselect::_2),
84            _ => None,
85        }
86    }
87    #[doc = "SE0/RESET"]
88    #[inline(always)]
89    pub fn is_0(&self) -> bool {
90        *self == Linestateselect::_0
91    }
92    #[doc = "FS-J or LS-K State"]
93    #[inline(always)]
94    pub fn is_1(&self) -> bool {
95        *self == Linestateselect::_1
96    }
97    #[doc = "FS-K or LS-J State"]
98    #[inline(always)]
99    pub fn is_2(&self) -> bool {
100        *self == Linestateselect::_2
101    }
102}
103impl R {
104    #[doc = "Bits 2:3 - Speed Status"]
105    #[inline(always)]
106    pub fn speed(&self) -> SpeedR {
107        SpeedR::new((self.bits >> 2) & 3)
108    }
109    #[doc = "Bits 6:7 - USB Line State Status"]
110    #[inline(always)]
111    pub fn linestate(&self) -> LinestateR {
112        LinestateR::new((self.bits >> 6) & 3)
113    }
114}
115#[doc = "DEVICE Status\n\nYou can [`read`](crate::Reg::read) this register and get [`status::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
116pub struct StatusSpec;
117impl crate::RegisterSpec for StatusSpec {
118    type Ux = u8;
119}
120#[doc = "`read()` method returns [`status::R`](R) reader structure"]
121impl crate::Readable for StatusSpec {}
122#[doc = "`reset()` method sets STATUS to value 0x40"]
123impl crate::Resettable for StatusSpec {
124    const RESET_VALUE: u8 = 0x40;
125}