Skip to main content

mcxa_pac/dac0/
rcr.rs

1#[doc = "Register `RCR` reader"]
2pub type R = crate::R<RcrSpec>;
3#[doc = "Register `RCR` writer"]
4pub type W = crate::W<RcrSpec>;
5#[doc = "Software Reset\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Swrst {
9    #[doc = "0: No effect"]
10    NoEffect = 0,
11    #[doc = "1: Software reset"]
12    SoftwareReset = 1,
13}
14impl From<Swrst> for bool {
15    #[inline(always)]
16    fn from(variant: Swrst) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `SWRST` reader - Software Reset"]
21pub type SwrstR = crate::BitReader<Swrst>;
22impl SwrstR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Swrst {
26        match self.bits {
27            false => Swrst::NoEffect,
28            true => Swrst::SoftwareReset,
29        }
30    }
31    #[doc = "No effect"]
32    #[inline(always)]
33    pub fn is_no_effect(&self) -> bool {
34        *self == Swrst::NoEffect
35    }
36    #[doc = "Software reset"]
37    #[inline(always)]
38    pub fn is_software_reset(&self) -> bool {
39        *self == Swrst::SoftwareReset
40    }
41}
42#[doc = "Field `SWRST` writer - Software Reset"]
43pub type SwrstW<'a, REG> = crate::BitWriter<'a, REG, Swrst>;
44impl<'a, REG> SwrstW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "No effect"]
49    #[inline(always)]
50    pub fn no_effect(self) -> &'a mut crate::W<REG> {
51        self.variant(Swrst::NoEffect)
52    }
53    #[doc = "Software reset"]
54    #[inline(always)]
55    pub fn software_reset(self) -> &'a mut crate::W<REG> {
56        self.variant(Swrst::SoftwareReset)
57    }
58}
59#[doc = "FIFO Reset\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Fiforst {
63    #[doc = "0: No effect"]
64    NoEffect = 0,
65    #[doc = "1: FIFO reset"]
66    FifoReset = 1,
67}
68impl From<Fiforst> for bool {
69    #[inline(always)]
70    fn from(variant: Fiforst) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `FIFORST` reader - FIFO Reset"]
75pub type FiforstR = crate::BitReader<Fiforst>;
76impl FiforstR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Fiforst {
80        match self.bits {
81            false => Fiforst::NoEffect,
82            true => Fiforst::FifoReset,
83        }
84    }
85    #[doc = "No effect"]
86    #[inline(always)]
87    pub fn is_no_effect(&self) -> bool {
88        *self == Fiforst::NoEffect
89    }
90    #[doc = "FIFO reset"]
91    #[inline(always)]
92    pub fn is_fifo_reset(&self) -> bool {
93        *self == Fiforst::FifoReset
94    }
95}
96#[doc = "Field `FIFORST` writer - FIFO Reset"]
97pub type FiforstW<'a, REG> = crate::BitWriter<'a, REG, Fiforst>;
98impl<'a, REG> FiforstW<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "No effect"]
103    #[inline(always)]
104    pub fn no_effect(self) -> &'a mut crate::W<REG> {
105        self.variant(Fiforst::NoEffect)
106    }
107    #[doc = "FIFO reset"]
108    #[inline(always)]
109    pub fn fifo_reset(self) -> &'a mut crate::W<REG> {
110        self.variant(Fiforst::FifoReset)
111    }
112}
113impl R {
114    #[doc = "Bit 0 - Software Reset"]
115    #[inline(always)]
116    pub fn swrst(&self) -> SwrstR {
117        SwrstR::new((self.bits & 1) != 0)
118    }
119    #[doc = "Bit 1 - FIFO Reset"]
120    #[inline(always)]
121    pub fn fiforst(&self) -> FiforstR {
122        FiforstR::new(((self.bits >> 1) & 1) != 0)
123    }
124}
125#[cfg(feature = "debug")]
126impl core::fmt::Debug for R {
127    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
128        f.debug_struct("RCR")
129            .field("swrst", &self.swrst())
130            .field("fiforst", &self.fiforst())
131            .finish()
132    }
133}
134impl W {
135    #[doc = "Bit 0 - Software Reset"]
136    #[inline(always)]
137    pub fn swrst(&mut self) -> SwrstW<'_, RcrSpec> {
138        SwrstW::new(self, 0)
139    }
140    #[doc = "Bit 1 - FIFO Reset"]
141    #[inline(always)]
142    pub fn fiforst(&mut self) -> FiforstW<'_, RcrSpec> {
143        FiforstW::new(self, 1)
144    }
145}
146#[doc = "Reset Control\n\nYou can [`read`](crate::Reg::read) this register and get [`rcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`rcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
147pub struct RcrSpec;
148impl crate::RegisterSpec for RcrSpec {
149    type Ux = u32;
150}
151#[doc = "`read()` method returns [`rcr::R`](R) reader structure"]
152impl crate::Readable for RcrSpec {}
153#[doc = "`write(|w| ..)` method takes [`rcr::W`](W) writer structure"]
154impl crate::Writable for RcrSpec {
155    type Safety = crate::Unsafe;
156}
157#[doc = "`reset()` method sets RCR to value 0"]
158impl crate::Resettable for RcrSpec {}