Skip to main content

mcxa_pac/lpi2c0/
scr.rs

1#[doc = "Register `SCR` reader"]
2pub type R = crate::R<ScrSpec>;
3#[doc = "Register `SCR` writer"]
4pub type W = crate::W<ScrSpec>;
5#[doc = "Target Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Sen {
9    #[doc = "0: Disable"]
10    Disabled = 0,
11    #[doc = "1: Enable"]
12    Enabled = 1,
13}
14impl From<Sen> for bool {
15    #[inline(always)]
16    fn from(variant: Sen) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `SEN` reader - Target Enable"]
21pub type SenR = crate::BitReader<Sen>;
22impl SenR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Sen {
26        match self.bits {
27            false => Sen::Disabled,
28            true => Sen::Enabled,
29        }
30    }
31    #[doc = "Disable"]
32    #[inline(always)]
33    pub fn is_disabled(&self) -> bool {
34        *self == Sen::Disabled
35    }
36    #[doc = "Enable"]
37    #[inline(always)]
38    pub fn is_enabled(&self) -> bool {
39        *self == Sen::Enabled
40    }
41}
42#[doc = "Field `SEN` writer - Target Enable"]
43pub type SenW<'a, REG> = crate::BitWriter<'a, REG, Sen>;
44impl<'a, REG> SenW<'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(Sen::Disabled)
52    }
53    #[doc = "Enable"]
54    #[inline(always)]
55    pub fn enabled(self) -> &'a mut crate::W<REG> {
56        self.variant(Sen::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 = "Filter Enable\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Filten {
117    #[doc = "0: Disable"]
118    Disable = 0,
119    #[doc = "1: Enable"]
120    Enable = 1,
121}
122impl From<Filten> for bool {
123    #[inline(always)]
124    fn from(variant: Filten) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `FILTEN` reader - Filter Enable"]
129pub type FiltenR = crate::BitReader<Filten>;
130impl FiltenR {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub const fn variant(&self) -> Filten {
134        match self.bits {
135            false => Filten::Disable,
136            true => Filten::Enable,
137        }
138    }
139    #[doc = "Disable"]
140    #[inline(always)]
141    pub fn is_disable(&self) -> bool {
142        *self == Filten::Disable
143    }
144    #[doc = "Enable"]
145    #[inline(always)]
146    pub fn is_enable(&self) -> bool {
147        *self == Filten::Enable
148    }
149}
150#[doc = "Field `FILTEN` writer - Filter Enable"]
151pub type FiltenW<'a, REG> = crate::BitWriter<'a, REG, Filten>;
152impl<'a, REG> FiltenW<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155{
156    #[doc = "Disable"]
157    #[inline(always)]
158    pub fn disable(self) -> &'a mut crate::W<REG> {
159        self.variant(Filten::Disable)
160    }
161    #[doc = "Enable"]
162    #[inline(always)]
163    pub fn enable(self) -> &'a mut crate::W<REG> {
164        self.variant(Filten::Enable)
165    }
166}
167#[doc = "Filter Doze Enable\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Filtdz {
171    #[doc = "0: Enable"]
172    FilterEnabled = 0,
173    #[doc = "1: Disable"]
174    FilterDisabled = 1,
175}
176impl From<Filtdz> for bool {
177    #[inline(always)]
178    fn from(variant: Filtdz) -> Self {
179        variant as u8 != 0
180    }
181}
182#[doc = "Field `FILTDZ` reader - Filter Doze Enable"]
183pub type FiltdzR = crate::BitReader<Filtdz>;
184impl FiltdzR {
185    #[doc = "Get enumerated values variant"]
186    #[inline(always)]
187    pub const fn variant(&self) -> Filtdz {
188        match self.bits {
189            false => Filtdz::FilterEnabled,
190            true => Filtdz::FilterDisabled,
191        }
192    }
193    #[doc = "Enable"]
194    #[inline(always)]
195    pub fn is_filter_enabled(&self) -> bool {
196        *self == Filtdz::FilterEnabled
197    }
198    #[doc = "Disable"]
199    #[inline(always)]
200    pub fn is_filter_disabled(&self) -> bool {
201        *self == Filtdz::FilterDisabled
202    }
203}
204#[doc = "Field `FILTDZ` writer - Filter Doze Enable"]
205pub type FiltdzW<'a, REG> = crate::BitWriter<'a, REG, Filtdz>;
206impl<'a, REG> FiltdzW<'a, REG>
207where
208    REG: crate::Writable + crate::RegisterSpec,
209{
210    #[doc = "Enable"]
211    #[inline(always)]
212    pub fn filter_enabled(self) -> &'a mut crate::W<REG> {
213        self.variant(Filtdz::FilterEnabled)
214    }
215    #[doc = "Disable"]
216    #[inline(always)]
217    pub fn filter_disabled(self) -> &'a mut crate::W<REG> {
218        self.variant(Filtdz::FilterDisabled)
219    }
220}
221#[doc = "Reset Transmit FIFO\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum Rtf {
225    #[doc = "0: No effect"]
226    NoEffect = 0,
227    #[doc = "1: STDR is now empty"]
228    NowEmpty = 1,
229}
230impl From<Rtf> for bool {
231    #[inline(always)]
232    fn from(variant: Rtf) -> Self {
233        variant as u8 != 0
234    }
235}
236#[doc = "Field `RTF` reader - Reset Transmit FIFO"]
237pub type RtfR = crate::BitReader<Rtf>;
238impl RtfR {
239    #[doc = "Get enumerated values variant"]
240    #[inline(always)]
241    pub const fn variant(&self) -> Rtf {
242        match self.bits {
243            false => Rtf::NoEffect,
244            true => Rtf::NowEmpty,
245        }
246    }
247    #[doc = "No effect"]
248    #[inline(always)]
249    pub fn is_no_effect(&self) -> bool {
250        *self == Rtf::NoEffect
251    }
252    #[doc = "STDR is now empty"]
253    #[inline(always)]
254    pub fn is_now_empty(&self) -> bool {
255        *self == Rtf::NowEmpty
256    }
257}
258#[doc = "Field `RTF` writer - Reset Transmit FIFO"]
259pub type RtfW<'a, REG> = crate::BitWriter<'a, REG, Rtf>;
260impl<'a, REG> RtfW<'a, REG>
261where
262    REG: crate::Writable + crate::RegisterSpec,
263{
264    #[doc = "No effect"]
265    #[inline(always)]
266    pub fn no_effect(self) -> &'a mut crate::W<REG> {
267        self.variant(Rtf::NoEffect)
268    }
269    #[doc = "STDR is now empty"]
270    #[inline(always)]
271    pub fn now_empty(self) -> &'a mut crate::W<REG> {
272        self.variant(Rtf::NowEmpty)
273    }
274}
275#[doc = "Reset Receive FIFO\n\nValue on reset: 0"]
276#[cfg_attr(feature = "defmt", derive(defmt::Format))]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278pub enum Rrf {
279    #[doc = "0: No effect"]
280    NoEffect = 0,
281    #[doc = "1: SRDR is now empty"]
282    NowEmpty = 1,
283}
284impl From<Rrf> for bool {
285    #[inline(always)]
286    fn from(variant: Rrf) -> Self {
287        variant as u8 != 0
288    }
289}
290#[doc = "Field `RRF` reader - Reset Receive FIFO"]
291pub type RrfR = crate::BitReader<Rrf>;
292impl RrfR {
293    #[doc = "Get enumerated values variant"]
294    #[inline(always)]
295    pub const fn variant(&self) -> Rrf {
296        match self.bits {
297            false => Rrf::NoEffect,
298            true => Rrf::NowEmpty,
299        }
300    }
301    #[doc = "No effect"]
302    #[inline(always)]
303    pub fn is_no_effect(&self) -> bool {
304        *self == Rrf::NoEffect
305    }
306    #[doc = "SRDR is now empty"]
307    #[inline(always)]
308    pub fn is_now_empty(&self) -> bool {
309        *self == Rrf::NowEmpty
310    }
311}
312#[doc = "Field `RRF` writer - Reset Receive FIFO"]
313pub type RrfW<'a, REG> = crate::BitWriter<'a, REG, Rrf>;
314impl<'a, REG> RrfW<'a, REG>
315where
316    REG: crate::Writable + crate::RegisterSpec,
317{
318    #[doc = "No effect"]
319    #[inline(always)]
320    pub fn no_effect(self) -> &'a mut crate::W<REG> {
321        self.variant(Rrf::NoEffect)
322    }
323    #[doc = "SRDR is now empty"]
324    #[inline(always)]
325    pub fn now_empty(self) -> &'a mut crate::W<REG> {
326        self.variant(Rrf::NowEmpty)
327    }
328}
329impl R {
330    #[doc = "Bit 0 - Target Enable"]
331    #[inline(always)]
332    pub fn sen(&self) -> SenR {
333        SenR::new((self.bits & 1) != 0)
334    }
335    #[doc = "Bit 1 - Software Reset"]
336    #[inline(always)]
337    pub fn rst(&self) -> RstR {
338        RstR::new(((self.bits >> 1) & 1) != 0)
339    }
340    #[doc = "Bit 4 - Filter Enable"]
341    #[inline(always)]
342    pub fn filten(&self) -> FiltenR {
343        FiltenR::new(((self.bits >> 4) & 1) != 0)
344    }
345    #[doc = "Bit 5 - Filter Doze Enable"]
346    #[inline(always)]
347    pub fn filtdz(&self) -> FiltdzR {
348        FiltdzR::new(((self.bits >> 5) & 1) != 0)
349    }
350    #[doc = "Bit 8 - Reset Transmit FIFO"]
351    #[inline(always)]
352    pub fn rtf(&self) -> RtfR {
353        RtfR::new(((self.bits >> 8) & 1) != 0)
354    }
355    #[doc = "Bit 9 - Reset Receive FIFO"]
356    #[inline(always)]
357    pub fn rrf(&self) -> RrfR {
358        RrfR::new(((self.bits >> 9) & 1) != 0)
359    }
360}
361#[cfg(feature = "debug")]
362impl core::fmt::Debug for R {
363    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
364        f.debug_struct("SCR")
365            .field("sen", &self.sen())
366            .field("rst", &self.rst())
367            .field("filten", &self.filten())
368            .field("filtdz", &self.filtdz())
369            .field("rtf", &self.rtf())
370            .field("rrf", &self.rrf())
371            .finish()
372    }
373}
374impl W {
375    #[doc = "Bit 0 - Target Enable"]
376    #[inline(always)]
377    pub fn sen(&mut self) -> SenW<'_, ScrSpec> {
378        SenW::new(self, 0)
379    }
380    #[doc = "Bit 1 - Software Reset"]
381    #[inline(always)]
382    pub fn rst(&mut self) -> RstW<'_, ScrSpec> {
383        RstW::new(self, 1)
384    }
385    #[doc = "Bit 4 - Filter Enable"]
386    #[inline(always)]
387    pub fn filten(&mut self) -> FiltenW<'_, ScrSpec> {
388        FiltenW::new(self, 4)
389    }
390    #[doc = "Bit 5 - Filter Doze Enable"]
391    #[inline(always)]
392    pub fn filtdz(&mut self) -> FiltdzW<'_, ScrSpec> {
393        FiltdzW::new(self, 5)
394    }
395    #[doc = "Bit 8 - Reset Transmit FIFO"]
396    #[inline(always)]
397    pub fn rtf(&mut self) -> RtfW<'_, ScrSpec> {
398        RtfW::new(self, 8)
399    }
400    #[doc = "Bit 9 - Reset Receive FIFO"]
401    #[inline(always)]
402    pub fn rrf(&mut self) -> RrfW<'_, ScrSpec> {
403        RrfW::new(self, 9)
404    }
405}
406#[doc = "Target Control\n\nYou can [`read`](crate::Reg::read) this register and get [`scr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`scr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
407pub struct ScrSpec;
408impl crate::RegisterSpec for ScrSpec {
409    type Ux = u32;
410}
411#[doc = "`read()` method returns [`scr::R`](R) reader structure"]
412impl crate::Readable for ScrSpec {}
413#[doc = "`write(|w| ..)` method takes [`scr::W`](W) writer structure"]
414impl crate::Writable for ScrSpec {
415    type Safety = crate::Unsafe;
416}
417#[doc = "`reset()` method sets SCR to value 0"]
418impl crate::Resettable for ScrSpec {}