mcxa_pac/udf0/
udf_status.rs1#[doc = "Register `udf_status` reader"]
2pub type R = crate::R<UdfStatusSpec>;
3#[doc = "Status bits\n\nValue on reset: 1"]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6#[repr(u8)]
7pub enum OStatus {
8 #[doc = "1: 5'b00001 = Reset"]
9 Reset = 1,
10 #[doc = "2: 5'b00010 = Init"]
11 Init = 2,
12 #[doc = "4: 5'b00100 = Warmup"]
13 Warmup = 4,
14 #[doc = "8: 5'b01000 = Ready"]
15 Ready = 8,
16 #[doc = "16: 5'b10000 = Error"]
17 Error = 16,
18}
19impl From<OStatus> for u8 {
20 #[inline(always)]
21 fn from(variant: OStatus) -> Self {
22 variant as _
23 }
24}
25impl crate::FieldSpec for OStatus {
26 type Ux = u8;
27}
28impl crate::IsEnum for OStatus {}
29#[doc = "Field `o_status` reader - Status bits"]
30pub type OStatusR = crate::FieldReader<OStatus>;
31impl OStatusR {
32 #[doc = "Get enumerated values variant"]
33 #[inline(always)]
34 pub const fn variant(&self) -> Option<OStatus> {
35 match self.bits {
36 1 => Some(OStatus::Reset),
37 2 => Some(OStatus::Init),
38 4 => Some(OStatus::Warmup),
39 8 => Some(OStatus::Ready),
40 16 => Some(OStatus::Error),
41 _ => None,
42 }
43 }
44 #[doc = "5'b00001 = Reset"]
45 #[inline(always)]
46 pub fn is_reset(&self) -> bool {
47 *self == OStatus::Reset
48 }
49 #[doc = "5'b00010 = Init"]
50 #[inline(always)]
51 pub fn is_init(&self) -> bool {
52 *self == OStatus::Init
53 }
54 #[doc = "5'b00100 = Warmup"]
55 #[inline(always)]
56 pub fn is_warmup(&self) -> bool {
57 *self == OStatus::Warmup
58 }
59 #[doc = "5'b01000 = Ready"]
60 #[inline(always)]
61 pub fn is_ready(&self) -> bool {
62 *self == OStatus::Ready
63 }
64 #[doc = "5'b10000 = Error"]
65 #[inline(always)]
66 pub fn is_error(&self) -> bool {
67 *self == OStatus::Error
68 }
69}
70#[doc = "Field `rsv` reader - RFU"]
71pub type RsvR = crate::FieldReader<u32>;
72#[doc = "Field `o_wait` reader - Indicates UDF is processing data"]
73pub type OWaitR = crate::BitReader;
74impl R {
75 #[doc = "Bits 0:4 - Status bits"]
76 #[inline(always)]
77 pub fn o_status(&self) -> OStatusR {
78 OStatusR::new((self.bits & 0x1f) as u8)
79 }
80 #[doc = "Bits 5:30 - RFU"]
81 #[inline(always)]
82 pub fn rsv(&self) -> RsvR {
83 RsvR::new((self.bits >> 5) & 0x03ff_ffff)
84 }
85 #[doc = "Bit 31 - Indicates UDF is processing data"]
86 #[inline(always)]
87 pub fn o_wait(&self) -> OWaitR {
88 OWaitR::new(((self.bits >> 31) & 1) != 0)
89 }
90}
91#[cfg(feature = "debug")]
92impl core::fmt::Debug for R {
93 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
94 f.debug_struct("udf_status")
95 .field("o_status", &self.o_status())
96 .field("rsv", &self.rsv())
97 .field("o_wait", &self.o_wait())
98 .finish()
99 }
100}
101#[doc = "Status register\n\nYou can [`read`](crate::Reg::read) this register and get [`udf_status::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
102pub struct UdfStatusSpec;
103impl crate::RegisterSpec for UdfStatusSpec {
104 type Ux = u32;
105}
106#[doc = "`read()` method returns [`udf_status::R`](R) reader structure"]
107impl crate::Readable for UdfStatusSpec {}
108#[doc = "`reset()` method sets udf_status to value 0x01"]
109impl crate::Resettable for UdfStatusSpec {
110 const RESET_VALUE: u32 = 0x01;
111}