atsamd21g/usb/device/
epcfg.rs

1#[doc = "Register `EPCFG%s` reader"]
2pub type R = crate::R<EpcfgSpec>;
3#[doc = "Register `EPCFG%s` writer"]
4pub type W = crate::W<EpcfgSpec>;
5#[doc = "Field `EPTYPE0` reader - End Point Type0"]
6pub type Eptype0R = crate::FieldReader;
7#[doc = "Field `EPTYPE0` writer - End Point Type0"]
8pub type Eptype0W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
9#[doc = "Field `EPTYPE1` reader - End Point Type1"]
10pub type Eptype1R = crate::FieldReader;
11#[doc = "Field `EPTYPE1` writer - End Point Type1"]
12pub type Eptype1W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
13#[doc = "Field `NYETDIS` reader - NYET Token Disable"]
14pub type NyetdisR = crate::BitReader;
15#[doc = "Field `NYETDIS` writer - NYET Token Disable"]
16pub type NyetdisW<'a, REG> = crate::BitWriter<'a, REG>;
17impl R {
18    #[doc = "Bits 0:2 - End Point Type0"]
19    #[inline(always)]
20    pub fn eptype0(&self) -> Eptype0R {
21        Eptype0R::new(self.bits & 7)
22    }
23    #[doc = "Bits 4:6 - End Point Type1"]
24    #[inline(always)]
25    pub fn eptype1(&self) -> Eptype1R {
26        Eptype1R::new((self.bits >> 4) & 7)
27    }
28    #[doc = "Bit 7 - NYET Token Disable"]
29    #[inline(always)]
30    pub fn nyetdis(&self) -> NyetdisR {
31        NyetdisR::new(((self.bits >> 7) & 1) != 0)
32    }
33}
34impl W {
35    #[doc = "Bits 0:2 - End Point Type0"]
36    #[inline(always)]
37    #[must_use]
38    pub fn eptype0(&mut self) -> Eptype0W<EpcfgSpec> {
39        Eptype0W::new(self, 0)
40    }
41    #[doc = "Bits 4:6 - End Point Type1"]
42    #[inline(always)]
43    #[must_use]
44    pub fn eptype1(&mut self) -> Eptype1W<EpcfgSpec> {
45        Eptype1W::new(self, 4)
46    }
47    #[doc = "Bit 7 - NYET Token Disable"]
48    #[inline(always)]
49    #[must_use]
50    pub fn nyetdis(&mut self) -> NyetdisW<EpcfgSpec> {
51        NyetdisW::new(self, 7)
52    }
53}
54#[doc = "DEVICE End Point Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`epcfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`epcfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
55pub struct EpcfgSpec;
56impl crate::RegisterSpec for EpcfgSpec {
57    type Ux = u8;
58}
59#[doc = "`read()` method returns [`epcfg::R`](R) reader structure"]
60impl crate::Readable for EpcfgSpec {}
61#[doc = "`write(|w| ..)` method takes [`epcfg::W`](W) writer structure"]
62impl crate::Writable for EpcfgSpec {
63    type Safety = crate::Unsafe;
64    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
65    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
66}
67#[doc = "`reset()` method sets EPCFG%s to value 0"]
68impl crate::Resettable for EpcfgSpec {
69    const RESET_VALUE: u8 = 0;
70}