moondancer_pac/generated/usb2/
control.rs

1#[doc = "Register `control` reader"]
2pub type R = crate::R<CONTROL_SPEC>;
3#[doc = "Register `control` writer"]
4pub type W = crate::W<CONTROL_SPEC>;
5#[doc = "Field `connect` reader - connect field"]
6pub type CONNECT_R = crate::BitReader;
7#[doc = "Field `connect` writer - connect field"]
8pub type CONNECT_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `_0` reader - _0 field"]
10pub type _0_R = crate::FieldReader;
11#[doc = "Field `_0` writer - _0 field"]
12pub type _0_W<'a, REG> = crate::FieldWriter<'a, REG, 7>;
13#[doc = "Field `low_speed_only` reader - low_speed_only field"]
14pub type LOW_SPEED_ONLY_R = crate::BitReader;
15#[doc = "Field `low_speed_only` writer - low_speed_only field"]
16pub type LOW_SPEED_ONLY_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `full_speed_only` reader - full_speed_only field"]
18pub type FULL_SPEED_ONLY_R = crate::BitReader;
19#[doc = "Field `full_speed_only` writer - full_speed_only field"]
20pub type FULL_SPEED_ONLY_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `_1` reader - _1 field"]
22pub type _1_R = crate::FieldReader;
23#[doc = "Field `_1` writer - _1 field"]
24pub type _1_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
25impl R {
26    #[doc = "Bit 0 - connect field"]
27    #[inline(always)]
28    pub fn connect(&self) -> CONNECT_R {
29        CONNECT_R::new((self.bits & 1) != 0)
30    }
31    #[doc = "Bits 1:7 - _0 field"]
32    #[inline(always)]
33    pub fn _0(&self) -> _0_R {
34        _0_R::new(((self.bits >> 1) & 0x7f) as u8)
35    }
36    #[doc = "Bit 8 - low_speed_only field"]
37    #[inline(always)]
38    pub fn low_speed_only(&self) -> LOW_SPEED_ONLY_R {
39        LOW_SPEED_ONLY_R::new(((self.bits >> 8) & 1) != 0)
40    }
41    #[doc = "Bit 9 - full_speed_only field"]
42    #[inline(always)]
43    pub fn full_speed_only(&self) -> FULL_SPEED_ONLY_R {
44        FULL_SPEED_ONLY_R::new(((self.bits >> 9) & 1) != 0)
45    }
46    #[doc = "Bits 10:15 - _1 field"]
47    #[inline(always)]
48    pub fn _1(&self) -> _1_R {
49        _1_R::new(((self.bits >> 10) & 0x3f) as u8)
50    }
51}
52impl W {
53    #[doc = "Bit 0 - connect field"]
54    #[inline(always)]
55    pub fn connect(&mut self) -> CONNECT_W<CONTROL_SPEC> {
56        CONNECT_W::new(self, 0)
57    }
58    #[doc = "Bits 1:7 - _0 field"]
59    #[inline(always)]
60    pub fn _0(&mut self) -> _0_W<CONTROL_SPEC> {
61        _0_W::new(self, 1)
62    }
63    #[doc = "Bit 8 - low_speed_only field"]
64    #[inline(always)]
65    pub fn low_speed_only(&mut self) -> LOW_SPEED_ONLY_W<CONTROL_SPEC> {
66        LOW_SPEED_ONLY_W::new(self, 8)
67    }
68    #[doc = "Bit 9 - full_speed_only field"]
69    #[inline(always)]
70    pub fn full_speed_only(&mut self) -> FULL_SPEED_ONLY_W<CONTROL_SPEC> {
71        FULL_SPEED_ONLY_W::new(self, 9)
72    }
73    #[doc = "Bits 10:15 - _1 field"]
74    #[inline(always)]
75    pub fn _1(&mut self) -> _1_W<CONTROL_SPEC> {
76        _1_W::new(self, 10)
77    }
78}
79#[doc = "Control register connect: Set this bit to '1' to allow the associated USB device to connect to a host. low_speed_only: Set this bit to '1' to force the device to operate at low speed. full_speed_only: Set this bit to '1' to force the device to operate at full speed.\n\nYou can [`read`](crate::Reg::read) this register and get [`control::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`control::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
80pub struct CONTROL_SPEC;
81impl crate::RegisterSpec for CONTROL_SPEC {
82    type Ux = u16;
83}
84#[doc = "`read()` method returns [`control::R`](R) reader structure"]
85impl crate::Readable for CONTROL_SPEC {}
86#[doc = "`write(|w| ..)` method takes [`control::W`](W) writer structure"]
87impl crate::Writable for CONTROL_SPEC {
88    type Safety = crate::Unsafe;
89    const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
90    const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
91}
92#[doc = "`reset()` method sets control to value 0"]
93impl crate::Resettable for CONTROL_SPEC {
94    const RESET_VALUE: u16 = 0;
95}