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