Skip to main content

mcxa_pac/flexio0/
ctrl.rs

1#[doc = "Register `CTRL` reader"]
2pub type R = crate::R<CtrlSpec>;
3#[doc = "Register `CTRL` writer"]
4pub type W = crate::W<CtrlSpec>;
5#[doc = "FLEXIO Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Flexen {
9    #[doc = "0: Disable"]
10    Disable = 0,
11    #[doc = "1: Enable"]
12    Enable = 1,
13}
14impl From<Flexen> for bool {
15    #[inline(always)]
16    fn from(variant: Flexen) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `FLEXEN` reader - FLEXIO Enable"]
21pub type FlexenR = crate::BitReader<Flexen>;
22impl FlexenR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Flexen {
26        match self.bits {
27            false => Flexen::Disable,
28            true => Flexen::Enable,
29        }
30    }
31    #[doc = "Disable"]
32    #[inline(always)]
33    pub fn is_disable(&self) -> bool {
34        *self == Flexen::Disable
35    }
36    #[doc = "Enable"]
37    #[inline(always)]
38    pub fn is_enable(&self) -> bool {
39        *self == Flexen::Enable
40    }
41}
42#[doc = "Field `FLEXEN` writer - FLEXIO Enable"]
43pub type FlexenW<'a, REG> = crate::BitWriter<'a, REG, Flexen>;
44impl<'a, REG> FlexenW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Disable"]
49    #[inline(always)]
50    pub fn disable(self) -> &'a mut crate::W<REG> {
51        self.variant(Flexen::Disable)
52    }
53    #[doc = "Enable"]
54    #[inline(always)]
55    pub fn enable(self) -> &'a mut crate::W<REG> {
56        self.variant(Flexen::Enable)
57    }
58}
59#[doc = "Software Reset\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Swrst {
63    #[doc = "0: Disabled"]
64    Disable = 0,
65    #[doc = "1: Enabled"]
66    Enable = 1,
67}
68impl From<Swrst> for bool {
69    #[inline(always)]
70    fn from(variant: Swrst) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `SWRST` reader - Software Reset"]
75pub type SwrstR = crate::BitReader<Swrst>;
76impl SwrstR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Swrst {
80        match self.bits {
81            false => Swrst::Disable,
82            true => Swrst::Enable,
83        }
84    }
85    #[doc = "Disabled"]
86    #[inline(always)]
87    pub fn is_disable(&self) -> bool {
88        *self == Swrst::Disable
89    }
90    #[doc = "Enabled"]
91    #[inline(always)]
92    pub fn is_enable(&self) -> bool {
93        *self == Swrst::Enable
94    }
95}
96#[doc = "Field `SWRST` writer - Software Reset"]
97pub type SwrstW<'a, REG> = crate::BitWriter<'a, REG, Swrst>;
98impl<'a, REG> SwrstW<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "Disabled"]
103    #[inline(always)]
104    pub fn disable(self) -> &'a mut crate::W<REG> {
105        self.variant(Swrst::Disable)
106    }
107    #[doc = "Enabled"]
108    #[inline(always)]
109    pub fn enable(self) -> &'a mut crate::W<REG> {
110        self.variant(Swrst::Enable)
111    }
112}
113#[doc = "Fast Access\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Fastacc {
117    #[doc = "0: Normal"]
118    Normal = 0,
119    #[doc = "1: Fast"]
120    Fast = 1,
121}
122impl From<Fastacc> for bool {
123    #[inline(always)]
124    fn from(variant: Fastacc) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `FASTACC` reader - Fast Access"]
129pub type FastaccR = crate::BitReader<Fastacc>;
130impl FastaccR {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub const fn variant(&self) -> Fastacc {
134        match self.bits {
135            false => Fastacc::Normal,
136            true => Fastacc::Fast,
137        }
138    }
139    #[doc = "Normal"]
140    #[inline(always)]
141    pub fn is_normal(&self) -> bool {
142        *self == Fastacc::Normal
143    }
144    #[doc = "Fast"]
145    #[inline(always)]
146    pub fn is_fast(&self) -> bool {
147        *self == Fastacc::Fast
148    }
149}
150#[doc = "Field `FASTACC` writer - Fast Access"]
151pub type FastaccW<'a, REG> = crate::BitWriter<'a, REG, Fastacc>;
152impl<'a, REG> FastaccW<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155{
156    #[doc = "Normal"]
157    #[inline(always)]
158    pub fn normal(self) -> &'a mut crate::W<REG> {
159        self.variant(Fastacc::Normal)
160    }
161    #[doc = "Fast"]
162    #[inline(always)]
163    pub fn fast(self) -> &'a mut crate::W<REG> {
164        self.variant(Fastacc::Fast)
165    }
166}
167#[doc = "Debug Enable\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Dbge {
171    #[doc = "0: Disable"]
172    Disable = 0,
173    #[doc = "1: Enable"]
174    Emable = 1,
175}
176impl From<Dbge> for bool {
177    #[inline(always)]
178    fn from(variant: Dbge) -> Self {
179        variant as u8 != 0
180    }
181}
182#[doc = "Field `DBGE` reader - Debug Enable"]
183pub type DbgeR = crate::BitReader<Dbge>;
184impl DbgeR {
185    #[doc = "Get enumerated values variant"]
186    #[inline(always)]
187    pub const fn variant(&self) -> Dbge {
188        match self.bits {
189            false => Dbge::Disable,
190            true => Dbge::Emable,
191        }
192    }
193    #[doc = "Disable"]
194    #[inline(always)]
195    pub fn is_disable(&self) -> bool {
196        *self == Dbge::Disable
197    }
198    #[doc = "Enable"]
199    #[inline(always)]
200    pub fn is_emable(&self) -> bool {
201        *self == Dbge::Emable
202    }
203}
204#[doc = "Field `DBGE` writer - Debug Enable"]
205pub type DbgeW<'a, REG> = crate::BitWriter<'a, REG, Dbge>;
206impl<'a, REG> DbgeW<'a, REG>
207where
208    REG: crate::Writable + crate::RegisterSpec,
209{
210    #[doc = "Disable"]
211    #[inline(always)]
212    pub fn disable(self) -> &'a mut crate::W<REG> {
213        self.variant(Dbge::Disable)
214    }
215    #[doc = "Enable"]
216    #[inline(always)]
217    pub fn emable(self) -> &'a mut crate::W<REG> {
218        self.variant(Dbge::Emable)
219    }
220}
221#[doc = "Doze Enable\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum Dozen {
225    #[doc = "0: Enable"]
226    Enable = 0,
227    #[doc = "1: Disable"]
228    Disable = 1,
229}
230impl From<Dozen> for bool {
231    #[inline(always)]
232    fn from(variant: Dozen) -> Self {
233        variant as u8 != 0
234    }
235}
236#[doc = "Field `DOZEN` reader - Doze Enable"]
237pub type DozenR = crate::BitReader<Dozen>;
238impl DozenR {
239    #[doc = "Get enumerated values variant"]
240    #[inline(always)]
241    pub const fn variant(&self) -> Dozen {
242        match self.bits {
243            false => Dozen::Enable,
244            true => Dozen::Disable,
245        }
246    }
247    #[doc = "Enable"]
248    #[inline(always)]
249    pub fn is_enable(&self) -> bool {
250        *self == Dozen::Enable
251    }
252    #[doc = "Disable"]
253    #[inline(always)]
254    pub fn is_disable(&self) -> bool {
255        *self == Dozen::Disable
256    }
257}
258#[doc = "Field `DOZEN` writer - Doze Enable"]
259pub type DozenW<'a, REG> = crate::BitWriter<'a, REG, Dozen>;
260impl<'a, REG> DozenW<'a, REG>
261where
262    REG: crate::Writable + crate::RegisterSpec,
263{
264    #[doc = "Enable"]
265    #[inline(always)]
266    pub fn enable(self) -> &'a mut crate::W<REG> {
267        self.variant(Dozen::Enable)
268    }
269    #[doc = "Disable"]
270    #[inline(always)]
271    pub fn disable(self) -> &'a mut crate::W<REG> {
272        self.variant(Dozen::Disable)
273    }
274}
275impl R {
276    #[doc = "Bit 0 - FLEXIO Enable"]
277    #[inline(always)]
278    pub fn flexen(&self) -> FlexenR {
279        FlexenR::new((self.bits & 1) != 0)
280    }
281    #[doc = "Bit 1 - Software Reset"]
282    #[inline(always)]
283    pub fn swrst(&self) -> SwrstR {
284        SwrstR::new(((self.bits >> 1) & 1) != 0)
285    }
286    #[doc = "Bit 2 - Fast Access"]
287    #[inline(always)]
288    pub fn fastacc(&self) -> FastaccR {
289        FastaccR::new(((self.bits >> 2) & 1) != 0)
290    }
291    #[doc = "Bit 30 - Debug Enable"]
292    #[inline(always)]
293    pub fn dbge(&self) -> DbgeR {
294        DbgeR::new(((self.bits >> 30) & 1) != 0)
295    }
296    #[doc = "Bit 31 - Doze Enable"]
297    #[inline(always)]
298    pub fn dozen(&self) -> DozenR {
299        DozenR::new(((self.bits >> 31) & 1) != 0)
300    }
301}
302#[cfg(feature = "debug")]
303impl core::fmt::Debug for R {
304    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
305        f.debug_struct("CTRL")
306            .field("flexen", &self.flexen())
307            .field("swrst", &self.swrst())
308            .field("fastacc", &self.fastacc())
309            .field("dbge", &self.dbge())
310            .field("dozen", &self.dozen())
311            .finish()
312    }
313}
314impl W {
315    #[doc = "Bit 0 - FLEXIO Enable"]
316    #[inline(always)]
317    pub fn flexen(&mut self) -> FlexenW<'_, CtrlSpec> {
318        FlexenW::new(self, 0)
319    }
320    #[doc = "Bit 1 - Software Reset"]
321    #[inline(always)]
322    pub fn swrst(&mut self) -> SwrstW<'_, CtrlSpec> {
323        SwrstW::new(self, 1)
324    }
325    #[doc = "Bit 2 - Fast Access"]
326    #[inline(always)]
327    pub fn fastacc(&mut self) -> FastaccW<'_, CtrlSpec> {
328        FastaccW::new(self, 2)
329    }
330    #[doc = "Bit 30 - Debug Enable"]
331    #[inline(always)]
332    pub fn dbge(&mut self) -> DbgeW<'_, CtrlSpec> {
333        DbgeW::new(self, 30)
334    }
335    #[doc = "Bit 31 - Doze Enable"]
336    #[inline(always)]
337    pub fn dozen(&mut self) -> DozenW<'_, CtrlSpec> {
338        DozenW::new(self, 31)
339    }
340}
341#[doc = "FLEXIO Control\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
342pub struct CtrlSpec;
343impl crate::RegisterSpec for CtrlSpec {
344    type Ux = u32;
345}
346#[doc = "`read()` method returns [`ctrl::R`](R) reader structure"]
347impl crate::Readable for CtrlSpec {}
348#[doc = "`write(|w| ..)` method takes [`ctrl::W`](W) writer structure"]
349impl crate::Writable for CtrlSpec {
350    type Safety = crate::Unsafe;
351}
352#[doc = "`reset()` method sets CTRL to value 0"]
353impl crate::Resettable for CtrlSpec {}