gd32c1/gd32c103/usbfs_device/
dstat.rs

1#[doc = "Register `DSTAT` reader"]
2pub type R = crate::R<DstatSpec>;
3#[doc = "Field `SPST` reader - Suspend status"]
4pub type SpstR = crate::BitReader;
5#[doc = "Field `ES` reader - Enumerated speed"]
6pub type EsR = crate::FieldReader;
7#[doc = "Field `FNRSOF` reader - Frame number of the received SOF"]
8pub type FnrsofR = crate::FieldReader<u16>;
9impl R {
10    #[doc = "Bit 0 - Suspend status"]
11    #[inline(always)]
12    pub fn spst(&self) -> SpstR {
13        SpstR::new((self.bits & 1) != 0)
14    }
15    #[doc = "Bits 1:2 - Enumerated speed"]
16    #[inline(always)]
17    pub fn es(&self) -> EsR {
18        EsR::new(((self.bits >> 1) & 3) as u8)
19    }
20    #[doc = "Bits 8:21 - Frame number of the received SOF"]
21    #[inline(always)]
22    pub fn fnrsof(&self) -> FnrsofR {
23        FnrsofR::new(((self.bits >> 8) & 0x3fff) as u16)
24    }
25}
26#[doc = "device status register (DSTAT)\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`dstat::R`](R).  See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
27pub struct DstatSpec;
28impl crate::RegisterSpec for DstatSpec {
29    type Ux = u32;
30}
31#[doc = "`read()` method returns [`dstat::R`](R) reader structure"]
32impl crate::Readable for DstatSpec {}
33#[doc = "`reset()` method sets DSTAT to value 0"]
34impl crate::Resettable for DstatSpec {
35    const RESET_VALUE: u32 = 0;
36}