mcxa_pac/lpspi0/
cr.rs

1#[doc = "Register `CR` reader"]
2pub type R = crate::R<CrSpec>;
3#[doc = "Register `CR` writer"]
4pub type W = crate::W<CrSpec>;
5#[doc = "Module Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Men {
9    #[doc = "0: Disable"]
10    Disabled = 0,
11    #[doc = "1: Enable"]
12    Enabled = 1,
13}
14impl From<Men> for bool {
15    #[inline(always)]
16    fn from(variant: Men) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `MEN` reader - Module Enable"]
21pub type MenR = crate::BitReader<Men>;
22impl MenR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Men {
26        match self.bits {
27            false => Men::Disabled,
28            true => Men::Enabled,
29        }
30    }
31    #[doc = "Disable"]
32    #[inline(always)]
33    pub fn is_disabled(&self) -> bool {
34        *self == Men::Disabled
35    }
36    #[doc = "Enable"]
37    #[inline(always)]
38    pub fn is_enabled(&self) -> bool {
39        *self == Men::Enabled
40    }
41}
42#[doc = "Field `MEN` writer - Module Enable"]
43pub type MenW<'a, REG> = crate::BitWriter<'a, REG, Men>;
44impl<'a, REG> MenW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Disable"]
49    #[inline(always)]
50    pub fn disabled(self) -> &'a mut crate::W<REG> {
51        self.variant(Men::Disabled)
52    }
53    #[doc = "Enable"]
54    #[inline(always)]
55    pub fn enabled(self) -> &'a mut crate::W<REG> {
56        self.variant(Men::Enabled)
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 Rst {
63    #[doc = "0: Not reset"]
64    NotReset = 0,
65    #[doc = "1: Reset"]
66    Reset = 1,
67}
68impl From<Rst> for bool {
69    #[inline(always)]
70    fn from(variant: Rst) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `RST` reader - Software Reset"]
75pub type RstR = crate::BitReader<Rst>;
76impl RstR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Rst {
80        match self.bits {
81            false => Rst::NotReset,
82            true => Rst::Reset,
83        }
84    }
85    #[doc = "Not reset"]
86    #[inline(always)]
87    pub fn is_not_reset(&self) -> bool {
88        *self == Rst::NotReset
89    }
90    #[doc = "Reset"]
91    #[inline(always)]
92    pub fn is_reset(&self) -> bool {
93        *self == Rst::Reset
94    }
95}
96#[doc = "Field `RST` writer - Software Reset"]
97pub type RstW<'a, REG> = crate::BitWriter<'a, REG, Rst>;
98impl<'a, REG> RstW<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "Not reset"]
103    #[inline(always)]
104    pub fn not_reset(self) -> &'a mut crate::W<REG> {
105        self.variant(Rst::NotReset)
106    }
107    #[doc = "Reset"]
108    #[inline(always)]
109    pub fn reset(self) -> &'a mut crate::W<REG> {
110        self.variant(Rst::Reset)
111    }
112}
113#[doc = "Debug Enable\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Dbgen {
117    #[doc = "0: Disable"]
118    Disabled = 0,
119    #[doc = "1: Enable"]
120    Enabled = 1,
121}
122impl From<Dbgen> for bool {
123    #[inline(always)]
124    fn from(variant: Dbgen) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `DBGEN` reader - Debug Enable"]
129pub type DbgenR = crate::BitReader<Dbgen>;
130impl DbgenR {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub const fn variant(&self) -> Dbgen {
134        match self.bits {
135            false => Dbgen::Disabled,
136            true => Dbgen::Enabled,
137        }
138    }
139    #[doc = "Disable"]
140    #[inline(always)]
141    pub fn is_disabled(&self) -> bool {
142        *self == Dbgen::Disabled
143    }
144    #[doc = "Enable"]
145    #[inline(always)]
146    pub fn is_enabled(&self) -> bool {
147        *self == Dbgen::Enabled
148    }
149}
150#[doc = "Field `DBGEN` writer - Debug Enable"]
151pub type DbgenW<'a, REG> = crate::BitWriter<'a, REG, Dbgen>;
152impl<'a, REG> DbgenW<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155{
156    #[doc = "Disable"]
157    #[inline(always)]
158    pub fn disabled(self) -> &'a mut crate::W<REG> {
159        self.variant(Dbgen::Disabled)
160    }
161    #[doc = "Enable"]
162    #[inline(always)]
163    pub fn enabled(self) -> &'a mut crate::W<REG> {
164        self.variant(Dbgen::Enabled)
165    }
166}
167#[doc = "Reset Transmit FIFO\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Rtf {
171    #[doc = "0: No effect"]
172    NoEffect = 0,
173    #[doc = "1: Reset"]
174    TxfifoRst = 1,
175}
176impl From<Rtf> for bool {
177    #[inline(always)]
178    fn from(variant: Rtf) -> Self {
179        variant as u8 != 0
180    }
181}
182#[doc = "Field `RTF` writer - Reset Transmit FIFO"]
183pub type RtfW<'a, REG> = crate::BitWriter<'a, REG, Rtf>;
184impl<'a, REG> RtfW<'a, REG>
185where
186    REG: crate::Writable + crate::RegisterSpec,
187{
188    #[doc = "No effect"]
189    #[inline(always)]
190    pub fn no_effect(self) -> &'a mut crate::W<REG> {
191        self.variant(Rtf::NoEffect)
192    }
193    #[doc = "Reset"]
194    #[inline(always)]
195    pub fn txfifo_rst(self) -> &'a mut crate::W<REG> {
196        self.variant(Rtf::TxfifoRst)
197    }
198}
199#[doc = "Reset Receive FIFO\n\nValue on reset: 0"]
200#[cfg_attr(feature = "defmt", derive(defmt::Format))]
201#[derive(Clone, Copy, Debug, PartialEq, Eq)]
202pub enum Rrf {
203    #[doc = "0: No effect"]
204    NoEffect = 0,
205    #[doc = "1: Reset"]
206    RxfifoRst = 1,
207}
208impl From<Rrf> for bool {
209    #[inline(always)]
210    fn from(variant: Rrf) -> Self {
211        variant as u8 != 0
212    }
213}
214#[doc = "Field `RRF` writer - Reset Receive FIFO"]
215pub type RrfW<'a, REG> = crate::BitWriter<'a, REG, Rrf>;
216impl<'a, REG> RrfW<'a, REG>
217where
218    REG: crate::Writable + crate::RegisterSpec,
219{
220    #[doc = "No effect"]
221    #[inline(always)]
222    pub fn no_effect(self) -> &'a mut crate::W<REG> {
223        self.variant(Rrf::NoEffect)
224    }
225    #[doc = "Reset"]
226    #[inline(always)]
227    pub fn rxfifo_rst(self) -> &'a mut crate::W<REG> {
228        self.variant(Rrf::RxfifoRst)
229    }
230}
231impl R {
232    #[doc = "Bit 0 - Module Enable"]
233    #[inline(always)]
234    pub fn men(&self) -> MenR {
235        MenR::new((self.bits & 1) != 0)
236    }
237    #[doc = "Bit 1 - Software Reset"]
238    #[inline(always)]
239    pub fn rst(&self) -> RstR {
240        RstR::new(((self.bits >> 1) & 1) != 0)
241    }
242    #[doc = "Bit 3 - Debug Enable"]
243    #[inline(always)]
244    pub fn dbgen(&self) -> DbgenR {
245        DbgenR::new(((self.bits >> 3) & 1) != 0)
246    }
247}
248#[cfg(feature = "debug")]
249impl core::fmt::Debug for R {
250    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
251        f.debug_struct("CR")
252            .field("men", &self.men())
253            .field("rst", &self.rst())
254            .field("dbgen", &self.dbgen())
255            .finish()
256    }
257}
258impl W {
259    #[doc = "Bit 0 - Module Enable"]
260    #[inline(always)]
261    pub fn men(&mut self) -> MenW<'_, CrSpec> {
262        MenW::new(self, 0)
263    }
264    #[doc = "Bit 1 - Software Reset"]
265    #[inline(always)]
266    pub fn rst(&mut self) -> RstW<'_, CrSpec> {
267        RstW::new(self, 1)
268    }
269    #[doc = "Bit 3 - Debug Enable"]
270    #[inline(always)]
271    pub fn dbgen(&mut self) -> DbgenW<'_, CrSpec> {
272        DbgenW::new(self, 3)
273    }
274    #[doc = "Bit 8 - Reset Transmit FIFO"]
275    #[inline(always)]
276    pub fn rtf(&mut self) -> RtfW<'_, CrSpec> {
277        RtfW::new(self, 8)
278    }
279    #[doc = "Bit 9 - Reset Receive FIFO"]
280    #[inline(always)]
281    pub fn rrf(&mut self) -> RrfW<'_, CrSpec> {
282        RrfW::new(self, 9)
283    }
284}
285#[doc = "Control\n\nYou can [`read`](crate::Reg::read) this register and get [`cr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
286pub struct CrSpec;
287impl crate::RegisterSpec for CrSpec {
288    type Ux = u32;
289}
290#[doc = "`read()` method returns [`cr::R`](R) reader structure"]
291impl crate::Readable for CrSpec {}
292#[doc = "`write(|w| ..)` method takes [`cr::W`](W) writer structure"]
293impl crate::Writable for CrSpec {
294    type Safety = crate::Unsafe;
295}
296#[doc = "`reset()` method sets CR to value 0"]
297impl crate::Resettable for CrSpec {}