1#[doc = "Register `STAT` reader"]
2pub type R = crate::R<StatSpec>;
3#[doc = "Register `STAT` writer"]
4pub type W = crate::W<StatSpec>;
5#[doc = "Result FIFO 0 Ready Flag\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Rdy0 {
9 #[doc = "0: Result FIFO 0 data level not above watermark level."]
10 BelowThreshold = 0,
11 #[doc = "1: Result FIFO 0 holding data above watermark level."]
12 AboveThreshold = 1,
13}
14impl From<Rdy0> for bool {
15 #[inline(always)]
16 fn from(variant: Rdy0) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `RDY0` reader - Result FIFO 0 Ready Flag"]
21pub type Rdy0R = crate::BitReader<Rdy0>;
22impl Rdy0R {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> Rdy0 {
26 match self.bits {
27 false => Rdy0::BelowThreshold,
28 true => Rdy0::AboveThreshold,
29 }
30 }
31 #[doc = "Result FIFO 0 data level not above watermark level."]
32 #[inline(always)]
33 pub fn is_below_threshold(&self) -> bool {
34 *self == Rdy0::BelowThreshold
35 }
36 #[doc = "Result FIFO 0 holding data above watermark level."]
37 #[inline(always)]
38 pub fn is_above_threshold(&self) -> bool {
39 *self == Rdy0::AboveThreshold
40 }
41}
42#[doc = "Result FIFO 0 Overflow Flag\n\nValue on reset: 0"]
43#[cfg_attr(feature = "defmt", derive(defmt::Format))]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum Fof0 {
46 #[doc = "0: No result FIFO 0 overflow has occurred since the last time the flag was cleared."]
47 NoOverflow = 0,
48 #[doc = "1: At least one result FIFO 0 overflow has occurred since the last time the flag was cleared."]
49 OverflowDetected = 1,
50}
51impl From<Fof0> for bool {
52 #[inline(always)]
53 fn from(variant: Fof0) -> Self {
54 variant as u8 != 0
55 }
56}
57#[doc = "Field `FOF0` reader - Result FIFO 0 Overflow Flag"]
58pub type Fof0R = crate::BitReader<Fof0>;
59impl Fof0R {
60 #[doc = "Get enumerated values variant"]
61 #[inline(always)]
62 pub const fn variant(&self) -> Fof0 {
63 match self.bits {
64 false => Fof0::NoOverflow,
65 true => Fof0::OverflowDetected,
66 }
67 }
68 #[doc = "No result FIFO 0 overflow has occurred since the last time the flag was cleared."]
69 #[inline(always)]
70 pub fn is_no_overflow(&self) -> bool {
71 *self == Fof0::NoOverflow
72 }
73 #[doc = "At least one result FIFO 0 overflow has occurred since the last time the flag was cleared."]
74 #[inline(always)]
75 pub fn is_overflow_detected(&self) -> bool {
76 *self == Fof0::OverflowDetected
77 }
78}
79#[doc = "Field `FOF0` writer - Result FIFO 0 Overflow Flag"]
80pub type Fof0W<'a, REG> = crate::BitWriter1C<'a, REG, Fof0>;
81impl<'a, REG> Fof0W<'a, REG>
82where
83 REG: crate::Writable + crate::RegisterSpec,
84{
85 #[doc = "No result FIFO 0 overflow has occurred since the last time the flag was cleared."]
86 #[inline(always)]
87 pub fn no_overflow(self) -> &'a mut crate::W<REG> {
88 self.variant(Fof0::NoOverflow)
89 }
90 #[doc = "At least one result FIFO 0 overflow has occurred since the last time the flag was cleared."]
91 #[inline(always)]
92 pub fn overflow_detected(self) -> &'a mut crate::W<REG> {
93 self.variant(Fof0::OverflowDetected)
94 }
95}
96#[doc = "Interrupt Flag For High Priority Trigger Exception\n\nValue on reset: 0"]
97#[cfg_attr(feature = "defmt", derive(defmt::Format))]
98#[derive(Clone, Copy, Debug, PartialEq, Eq)]
99pub enum TexcInt {
100 #[doc = "0: No trigger exceptions have occurred."]
101 NoException = 0,
102 #[doc = "1: A trigger exception has occurred and is pending acknowledgement."]
103 ExceptionDetected = 1,
104}
105impl From<TexcInt> for bool {
106 #[inline(always)]
107 fn from(variant: TexcInt) -> Self {
108 variant as u8 != 0
109 }
110}
111#[doc = "Field `TEXC_INT` reader - Interrupt Flag For High Priority Trigger Exception"]
112pub type TexcIntR = crate::BitReader<TexcInt>;
113impl TexcIntR {
114 #[doc = "Get enumerated values variant"]
115 #[inline(always)]
116 pub const fn variant(&self) -> TexcInt {
117 match self.bits {
118 false => TexcInt::NoException,
119 true => TexcInt::ExceptionDetected,
120 }
121 }
122 #[doc = "No trigger exceptions have occurred."]
123 #[inline(always)]
124 pub fn is_no_exception(&self) -> bool {
125 *self == TexcInt::NoException
126 }
127 #[doc = "A trigger exception has occurred and is pending acknowledgement."]
128 #[inline(always)]
129 pub fn is_exception_detected(&self) -> bool {
130 *self == TexcInt::ExceptionDetected
131 }
132}
133#[doc = "Field `TEXC_INT` writer - Interrupt Flag For High Priority Trigger Exception"]
134pub type TexcIntW<'a, REG> = crate::BitWriter1C<'a, REG, TexcInt>;
135impl<'a, REG> TexcIntW<'a, REG>
136where
137 REG: crate::Writable + crate::RegisterSpec,
138{
139 #[doc = "No trigger exceptions have occurred."]
140 #[inline(always)]
141 pub fn no_exception(self) -> &'a mut crate::W<REG> {
142 self.variant(TexcInt::NoException)
143 }
144 #[doc = "A trigger exception has occurred and is pending acknowledgement."]
145 #[inline(always)]
146 pub fn exception_detected(self) -> &'a mut crate::W<REG> {
147 self.variant(TexcInt::ExceptionDetected)
148 }
149}
150#[doc = "Interrupt Flag For Trigger Completion\n\nValue on reset: 0"]
151#[cfg_attr(feature = "defmt", derive(defmt::Format))]
152#[derive(Clone, Copy, Debug, PartialEq, Eq)]
153pub enum TcompInt {
154 #[doc = "0: Either IE\\[TCOMP_IE\\] is set to 0, or no trigger sequences have run to completion."]
155 FlagClear = 0,
156 #[doc = "1: Trigger sequence has been completed and all data is stored in the associated FIFO."]
157 CompletionDetected = 1,
158}
159impl From<TcompInt> for bool {
160 #[inline(always)]
161 fn from(variant: TcompInt) -> Self {
162 variant as u8 != 0
163 }
164}
165#[doc = "Field `TCOMP_INT` reader - Interrupt Flag For Trigger Completion"]
166pub type TcompIntR = crate::BitReader<TcompInt>;
167impl TcompIntR {
168 #[doc = "Get enumerated values variant"]
169 #[inline(always)]
170 pub const fn variant(&self) -> TcompInt {
171 match self.bits {
172 false => TcompInt::FlagClear,
173 true => TcompInt::CompletionDetected,
174 }
175 }
176 #[doc = "Either IE\\[TCOMP_IE\\] is set to 0, or no trigger sequences have run to completion."]
177 #[inline(always)]
178 pub fn is_flag_clear(&self) -> bool {
179 *self == TcompInt::FlagClear
180 }
181 #[doc = "Trigger sequence has been completed and all data is stored in the associated FIFO."]
182 #[inline(always)]
183 pub fn is_completion_detected(&self) -> bool {
184 *self == TcompInt::CompletionDetected
185 }
186}
187#[doc = "Field `TCOMP_INT` writer - Interrupt Flag For Trigger Completion"]
188pub type TcompIntW<'a, REG> = crate::BitWriter1C<'a, REG, TcompInt>;
189impl<'a, REG> TcompIntW<'a, REG>
190where
191 REG: crate::Writable + crate::RegisterSpec,
192{
193 #[doc = "Either IE\\[TCOMP_IE\\] is set to 0, or no trigger sequences have run to completion."]
194 #[inline(always)]
195 pub fn flag_clear(self) -> &'a mut crate::W<REG> {
196 self.variant(TcompInt::FlagClear)
197 }
198 #[doc = "Trigger sequence has been completed and all data is stored in the associated FIFO."]
199 #[inline(always)]
200 pub fn completion_detected(self) -> &'a mut crate::W<REG> {
201 self.variant(TcompInt::CompletionDetected)
202 }
203}
204#[doc = "Calibration Ready\n\nValue on reset: 0"]
205#[cfg_attr(feature = "defmt", derive(defmt::Format))]
206#[derive(Clone, Copy, Debug, PartialEq, Eq)]
207pub enum CalRdy {
208 #[doc = "0: Calibration is incomplete or hasn't been ran."]
209 NotSet = 0,
210 #[doc = "1: The ADC is calibrated."]
211 HardwareCalStepCompleted = 1,
212}
213impl From<CalRdy> for bool {
214 #[inline(always)]
215 fn from(variant: CalRdy) -> Self {
216 variant as u8 != 0
217 }
218}
219#[doc = "Field `CAL_RDY` reader - Calibration Ready"]
220pub type CalRdyR = crate::BitReader<CalRdy>;
221impl CalRdyR {
222 #[doc = "Get enumerated values variant"]
223 #[inline(always)]
224 pub const fn variant(&self) -> CalRdy {
225 match self.bits {
226 false => CalRdy::NotSet,
227 true => CalRdy::HardwareCalStepCompleted,
228 }
229 }
230 #[doc = "Calibration is incomplete or hasn't been ran."]
231 #[inline(always)]
232 pub fn is_not_set(&self) -> bool {
233 *self == CalRdy::NotSet
234 }
235 #[doc = "The ADC is calibrated."]
236 #[inline(always)]
237 pub fn is_hardware_cal_step_completed(&self) -> bool {
238 *self == CalRdy::HardwareCalStepCompleted
239 }
240}
241#[doc = "ADC Active\n\nValue on reset: 0"]
242#[cfg_attr(feature = "defmt", derive(defmt::Format))]
243#[derive(Clone, Copy, Debug, PartialEq, Eq)]
244pub enum AdcActive {
245 #[doc = "0: The ADC is IDLE. There are no pending triggers to service and no active commands are being processed."]
246 NotActive = 0,
247 #[doc = "1: The ADC is processing a conversion, running through the power up delay, or servicing a trigger."]
248 Busy = 1,
249}
250impl From<AdcActive> for bool {
251 #[inline(always)]
252 fn from(variant: AdcActive) -> Self {
253 variant as u8 != 0
254 }
255}
256#[doc = "Field `ADC_ACTIVE` reader - ADC Active"]
257pub type AdcActiveR = crate::BitReader<AdcActive>;
258impl AdcActiveR {
259 #[doc = "Get enumerated values variant"]
260 #[inline(always)]
261 pub const fn variant(&self) -> AdcActive {
262 match self.bits {
263 false => AdcActive::NotActive,
264 true => AdcActive::Busy,
265 }
266 }
267 #[doc = "The ADC is IDLE. There are no pending triggers to service and no active commands are being processed."]
268 #[inline(always)]
269 pub fn is_not_active(&self) -> bool {
270 *self == AdcActive::NotActive
271 }
272 #[doc = "The ADC is processing a conversion, running through the power up delay, or servicing a trigger."]
273 #[inline(always)]
274 pub fn is_busy(&self) -> bool {
275 *self == AdcActive::Busy
276 }
277}
278#[doc = "Trigger Active\n\nValue on reset: 0"]
279#[cfg_attr(feature = "defmt", derive(defmt::Format))]
280#[derive(Clone, Copy, Debug, PartialEq, Eq)]
281#[repr(u8)]
282pub enum Trgact {
283 #[doc = "0: Command (sequence) associated with Trigger 0 currently being executed."]
284 Trig0 = 0,
285 #[doc = "1: Command (sequence) associated with Trigger 1 currently being executed."]
286 Trig1 = 1,
287 #[doc = "2: Command (sequence) associated with Trigger 2 currently being executed."]
288 Trig2 = 2,
289 #[doc = "3: Command (sequence) associated with Trigger 3 currently being executed."]
290 Trig3 = 3,
291}
292impl From<Trgact> for u8 {
293 #[inline(always)]
294 fn from(variant: Trgact) -> Self {
295 variant as _
296 }
297}
298impl crate::FieldSpec for Trgact {
299 type Ux = u8;
300}
301impl crate::IsEnum for Trgact {}
302#[doc = "Field `TRGACT` reader - Trigger Active"]
303pub type TrgactR = crate::FieldReader<Trgact>;
304impl TrgactR {
305 #[doc = "Get enumerated values variant"]
306 #[inline(always)]
307 pub const fn variant(&self) -> Trgact {
308 match self.bits {
309 0 => Trgact::Trig0,
310 1 => Trgact::Trig1,
311 2 => Trgact::Trig2,
312 3 => Trgact::Trig3,
313 _ => unreachable!(),
314 }
315 }
316 #[doc = "Command (sequence) associated with Trigger 0 currently being executed."]
317 #[inline(always)]
318 pub fn is_trig_0(&self) -> bool {
319 *self == Trgact::Trig0
320 }
321 #[doc = "Command (sequence) associated with Trigger 1 currently being executed."]
322 #[inline(always)]
323 pub fn is_trig_1(&self) -> bool {
324 *self == Trgact::Trig1
325 }
326 #[doc = "Command (sequence) associated with Trigger 2 currently being executed."]
327 #[inline(always)]
328 pub fn is_trig_2(&self) -> bool {
329 *self == Trgact::Trig2
330 }
331 #[doc = "Command (sequence) associated with Trigger 3 currently being executed."]
332 #[inline(always)]
333 pub fn is_trig_3(&self) -> bool {
334 *self == Trgact::Trig3
335 }
336}
337#[doc = "Command Active\n\nValue on reset: 0"]
338#[cfg_attr(feature = "defmt", derive(defmt::Format))]
339#[derive(Clone, Copy, Debug, PartialEq, Eq)]
340#[repr(u8)]
341pub enum Cmdact {
342 #[doc = "0: No command is currently in progress."]
343 NoCommandActive = 0,
344 #[doc = "1: Command 1 currently being executed."]
345 Command1 = 1,
346 #[doc = "2: Command 2 currently being executed."]
347 Command2 = 2,
348 #[doc = "3: Associated command number is currently being executed."]
349 CommandX3 = 3,
350 #[doc = "4: Associated command number is currently being executed."]
351 CommandX4 = 4,
352 #[doc = "5: Associated command number is currently being executed."]
353 CommandX5 = 5,
354 #[doc = "6: Associated command number is currently being executed."]
355 CommandX6 = 6,
356 #[doc = "7: Associated command number is currently being executed."]
357 CommandX7 = 7,
358}
359impl From<Cmdact> for u8 {
360 #[inline(always)]
361 fn from(variant: Cmdact) -> Self {
362 variant as _
363 }
364}
365impl crate::FieldSpec for Cmdact {
366 type Ux = u8;
367}
368impl crate::IsEnum for Cmdact {}
369#[doc = "Field `CMDACT` reader - Command Active"]
370pub type CmdactR = crate::FieldReader<Cmdact>;
371impl CmdactR {
372 #[doc = "Get enumerated values variant"]
373 #[inline(always)]
374 pub const fn variant(&self) -> Cmdact {
375 match self.bits {
376 0 => Cmdact::NoCommandActive,
377 1 => Cmdact::Command1,
378 2 => Cmdact::Command2,
379 3 => Cmdact::CommandX3,
380 4 => Cmdact::CommandX4,
381 5 => Cmdact::CommandX5,
382 6 => Cmdact::CommandX6,
383 7 => Cmdact::CommandX7,
384 _ => unreachable!(),
385 }
386 }
387 #[doc = "No command is currently in progress."]
388 #[inline(always)]
389 pub fn is_no_command_active(&self) -> bool {
390 *self == Cmdact::NoCommandActive
391 }
392 #[doc = "Command 1 currently being executed."]
393 #[inline(always)]
394 pub fn is_command_1(&self) -> bool {
395 *self == Cmdact::Command1
396 }
397 #[doc = "Command 2 currently being executed."]
398 #[inline(always)]
399 pub fn is_command_2(&self) -> bool {
400 *self == Cmdact::Command2
401 }
402 #[doc = "Associated command number is currently being executed."]
403 #[inline(always)]
404 pub fn is_command_x_3(&self) -> bool {
405 *self == Cmdact::CommandX3
406 }
407 #[doc = "Associated command number is currently being executed."]
408 #[inline(always)]
409 pub fn is_command_x_4(&self) -> bool {
410 *self == Cmdact::CommandX4
411 }
412 #[doc = "Associated command number is currently being executed."]
413 #[inline(always)]
414 pub fn is_command_x_5(&self) -> bool {
415 *self == Cmdact::CommandX5
416 }
417 #[doc = "Associated command number is currently being executed."]
418 #[inline(always)]
419 pub fn is_command_x_6(&self) -> bool {
420 *self == Cmdact::CommandX6
421 }
422 #[doc = "Associated command number is currently being executed."]
423 #[inline(always)]
424 pub fn is_command_x_7(&self) -> bool {
425 *self == Cmdact::CommandX7
426 }
427}
428impl R {
429 #[doc = "Bit 0 - Result FIFO 0 Ready Flag"]
430 #[inline(always)]
431 pub fn rdy0(&self) -> Rdy0R {
432 Rdy0R::new((self.bits & 1) != 0)
433 }
434 #[doc = "Bit 1 - Result FIFO 0 Overflow Flag"]
435 #[inline(always)]
436 pub fn fof0(&self) -> Fof0R {
437 Fof0R::new(((self.bits >> 1) & 1) != 0)
438 }
439 #[doc = "Bit 8 - Interrupt Flag For High Priority Trigger Exception"]
440 #[inline(always)]
441 pub fn texc_int(&self) -> TexcIntR {
442 TexcIntR::new(((self.bits >> 8) & 1) != 0)
443 }
444 #[doc = "Bit 9 - Interrupt Flag For Trigger Completion"]
445 #[inline(always)]
446 pub fn tcomp_int(&self) -> TcompIntR {
447 TcompIntR::new(((self.bits >> 9) & 1) != 0)
448 }
449 #[doc = "Bit 10 - Calibration Ready"]
450 #[inline(always)]
451 pub fn cal_rdy(&self) -> CalRdyR {
452 CalRdyR::new(((self.bits >> 10) & 1) != 0)
453 }
454 #[doc = "Bit 11 - ADC Active"]
455 #[inline(always)]
456 pub fn adc_active(&self) -> AdcActiveR {
457 AdcActiveR::new(((self.bits >> 11) & 1) != 0)
458 }
459 #[doc = "Bits 16:17 - Trigger Active"]
460 #[inline(always)]
461 pub fn trgact(&self) -> TrgactR {
462 TrgactR::new(((self.bits >> 16) & 3) as u8)
463 }
464 #[doc = "Bits 24:26 - Command Active"]
465 #[inline(always)]
466 pub fn cmdact(&self) -> CmdactR {
467 CmdactR::new(((self.bits >> 24) & 7) as u8)
468 }
469}
470#[cfg(feature = "debug")]
471impl core::fmt::Debug for R {
472 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
473 f.debug_struct("STAT")
474 .field("rdy0", &self.rdy0())
475 .field("fof0", &self.fof0())
476 .field("texc_int", &self.texc_int())
477 .field("tcomp_int", &self.tcomp_int())
478 .field("cal_rdy", &self.cal_rdy())
479 .field("adc_active", &self.adc_active())
480 .field("trgact", &self.trgact())
481 .field("cmdact", &self.cmdact())
482 .finish()
483 }
484}
485impl W {
486 #[doc = "Bit 1 - Result FIFO 0 Overflow Flag"]
487 #[inline(always)]
488 pub fn fof0(&mut self) -> Fof0W<'_, StatSpec> {
489 Fof0W::new(self, 1)
490 }
491 #[doc = "Bit 8 - Interrupt Flag For High Priority Trigger Exception"]
492 #[inline(always)]
493 pub fn texc_int(&mut self) -> TexcIntW<'_, StatSpec> {
494 TexcIntW::new(self, 8)
495 }
496 #[doc = "Bit 9 - Interrupt Flag For Trigger Completion"]
497 #[inline(always)]
498 pub fn tcomp_int(&mut self) -> TcompIntW<'_, StatSpec> {
499 TcompIntW::new(self, 9)
500 }
501}
502#[doc = "Status Register\n\nYou can [`read`](crate::Reg::read) this register and get [`stat::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`stat::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
503pub struct StatSpec;
504impl crate::RegisterSpec for StatSpec {
505 type Ux = u32;
506}
507#[doc = "`read()` method returns [`stat::R`](R) reader structure"]
508impl crate::Readable for StatSpec {}
509#[doc = "`write(|w| ..)` method takes [`stat::W`](W) writer structure"]
510impl crate::Writable for StatSpec {
511 type Safety = crate::Unsafe;
512 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x0302;
513}
514#[doc = "`reset()` method sets STAT to value 0"]
515impl crate::Resettable for StatSpec {}