mcxa_pac/dac0/
fsr.rs

1#[doc = "Register `FSR` reader"]
2pub type R = crate::R<FsrSpec>;
3#[doc = "Register `FSR` writer"]
4pub type W = crate::W<FsrSpec>;
5#[doc = "FIFO Full Flag\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Full {
9    #[doc = "0: Not full"]
10    NotFull = 0,
11    #[doc = "1: Full"]
12    Full = 1,
13}
14impl From<Full> for bool {
15    #[inline(always)]
16    fn from(variant: Full) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `FULL` reader - FIFO Full Flag"]
21pub type FullR = crate::BitReader<Full>;
22impl FullR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Full {
26        match self.bits {
27            false => Full::NotFull,
28            true => Full::Full,
29        }
30    }
31    #[doc = "Not full"]
32    #[inline(always)]
33    pub fn is_not_full(&self) -> bool {
34        *self == Full::NotFull
35    }
36    #[doc = "Full"]
37    #[inline(always)]
38    pub fn is_full(&self) -> bool {
39        *self == Full::Full
40    }
41}
42#[doc = "FIFO Empty Flag\n\nValue on reset: 1"]
43#[cfg_attr(feature = "defmt", derive(defmt::Format))]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum Empty {
46    #[doc = "0: Not empty"]
47    NotEmpty = 0,
48    #[doc = "1: Empty"]
49    Empty = 1,
50}
51impl From<Empty> for bool {
52    #[inline(always)]
53    fn from(variant: Empty) -> Self {
54        variant as u8 != 0
55    }
56}
57#[doc = "Field `EMPTY` reader - FIFO Empty Flag"]
58pub type EmptyR = crate::BitReader<Empty>;
59impl EmptyR {
60    #[doc = "Get enumerated values variant"]
61    #[inline(always)]
62    pub const fn variant(&self) -> Empty {
63        match self.bits {
64            false => Empty::NotEmpty,
65            true => Empty::Empty,
66        }
67    }
68    #[doc = "Not empty"]
69    #[inline(always)]
70    pub fn is_not_empty(&self) -> bool {
71        *self == Empty::NotEmpty
72    }
73    #[doc = "Empty"]
74    #[inline(always)]
75    pub fn is_empty(&self) -> bool {
76        *self == Empty::Empty
77    }
78}
79#[doc = "FIFO Watermark Status Flag\n\nValue on reset: 0"]
80#[cfg_attr(feature = "defmt", derive(defmt::Format))]
81#[derive(Clone, Copy, Debug, PartialEq, Eq)]
82pub enum Wm {
83    #[doc = "0: Data in FIFO is more than watermark level"]
84    MoreThanWlevel = 0,
85    #[doc = "1: Data in FIFO is less than or equal to watermark level"]
86    LessThanWlevel = 1,
87}
88impl From<Wm> for bool {
89    #[inline(always)]
90    fn from(variant: Wm) -> Self {
91        variant as u8 != 0
92    }
93}
94#[doc = "Field `WM` reader - FIFO Watermark Status Flag"]
95pub type WmR = crate::BitReader<Wm>;
96impl WmR {
97    #[doc = "Get enumerated values variant"]
98    #[inline(always)]
99    pub const fn variant(&self) -> Wm {
100        match self.bits {
101            false => Wm::MoreThanWlevel,
102            true => Wm::LessThanWlevel,
103        }
104    }
105    #[doc = "Data in FIFO is more than watermark level"]
106    #[inline(always)]
107    pub fn is_more_than_wlevel(&self) -> bool {
108        *self == Wm::MoreThanWlevel
109    }
110    #[doc = "Data in FIFO is less than or equal to watermark level"]
111    #[inline(always)]
112    pub fn is_less_than_wlevel(&self) -> bool {
113        *self == Wm::LessThanWlevel
114    }
115}
116#[doc = "Swing Back One Cycle Complete Flag\n\nValue on reset: 0"]
117#[cfg_attr(feature = "defmt", derive(defmt::Format))]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119pub enum Swbk {
120    #[doc = "0: No swing back cycle has completed since the last time the flag was cleared"]
121    NoSwing = 0,
122    #[doc = "1: At least one swing back cycle has occurred since the last time the flag was cleared"]
123    SwingBack = 1,
124}
125impl From<Swbk> for bool {
126    #[inline(always)]
127    fn from(variant: Swbk) -> Self {
128        variant as u8 != 0
129    }
130}
131#[doc = "Field `SWBK` reader - Swing Back One Cycle Complete Flag"]
132pub type SwbkR = crate::BitReader<Swbk>;
133impl SwbkR {
134    #[doc = "Get enumerated values variant"]
135    #[inline(always)]
136    pub const fn variant(&self) -> Swbk {
137        match self.bits {
138            false => Swbk::NoSwing,
139            true => Swbk::SwingBack,
140        }
141    }
142    #[doc = "No swing back cycle has completed since the last time the flag was cleared"]
143    #[inline(always)]
144    pub fn is_no_swing(&self) -> bool {
145        *self == Swbk::NoSwing
146    }
147    #[doc = "At least one swing back cycle has occurred since the last time the flag was cleared"]
148    #[inline(always)]
149    pub fn is_swing_back(&self) -> bool {
150        *self == Swbk::SwingBack
151    }
152}
153#[doc = "Field `SWBK` writer - Swing Back One Cycle Complete Flag"]
154pub type SwbkW<'a, REG> = crate::BitWriter1C<'a, REG, Swbk>;
155impl<'a, REG> SwbkW<'a, REG>
156where
157    REG: crate::Writable + crate::RegisterSpec,
158{
159    #[doc = "No swing back cycle has completed since the last time the flag was cleared"]
160    #[inline(always)]
161    pub fn no_swing(self) -> &'a mut crate::W<REG> {
162        self.variant(Swbk::NoSwing)
163    }
164    #[doc = "At least one swing back cycle has occurred since the last time the flag was cleared"]
165    #[inline(always)]
166    pub fn swing_back(self) -> &'a mut crate::W<REG> {
167        self.variant(Swbk::SwingBack)
168    }
169}
170#[doc = "FIFO Overflow Flag\n\nValue on reset: 0"]
171#[cfg_attr(feature = "defmt", derive(defmt::Format))]
172#[derive(Clone, Copy, Debug, PartialEq, Eq)]
173pub enum Of {
174    #[doc = "0: No overflow has occurred since the last time the flag was cleared"]
175    NoOverflow = 0,
176    #[doc = "1: At least one FIFO overflow has occurred since the last time the flag was cleared"]
177    Overflow = 1,
178}
179impl From<Of> for bool {
180    #[inline(always)]
181    fn from(variant: Of) -> Self {
182        variant as u8 != 0
183    }
184}
185#[doc = "Field `OF` reader - FIFO Overflow Flag"]
186pub type OfR = crate::BitReader<Of>;
187impl OfR {
188    #[doc = "Get enumerated values variant"]
189    #[inline(always)]
190    pub const fn variant(&self) -> Of {
191        match self.bits {
192            false => Of::NoOverflow,
193            true => Of::Overflow,
194        }
195    }
196    #[doc = "No overflow has occurred since the last time the flag was cleared"]
197    #[inline(always)]
198    pub fn is_no_overflow(&self) -> bool {
199        *self == Of::NoOverflow
200    }
201    #[doc = "At least one FIFO overflow has occurred since the last time the flag was cleared"]
202    #[inline(always)]
203    pub fn is_overflow(&self) -> bool {
204        *self == Of::Overflow
205    }
206}
207#[doc = "Field `OF` writer - FIFO Overflow Flag"]
208pub type OfW<'a, REG> = crate::BitWriter1C<'a, REG, Of>;
209impl<'a, REG> OfW<'a, REG>
210where
211    REG: crate::Writable + crate::RegisterSpec,
212{
213    #[doc = "No overflow has occurred since the last time the flag was cleared"]
214    #[inline(always)]
215    pub fn no_overflow(self) -> &'a mut crate::W<REG> {
216        self.variant(Of::NoOverflow)
217    }
218    #[doc = "At least one FIFO overflow has occurred since the last time the flag was cleared"]
219    #[inline(always)]
220    pub fn overflow(self) -> &'a mut crate::W<REG> {
221        self.variant(Of::Overflow)
222    }
223}
224#[doc = "FIFO Underflow Flag\n\nValue on reset: 0"]
225#[cfg_attr(feature = "defmt", derive(defmt::Format))]
226#[derive(Clone, Copy, Debug, PartialEq, Eq)]
227pub enum Uf {
228    #[doc = "0: No underflow has occurred since the last time the flag was cleared"]
229    NoUnderflow = 0,
230    #[doc = "1: At least one trigger underflow has occurred since the last time the flag was cleared"]
231    Underflow = 1,
232}
233impl From<Uf> for bool {
234    #[inline(always)]
235    fn from(variant: Uf) -> Self {
236        variant as u8 != 0
237    }
238}
239#[doc = "Field `UF` reader - FIFO Underflow Flag"]
240pub type UfR = crate::BitReader<Uf>;
241impl UfR {
242    #[doc = "Get enumerated values variant"]
243    #[inline(always)]
244    pub const fn variant(&self) -> Uf {
245        match self.bits {
246            false => Uf::NoUnderflow,
247            true => Uf::Underflow,
248        }
249    }
250    #[doc = "No underflow has occurred since the last time the flag was cleared"]
251    #[inline(always)]
252    pub fn is_no_underflow(&self) -> bool {
253        *self == Uf::NoUnderflow
254    }
255    #[doc = "At least one trigger underflow has occurred since the last time the flag was cleared"]
256    #[inline(always)]
257    pub fn is_underflow(&self) -> bool {
258        *self == Uf::Underflow
259    }
260}
261#[doc = "Field `UF` writer - FIFO Underflow Flag"]
262pub type UfW<'a, REG> = crate::BitWriter1C<'a, REG, Uf>;
263impl<'a, REG> UfW<'a, REG>
264where
265    REG: crate::Writable + crate::RegisterSpec,
266{
267    #[doc = "No underflow has occurred since the last time the flag was cleared"]
268    #[inline(always)]
269    pub fn no_underflow(self) -> &'a mut crate::W<REG> {
270        self.variant(Uf::NoUnderflow)
271    }
272    #[doc = "At least one trigger underflow has occurred since the last time the flag was cleared"]
273    #[inline(always)]
274    pub fn underflow(self) -> &'a mut crate::W<REG> {
275        self.variant(Uf::Underflow)
276    }
277}
278#[doc = "Period Trigger Mode Conversion Complete Flag\n\nValue on reset: 0"]
279#[cfg_attr(feature = "defmt", derive(defmt::Format))]
280#[derive(Clone, Copy, Debug, PartialEq, Eq)]
281pub enum Ptgcoco {
282    #[doc = "0: Not completed or not started"]
283    NotStart = 0,
284    #[doc = "1: Completed"]
285    Completed = 1,
286}
287impl From<Ptgcoco> for bool {
288    #[inline(always)]
289    fn from(variant: Ptgcoco) -> Self {
290        variant as u8 != 0
291    }
292}
293#[doc = "Field `PTGCOCO` reader - Period Trigger Mode Conversion Complete Flag"]
294pub type PtgcocoR = crate::BitReader<Ptgcoco>;
295impl PtgcocoR {
296    #[doc = "Get enumerated values variant"]
297    #[inline(always)]
298    pub const fn variant(&self) -> Ptgcoco {
299        match self.bits {
300            false => Ptgcoco::NotStart,
301            true => Ptgcoco::Completed,
302        }
303    }
304    #[doc = "Not completed or not started"]
305    #[inline(always)]
306    pub fn is_not_start(&self) -> bool {
307        *self == Ptgcoco::NotStart
308    }
309    #[doc = "Completed"]
310    #[inline(always)]
311    pub fn is_completed(&self) -> bool {
312        *self == Ptgcoco::Completed
313    }
314}
315#[doc = "Field `PTGCOCO` writer - Period Trigger Mode Conversion Complete Flag"]
316pub type PtgcocoW<'a, REG> = crate::BitWriter1C<'a, REG, Ptgcoco>;
317impl<'a, REG> PtgcocoW<'a, REG>
318where
319    REG: crate::Writable + crate::RegisterSpec,
320{
321    #[doc = "Not completed or not started"]
322    #[inline(always)]
323    pub fn not_start(self) -> &'a mut crate::W<REG> {
324        self.variant(Ptgcoco::NotStart)
325    }
326    #[doc = "Completed"]
327    #[inline(always)]
328    pub fn completed(self) -> &'a mut crate::W<REG> {
329        self.variant(Ptgcoco::Completed)
330    }
331}
332impl R {
333    #[doc = "Bit 0 - FIFO Full Flag"]
334    #[inline(always)]
335    pub fn full(&self) -> FullR {
336        FullR::new((self.bits & 1) != 0)
337    }
338    #[doc = "Bit 1 - FIFO Empty Flag"]
339    #[inline(always)]
340    pub fn empty(&self) -> EmptyR {
341        EmptyR::new(((self.bits >> 1) & 1) != 0)
342    }
343    #[doc = "Bit 2 - FIFO Watermark Status Flag"]
344    #[inline(always)]
345    pub fn wm(&self) -> WmR {
346        WmR::new(((self.bits >> 2) & 1) != 0)
347    }
348    #[doc = "Bit 3 - Swing Back One Cycle Complete Flag"]
349    #[inline(always)]
350    pub fn swbk(&self) -> SwbkR {
351        SwbkR::new(((self.bits >> 3) & 1) != 0)
352    }
353    #[doc = "Bit 6 - FIFO Overflow Flag"]
354    #[inline(always)]
355    pub fn of(&self) -> OfR {
356        OfR::new(((self.bits >> 6) & 1) != 0)
357    }
358    #[doc = "Bit 7 - FIFO Underflow Flag"]
359    #[inline(always)]
360    pub fn uf(&self) -> UfR {
361        UfR::new(((self.bits >> 7) & 1) != 0)
362    }
363    #[doc = "Bit 8 - Period Trigger Mode Conversion Complete Flag"]
364    #[inline(always)]
365    pub fn ptgcoco(&self) -> PtgcocoR {
366        PtgcocoR::new(((self.bits >> 8) & 1) != 0)
367    }
368}
369#[cfg(feature = "debug")]
370impl core::fmt::Debug for R {
371    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
372        f.debug_struct("FSR")
373            .field("full", &self.full())
374            .field("empty", &self.empty())
375            .field("wm", &self.wm())
376            .field("swbk", &self.swbk())
377            .field("of", &self.of())
378            .field("uf", &self.uf())
379            .field("ptgcoco", &self.ptgcoco())
380            .finish()
381    }
382}
383impl W {
384    #[doc = "Bit 3 - Swing Back One Cycle Complete Flag"]
385    #[inline(always)]
386    pub fn swbk(&mut self) -> SwbkW<'_, FsrSpec> {
387        SwbkW::new(self, 3)
388    }
389    #[doc = "Bit 6 - FIFO Overflow Flag"]
390    #[inline(always)]
391    pub fn of(&mut self) -> OfW<'_, FsrSpec> {
392        OfW::new(self, 6)
393    }
394    #[doc = "Bit 7 - FIFO Underflow Flag"]
395    #[inline(always)]
396    pub fn uf(&mut self) -> UfW<'_, FsrSpec> {
397        UfW::new(self, 7)
398    }
399    #[doc = "Bit 8 - Period Trigger Mode Conversion Complete Flag"]
400    #[inline(always)]
401    pub fn ptgcoco(&mut self) -> PtgcocoW<'_, FsrSpec> {
402        PtgcocoW::new(self, 8)
403    }
404}
405#[doc = "FIFO Status\n\nYou can [`read`](crate::Reg::read) this register and get [`fsr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`fsr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
406pub struct FsrSpec;
407impl crate::RegisterSpec for FsrSpec {
408    type Ux = u32;
409}
410#[doc = "`read()` method returns [`fsr::R`](R) reader structure"]
411impl crate::Readable for FsrSpec {}
412#[doc = "`write(|w| ..)` method takes [`fsr::W`](W) writer structure"]
413impl crate::Writable for FsrSpec {
414    type Safety = crate::Unsafe;
415    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x01c8;
416}
417#[doc = "`reset()` method sets FSR to value 0x02"]
418impl crate::Resettable for FsrSpec {
419    const RESET_VALUE: u32 = 0x02;
420}