d1_pac/audio_codec/
vra1speedup_ctrl.rs

1#[doc = "Register `vra1speedup_ctrl` reader"]
2pub type R = crate::R<VRA1SPEEDUP_CTRL_SPEC>;
3#[doc = "Register `vra1speedup_ctrl` writer"]
4pub type W = crate::W<VRA1SPEEDUP_CTRL_SPEC>;
5#[doc = "Field `vra1speedup_rst_ctrl` reader - VAR1Speedup Down RST Manual Control Enable"]
6pub type VRA1SPEEDUP_RST_CTRL_R = crate::BitReader<VRA1SPEEDUP_RST_CTRL_A>;
7#[doc = "VAR1Speedup Down RST Manual Control Enable\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum VRA1SPEEDUP_RST_CTRL_A {
10    #[doc = "0: Disabled.\n\nVAR1Speedup Down converts to 1 after the bus rst releases 32 ms."]
11    DISABLED = 0,
12    #[doc = "1: Enabled.\n\nVAR1Speedup Down reset 0 immediately."]
13    ENABLED = 1,
14}
15impl From<VRA1SPEEDUP_RST_CTRL_A> for bool {
16    #[inline(always)]
17    fn from(variant: VRA1SPEEDUP_RST_CTRL_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl VRA1SPEEDUP_RST_CTRL_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> VRA1SPEEDUP_RST_CTRL_A {
25        match self.bits {
26            false => VRA1SPEEDUP_RST_CTRL_A::DISABLED,
27            true => VRA1SPEEDUP_RST_CTRL_A::ENABLED,
28        }
29    }
30    #[doc = "Disabled.\n\nVAR1Speedup Down converts to 1 after the bus rst releases 32 ms."]
31    #[inline(always)]
32    pub fn is_disabled(&self) -> bool {
33        *self == VRA1SPEEDUP_RST_CTRL_A::DISABLED
34    }
35    #[doc = "Enabled.\n\nVAR1Speedup Down reset 0 immediately."]
36    #[inline(always)]
37    pub fn is_enabled(&self) -> bool {
38        *self == VRA1SPEEDUP_RST_CTRL_A::ENABLED
39    }
40}
41#[doc = "Field `vra1speedup_rst_ctrl` writer - VAR1Speedup Down RST Manual Control Enable"]
42pub type VRA1SPEEDUP_RST_CTRL_W<'a, REG> = crate::BitWriter<'a, REG, VRA1SPEEDUP_RST_CTRL_A>;
43impl<'a, REG> VRA1SPEEDUP_RST_CTRL_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "Disabled.\n\nVAR1Speedup Down converts to 1 after the bus rst releases 32 ms."]
48    #[inline(always)]
49    pub fn disabled(self) -> &'a mut crate::W<REG> {
50        self.variant(VRA1SPEEDUP_RST_CTRL_A::DISABLED)
51    }
52    #[doc = "Enabled.\n\nVAR1Speedup Down reset 0 immediately."]
53    #[inline(always)]
54    pub fn enabled(self) -> &'a mut crate::W<REG> {
55        self.variant(VRA1SPEEDUP_RST_CTRL_A::ENABLED)
56    }
57}
58#[doc = "Field `vra1speedup_ctrl` reader - VAR1Speedup Down Manual Control Enable"]
59pub type VRA1SPEEDUP_CTRL_R = crate::BitReader<VRA1SPEEDUP_CTRL_A>;
60#[doc = "VAR1Speedup Down Manual Control Enable\n\nValue on reset: 0"]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum VRA1SPEEDUP_CTRL_A {
63    #[doc = "0: Disabled.\n\nVAR1Speedup Down converts to 1 after the bus rst releases 32 ms."]
64    DISABLED = 0,
65    #[doc = "1: Enabled.\n\nVAR1Speedup Down converts to 1 immediately."]
66    ENABLED = 1,
67}
68impl From<VRA1SPEEDUP_CTRL_A> for bool {
69    #[inline(always)]
70    fn from(variant: VRA1SPEEDUP_CTRL_A) -> Self {
71        variant as u8 != 0
72    }
73}
74impl VRA1SPEEDUP_CTRL_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> VRA1SPEEDUP_CTRL_A {
78        match self.bits {
79            false => VRA1SPEEDUP_CTRL_A::DISABLED,
80            true => VRA1SPEEDUP_CTRL_A::ENABLED,
81        }
82    }
83    #[doc = "Disabled.\n\nVAR1Speedup Down converts to 1 after the bus rst releases 32 ms."]
84    #[inline(always)]
85    pub fn is_disabled(&self) -> bool {
86        *self == VRA1SPEEDUP_CTRL_A::DISABLED
87    }
88    #[doc = "Enabled.\n\nVAR1Speedup Down converts to 1 immediately."]
89    #[inline(always)]
90    pub fn is_enabled(&self) -> bool {
91        *self == VRA1SPEEDUP_CTRL_A::ENABLED
92    }
93}
94#[doc = "Field `vra1speedup_ctrl` writer - VAR1Speedup Down Manual Control Enable"]
95pub type VRA1SPEEDUP_CTRL_W<'a, REG> = crate::BitWriter<'a, REG, VRA1SPEEDUP_CTRL_A>;
96impl<'a, REG> VRA1SPEEDUP_CTRL_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "Disabled.\n\nVAR1Speedup Down converts to 1 after the bus rst releases 32 ms."]
101    #[inline(always)]
102    pub fn disabled(self) -> &'a mut crate::W<REG> {
103        self.variant(VRA1SPEEDUP_CTRL_A::DISABLED)
104    }
105    #[doc = "Enabled.\n\nVAR1Speedup Down converts to 1 immediately."]
106    #[inline(always)]
107    pub fn enabled(self) -> &'a mut crate::W<REG> {
108        self.variant(VRA1SPEEDUP_CTRL_A::ENABLED)
109    }
110}
111#[doc = "Field `vra1speedup_state` reader - Only if VAR1SPEEDUP_Further_CTRL (0x310\\[22\\]) is set 0, VAR1Speedup Down State is valid."]
112pub type VRA1SPEEDUP_STATE_R = crate::BitReader<VRA1SPEEDUP_STATE_A>;
113#[doc = "Only if VAR1SPEEDUP_Further_CTRL (0x310\\[22\\]) is set 0, VAR1Speedup Down State is valid.\n\nValue on reset: 0"]
114#[derive(Clone, Copy, Debug, PartialEq, Eq)]
115pub enum VRA1SPEEDUP_STATE_A {
116    #[doc = "0: VAR1Speedup_Down does not work."]
117    NOT_WORK = 0,
118    #[doc = "1: VAR1Speedup_Down works."]
119    WORK = 1,
120}
121impl From<VRA1SPEEDUP_STATE_A> for bool {
122    #[inline(always)]
123    fn from(variant: VRA1SPEEDUP_STATE_A) -> Self {
124        variant as u8 != 0
125    }
126}
127impl VRA1SPEEDUP_STATE_R {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> VRA1SPEEDUP_STATE_A {
131        match self.bits {
132            false => VRA1SPEEDUP_STATE_A::NOT_WORK,
133            true => VRA1SPEEDUP_STATE_A::WORK,
134        }
135    }
136    #[doc = "VAR1Speedup_Down does not work."]
137    #[inline(always)]
138    pub fn is_not_work(&self) -> bool {
139        *self == VRA1SPEEDUP_STATE_A::NOT_WORK
140    }
141    #[doc = "VAR1Speedup_Down works."]
142    #[inline(always)]
143    pub fn is_work(&self) -> bool {
144        *self == VRA1SPEEDUP_STATE_A::WORK
145    }
146}
147impl R {
148    #[doc = "Bit 0 - VAR1Speedup Down RST Manual Control Enable"]
149    #[inline(always)]
150    pub fn vra1speedup_rst_ctrl(&self) -> VRA1SPEEDUP_RST_CTRL_R {
151        VRA1SPEEDUP_RST_CTRL_R::new((self.bits & 1) != 0)
152    }
153    #[doc = "Bit 1 - VAR1Speedup Down Manual Control Enable"]
154    #[inline(always)]
155    pub fn vra1speedup_ctrl(&self) -> VRA1SPEEDUP_CTRL_R {
156        VRA1SPEEDUP_CTRL_R::new(((self.bits >> 1) & 1) != 0)
157    }
158    #[doc = "Bit 4 - Only if VAR1SPEEDUP_Further_CTRL (0x310\\[22\\]) is set 0, VAR1Speedup Down State is valid."]
159    #[inline(always)]
160    pub fn vra1speedup_state(&self) -> VRA1SPEEDUP_STATE_R {
161        VRA1SPEEDUP_STATE_R::new(((self.bits >> 4) & 1) != 0)
162    }
163}
164impl W {
165    #[doc = "Bit 0 - VAR1Speedup Down RST Manual Control Enable"]
166    #[inline(always)]
167    #[must_use]
168    pub fn vra1speedup_rst_ctrl(&mut self) -> VRA1SPEEDUP_RST_CTRL_W<VRA1SPEEDUP_CTRL_SPEC> {
169        VRA1SPEEDUP_RST_CTRL_W::new(self, 0)
170    }
171    #[doc = "Bit 1 - VAR1Speedup Down Manual Control Enable"]
172    #[inline(always)]
173    #[must_use]
174    pub fn vra1speedup_ctrl(&mut self) -> VRA1SPEEDUP_CTRL_W<VRA1SPEEDUP_CTRL_SPEC> {
175        VRA1SPEEDUP_CTRL_W::new(self, 1)
176    }
177    #[doc = r" Writes raw bits to the register."]
178    #[doc = r""]
179    #[doc = r" # Safety"]
180    #[doc = r""]
181    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
182    #[inline(always)]
183    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
184        self.bits = bits;
185        self
186    }
187}
188#[doc = "VRA1 Speedup Down Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`vra1speedup_ctrl::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`vra1speedup_ctrl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
189pub struct VRA1SPEEDUP_CTRL_SPEC;
190impl crate::RegisterSpec for VRA1SPEEDUP_CTRL_SPEC {
191    type Ux = u32;
192}
193#[doc = "`read()` method returns [`vra1speedup_ctrl::R`](R) reader structure"]
194impl crate::Readable for VRA1SPEEDUP_CTRL_SPEC {}
195#[doc = "`write(|w| ..)` method takes [`vra1speedup_ctrl::W`](W) writer structure"]
196impl crate::Writable for VRA1SPEEDUP_CTRL_SPEC {
197    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
198    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
199}
200#[doc = "`reset()` method sets vra1speedup_ctrl to value 0"]
201impl crate::Resettable for VRA1SPEEDUP_CTRL_SPEC {
202    const RESET_VALUE: Self::Ux = 0;
203}