Skip to main content

mcxa_pac/adc0/
tstat.rs

1#[doc = "Register `TSTAT` reader"]
2pub type R = crate::R<TstatSpec>;
3#[doc = "Register `TSTAT` writer"]
4pub type W = crate::W<TstatSpec>;
5#[doc = "Trigger Exception Number\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum TexcNum {
10    #[doc = "0: No triggers have been interrupted by a high priority exception. Or CFG\\[TRES\\] = 1."]
11    NoExceptions = 0,
12    #[doc = "1: Trigger 0 has been interrupted by a high priority exception."]
13    Bit0MeansTrigger0Interrupted = 1,
14    #[doc = "2: Trigger 1 has been interrupted by a high priority exception."]
15    Bit1MeansTrigger1Interrupted = 2,
16    #[doc = "3: Associated trigger sequence has interrupted by a high priority exception."]
17    SetBitsIndicateTriggerXInterrupted3 = 3,
18    #[doc = "4: Associated trigger sequence has interrupted by a high priority exception."]
19    SetBitsIndicateTriggerXInterrupted4 = 4,
20    #[doc = "5: Associated trigger sequence has interrupted by a high priority exception."]
21    SetBitsIndicateTriggerXInterrupted5 = 5,
22    #[doc = "6: Associated trigger sequence has interrupted by a high priority exception."]
23    SetBitsIndicateTriggerXInterrupted6 = 6,
24    #[doc = "7: Associated trigger sequence has interrupted by a high priority exception."]
25    SetBitsIndicateTriggerXInterrupted7 = 7,
26    #[doc = "8: Associated trigger sequence has interrupted by a high priority exception."]
27    SetBitsIndicateTriggerXInterrupted8 = 8,
28    #[doc = "9: Associated trigger sequence has interrupted by a high priority exception."]
29    SetBitsIndicateTriggerXInterrupted9 = 9,
30    #[doc = "15: Every trigger sequence has been interrupted by a high priority exception."]
31    AllBitsSetIndicateAllTriggersInterrupted = 15,
32}
33impl From<TexcNum> for u8 {
34    #[inline(always)]
35    fn from(variant: TexcNum) -> Self {
36        variant as _
37    }
38}
39impl crate::FieldSpec for TexcNum {
40    type Ux = u8;
41}
42impl crate::IsEnum for TexcNum {}
43#[doc = "Field `TEXC_NUM` reader - Trigger Exception Number"]
44pub type TexcNumR = crate::FieldReader<TexcNum>;
45impl TexcNumR {
46    #[doc = "Get enumerated values variant"]
47    #[inline(always)]
48    pub const fn variant(&self) -> Option<TexcNum> {
49        match self.bits {
50            0 => Some(TexcNum::NoExceptions),
51            1 => Some(TexcNum::Bit0MeansTrigger0Interrupted),
52            2 => Some(TexcNum::Bit1MeansTrigger1Interrupted),
53            3 => Some(TexcNum::SetBitsIndicateTriggerXInterrupted3),
54            4 => Some(TexcNum::SetBitsIndicateTriggerXInterrupted4),
55            5 => Some(TexcNum::SetBitsIndicateTriggerXInterrupted5),
56            6 => Some(TexcNum::SetBitsIndicateTriggerXInterrupted6),
57            7 => Some(TexcNum::SetBitsIndicateTriggerXInterrupted7),
58            8 => Some(TexcNum::SetBitsIndicateTriggerXInterrupted8),
59            9 => Some(TexcNum::SetBitsIndicateTriggerXInterrupted9),
60            15 => Some(TexcNum::AllBitsSetIndicateAllTriggersInterrupted),
61            _ => None,
62        }
63    }
64    #[doc = "No triggers have been interrupted by a high priority exception. Or CFG\\[TRES\\] = 1."]
65    #[inline(always)]
66    pub fn is_no_exceptions(&self) -> bool {
67        *self == TexcNum::NoExceptions
68    }
69    #[doc = "Trigger 0 has been interrupted by a high priority exception."]
70    #[inline(always)]
71    pub fn is_bit0_means_trigger_0_interrupted(&self) -> bool {
72        *self == TexcNum::Bit0MeansTrigger0Interrupted
73    }
74    #[doc = "Trigger 1 has been interrupted by a high priority exception."]
75    #[inline(always)]
76    pub fn is_bit1_means_trigger_1_interrupted(&self) -> bool {
77        *self == TexcNum::Bit1MeansTrigger1Interrupted
78    }
79    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
80    #[inline(always)]
81    pub fn is_set_bits_indicate_trigger_x_interrupted_3(&self) -> bool {
82        *self == TexcNum::SetBitsIndicateTriggerXInterrupted3
83    }
84    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
85    #[inline(always)]
86    pub fn is_set_bits_indicate_trigger_x_interrupted_4(&self) -> bool {
87        *self == TexcNum::SetBitsIndicateTriggerXInterrupted4
88    }
89    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
90    #[inline(always)]
91    pub fn is_set_bits_indicate_trigger_x_interrupted_5(&self) -> bool {
92        *self == TexcNum::SetBitsIndicateTriggerXInterrupted5
93    }
94    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
95    #[inline(always)]
96    pub fn is_set_bits_indicate_trigger_x_interrupted_6(&self) -> bool {
97        *self == TexcNum::SetBitsIndicateTriggerXInterrupted6
98    }
99    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
100    #[inline(always)]
101    pub fn is_set_bits_indicate_trigger_x_interrupted_7(&self) -> bool {
102        *self == TexcNum::SetBitsIndicateTriggerXInterrupted7
103    }
104    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
105    #[inline(always)]
106    pub fn is_set_bits_indicate_trigger_x_interrupted_8(&self) -> bool {
107        *self == TexcNum::SetBitsIndicateTriggerXInterrupted8
108    }
109    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
110    #[inline(always)]
111    pub fn is_set_bits_indicate_trigger_x_interrupted_9(&self) -> bool {
112        *self == TexcNum::SetBitsIndicateTriggerXInterrupted9
113    }
114    #[doc = "Every trigger sequence has been interrupted by a high priority exception."]
115    #[inline(always)]
116    pub fn is_all_bits_set_indicate_all_triggers_interrupted(&self) -> bool {
117        *self == TexcNum::AllBitsSetIndicateAllTriggersInterrupted
118    }
119}
120#[doc = "Field `TEXC_NUM` writer - Trigger Exception Number"]
121pub type TexcNumW<'a, REG> = crate::FieldWriter<'a, REG, 4, TexcNum>;
122impl<'a, REG> TexcNumW<'a, REG>
123where
124    REG: crate::Writable + crate::RegisterSpec,
125    REG::Ux: From<u8>,
126{
127    #[doc = "No triggers have been interrupted by a high priority exception. Or CFG\\[TRES\\] = 1."]
128    #[inline(always)]
129    pub fn no_exceptions(self) -> &'a mut crate::W<REG> {
130        self.variant(TexcNum::NoExceptions)
131    }
132    #[doc = "Trigger 0 has been interrupted by a high priority exception."]
133    #[inline(always)]
134    pub fn bit0_means_trigger_0_interrupted(self) -> &'a mut crate::W<REG> {
135        self.variant(TexcNum::Bit0MeansTrigger0Interrupted)
136    }
137    #[doc = "Trigger 1 has been interrupted by a high priority exception."]
138    #[inline(always)]
139    pub fn bit1_means_trigger_1_interrupted(self) -> &'a mut crate::W<REG> {
140        self.variant(TexcNum::Bit1MeansTrigger1Interrupted)
141    }
142    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
143    #[inline(always)]
144    pub fn set_bits_indicate_trigger_x_interrupted_3(self) -> &'a mut crate::W<REG> {
145        self.variant(TexcNum::SetBitsIndicateTriggerXInterrupted3)
146    }
147    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
148    #[inline(always)]
149    pub fn set_bits_indicate_trigger_x_interrupted_4(self) -> &'a mut crate::W<REG> {
150        self.variant(TexcNum::SetBitsIndicateTriggerXInterrupted4)
151    }
152    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
153    #[inline(always)]
154    pub fn set_bits_indicate_trigger_x_interrupted_5(self) -> &'a mut crate::W<REG> {
155        self.variant(TexcNum::SetBitsIndicateTriggerXInterrupted5)
156    }
157    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
158    #[inline(always)]
159    pub fn set_bits_indicate_trigger_x_interrupted_6(self) -> &'a mut crate::W<REG> {
160        self.variant(TexcNum::SetBitsIndicateTriggerXInterrupted6)
161    }
162    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
163    #[inline(always)]
164    pub fn set_bits_indicate_trigger_x_interrupted_7(self) -> &'a mut crate::W<REG> {
165        self.variant(TexcNum::SetBitsIndicateTriggerXInterrupted7)
166    }
167    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
168    #[inline(always)]
169    pub fn set_bits_indicate_trigger_x_interrupted_8(self) -> &'a mut crate::W<REG> {
170        self.variant(TexcNum::SetBitsIndicateTriggerXInterrupted8)
171    }
172    #[doc = "Associated trigger sequence has interrupted by a high priority exception."]
173    #[inline(always)]
174    pub fn set_bits_indicate_trigger_x_interrupted_9(self) -> &'a mut crate::W<REG> {
175        self.variant(TexcNum::SetBitsIndicateTriggerXInterrupted9)
176    }
177    #[doc = "Every trigger sequence has been interrupted by a high priority exception."]
178    #[inline(always)]
179    pub fn all_bits_set_indicate_all_triggers_interrupted(self) -> &'a mut crate::W<REG> {
180        self.variant(TexcNum::AllBitsSetIndicateAllTriggersInterrupted)
181    }
182}
183#[doc = "Trigger Completion Flag\n\nValue on reset: 0"]
184#[cfg_attr(feature = "defmt", derive(defmt::Format))]
185#[derive(Clone, Copy, Debug, PartialEq, Eq)]
186#[repr(u8)]
187pub enum TcompFlag {
188    #[doc = "0: No triggers have been completed. Trigger completion interrupts are disabled."]
189    NoTrigger = 0,
190    #[doc = "1: Trigger 0 has been completed and trigger 0 has enabled completion interrupts."]
191    Bit0MeansTrigger0Completed = 1,
192    #[doc = "2: Trigger 1 has been completed and trigger 1 has enabled completion interrupts."]
193    Bit1MeansTrigger1Completed = 2,
194    #[doc = "3: Associated trigger sequence has completed and has enabled completion interrupts."]
195    SetBitsIndicateTriggerXCompleted3 = 3,
196    #[doc = "4: Associated trigger sequence has completed and has enabled completion interrupts."]
197    SetBitsIndicateTriggerXCompleted4 = 4,
198    #[doc = "5: Associated trigger sequence has completed and has enabled completion interrupts."]
199    SetBitsIndicateTriggerXCompleted5 = 5,
200    #[doc = "6: Associated trigger sequence has completed and has enabled completion interrupts."]
201    SetBitsIndicateTriggerXCompleted6 = 6,
202    #[doc = "7: Associated trigger sequence has completed and has enabled completion interrupts."]
203    SetBitsIndicateTriggerXCompleted7 = 7,
204    #[doc = "8: Associated trigger sequence has completed and has enabled completion interrupts."]
205    SetBitsIndicateTriggerXCompleted8 = 8,
206    #[doc = "9: Associated trigger sequence has completed and has enabled completion interrupts."]
207    SetBitsIndicateTriggerXCompleted9 = 9,
208    #[doc = "15: Every trigger sequence has been completed and every trigger has enabled completion interrupts."]
209    AllBitsSetIndicateAllTriggersCompleted = 15,
210}
211impl From<TcompFlag> for u8 {
212    #[inline(always)]
213    fn from(variant: TcompFlag) -> Self {
214        variant as _
215    }
216}
217impl crate::FieldSpec for TcompFlag {
218    type Ux = u8;
219}
220impl crate::IsEnum for TcompFlag {}
221#[doc = "Field `TCOMP_FLAG` reader - Trigger Completion Flag"]
222pub type TcompFlagR = crate::FieldReader<TcompFlag>;
223impl TcompFlagR {
224    #[doc = "Get enumerated values variant"]
225    #[inline(always)]
226    pub const fn variant(&self) -> Option<TcompFlag> {
227        match self.bits {
228            0 => Some(TcompFlag::NoTrigger),
229            1 => Some(TcompFlag::Bit0MeansTrigger0Completed),
230            2 => Some(TcompFlag::Bit1MeansTrigger1Completed),
231            3 => Some(TcompFlag::SetBitsIndicateTriggerXCompleted3),
232            4 => Some(TcompFlag::SetBitsIndicateTriggerXCompleted4),
233            5 => Some(TcompFlag::SetBitsIndicateTriggerXCompleted5),
234            6 => Some(TcompFlag::SetBitsIndicateTriggerXCompleted6),
235            7 => Some(TcompFlag::SetBitsIndicateTriggerXCompleted7),
236            8 => Some(TcompFlag::SetBitsIndicateTriggerXCompleted8),
237            9 => Some(TcompFlag::SetBitsIndicateTriggerXCompleted9),
238            15 => Some(TcompFlag::AllBitsSetIndicateAllTriggersCompleted),
239            _ => None,
240        }
241    }
242    #[doc = "No triggers have been completed. Trigger completion interrupts are disabled."]
243    #[inline(always)]
244    pub fn is_no_trigger(&self) -> bool {
245        *self == TcompFlag::NoTrigger
246    }
247    #[doc = "Trigger 0 has been completed and trigger 0 has enabled completion interrupts."]
248    #[inline(always)]
249    pub fn is_bit0_means_trigger_0_completed(&self) -> bool {
250        *self == TcompFlag::Bit0MeansTrigger0Completed
251    }
252    #[doc = "Trigger 1 has been completed and trigger 1 has enabled completion interrupts."]
253    #[inline(always)]
254    pub fn is_bit1_means_trigger_1_completed(&self) -> bool {
255        *self == TcompFlag::Bit1MeansTrigger1Completed
256    }
257    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
258    #[inline(always)]
259    pub fn is_set_bits_indicate_trigger_x_completed_3(&self) -> bool {
260        *self == TcompFlag::SetBitsIndicateTriggerXCompleted3
261    }
262    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
263    #[inline(always)]
264    pub fn is_set_bits_indicate_trigger_x_completed_4(&self) -> bool {
265        *self == TcompFlag::SetBitsIndicateTriggerXCompleted4
266    }
267    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
268    #[inline(always)]
269    pub fn is_set_bits_indicate_trigger_x_completed_5(&self) -> bool {
270        *self == TcompFlag::SetBitsIndicateTriggerXCompleted5
271    }
272    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
273    #[inline(always)]
274    pub fn is_set_bits_indicate_trigger_x_completed_6(&self) -> bool {
275        *self == TcompFlag::SetBitsIndicateTriggerXCompleted6
276    }
277    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
278    #[inline(always)]
279    pub fn is_set_bits_indicate_trigger_x_completed_7(&self) -> bool {
280        *self == TcompFlag::SetBitsIndicateTriggerXCompleted7
281    }
282    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
283    #[inline(always)]
284    pub fn is_set_bits_indicate_trigger_x_completed_8(&self) -> bool {
285        *self == TcompFlag::SetBitsIndicateTriggerXCompleted8
286    }
287    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
288    #[inline(always)]
289    pub fn is_set_bits_indicate_trigger_x_completed_9(&self) -> bool {
290        *self == TcompFlag::SetBitsIndicateTriggerXCompleted9
291    }
292    #[doc = "Every trigger sequence has been completed and every trigger has enabled completion interrupts."]
293    #[inline(always)]
294    pub fn is_all_bits_set_indicate_all_triggers_completed(&self) -> bool {
295        *self == TcompFlag::AllBitsSetIndicateAllTriggersCompleted
296    }
297}
298#[doc = "Field `TCOMP_FLAG` writer - Trigger Completion Flag"]
299pub type TcompFlagW<'a, REG> = crate::FieldWriter<'a, REG, 4, TcompFlag>;
300impl<'a, REG> TcompFlagW<'a, REG>
301where
302    REG: crate::Writable + crate::RegisterSpec,
303    REG::Ux: From<u8>,
304{
305    #[doc = "No triggers have been completed. Trigger completion interrupts are disabled."]
306    #[inline(always)]
307    pub fn no_trigger(self) -> &'a mut crate::W<REG> {
308        self.variant(TcompFlag::NoTrigger)
309    }
310    #[doc = "Trigger 0 has been completed and trigger 0 has enabled completion interrupts."]
311    #[inline(always)]
312    pub fn bit0_means_trigger_0_completed(self) -> &'a mut crate::W<REG> {
313        self.variant(TcompFlag::Bit0MeansTrigger0Completed)
314    }
315    #[doc = "Trigger 1 has been completed and trigger 1 has enabled completion interrupts."]
316    #[inline(always)]
317    pub fn bit1_means_trigger_1_completed(self) -> &'a mut crate::W<REG> {
318        self.variant(TcompFlag::Bit1MeansTrigger1Completed)
319    }
320    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
321    #[inline(always)]
322    pub fn set_bits_indicate_trigger_x_completed_3(self) -> &'a mut crate::W<REG> {
323        self.variant(TcompFlag::SetBitsIndicateTriggerXCompleted3)
324    }
325    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
326    #[inline(always)]
327    pub fn set_bits_indicate_trigger_x_completed_4(self) -> &'a mut crate::W<REG> {
328        self.variant(TcompFlag::SetBitsIndicateTriggerXCompleted4)
329    }
330    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
331    #[inline(always)]
332    pub fn set_bits_indicate_trigger_x_completed_5(self) -> &'a mut crate::W<REG> {
333        self.variant(TcompFlag::SetBitsIndicateTriggerXCompleted5)
334    }
335    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
336    #[inline(always)]
337    pub fn set_bits_indicate_trigger_x_completed_6(self) -> &'a mut crate::W<REG> {
338        self.variant(TcompFlag::SetBitsIndicateTriggerXCompleted6)
339    }
340    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
341    #[inline(always)]
342    pub fn set_bits_indicate_trigger_x_completed_7(self) -> &'a mut crate::W<REG> {
343        self.variant(TcompFlag::SetBitsIndicateTriggerXCompleted7)
344    }
345    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
346    #[inline(always)]
347    pub fn set_bits_indicate_trigger_x_completed_8(self) -> &'a mut crate::W<REG> {
348        self.variant(TcompFlag::SetBitsIndicateTriggerXCompleted8)
349    }
350    #[doc = "Associated trigger sequence has completed and has enabled completion interrupts."]
351    #[inline(always)]
352    pub fn set_bits_indicate_trigger_x_completed_9(self) -> &'a mut crate::W<REG> {
353        self.variant(TcompFlag::SetBitsIndicateTriggerXCompleted9)
354    }
355    #[doc = "Every trigger sequence has been completed and every trigger has enabled completion interrupts."]
356    #[inline(always)]
357    pub fn all_bits_set_indicate_all_triggers_completed(self) -> &'a mut crate::W<REG> {
358        self.variant(TcompFlag::AllBitsSetIndicateAllTriggersCompleted)
359    }
360}
361impl R {
362    #[doc = "Bits 0:3 - Trigger Exception Number"]
363    #[inline(always)]
364    pub fn texc_num(&self) -> TexcNumR {
365        TexcNumR::new((self.bits & 0x0f) as u8)
366    }
367    #[doc = "Bits 16:19 - Trigger Completion Flag"]
368    #[inline(always)]
369    pub fn tcomp_flag(&self) -> TcompFlagR {
370        TcompFlagR::new(((self.bits >> 16) & 0x0f) as u8)
371    }
372}
373#[cfg(feature = "debug")]
374impl core::fmt::Debug for R {
375    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
376        f.debug_struct("TSTAT")
377            .field("texc_num", &self.texc_num())
378            .field("tcomp_flag", &self.tcomp_flag())
379            .finish()
380    }
381}
382impl W {
383    #[doc = "Bits 0:3 - Trigger Exception Number"]
384    #[inline(always)]
385    pub fn texc_num(&mut self) -> TexcNumW<'_, TstatSpec> {
386        TexcNumW::new(self, 0)
387    }
388    #[doc = "Bits 16:19 - Trigger Completion Flag"]
389    #[inline(always)]
390    pub fn tcomp_flag(&mut self) -> TcompFlagW<'_, TstatSpec> {
391        TcompFlagW::new(self, 16)
392    }
393}
394#[doc = "Trigger Status Register\n\nYou can [`read`](crate::Reg::read) this register and get [`tstat::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`tstat::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
395pub struct TstatSpec;
396impl crate::RegisterSpec for TstatSpec {
397    type Ux = u32;
398}
399#[doc = "`read()` method returns [`tstat::R`](R) reader structure"]
400impl crate::Readable for TstatSpec {}
401#[doc = "`write(|w| ..)` method takes [`tstat::W`](W) writer structure"]
402impl crate::Writable for TstatSpec {
403    type Safety = crate::Unsafe;
404    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x000f_000f;
405}
406#[doc = "`reset()` method sets TSTAT to value 0"]
407impl crate::Resettable for TstatSpec {}