mcxa_pac/glikey0/
status.rs1#[doc = "Register `STATUS` reader"]
2pub type R = crate::R<StatusSpec>;
3#[doc = "Interrupt Status.\n\nValue on reset: 0"]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum IntStatus {
7 #[doc = "0: No effect"]
8 Disable = 0,
9 #[doc = "1: Triggers interrupt"]
10 Enable = 1,
11}
12impl From<IntStatus> for bool {
13 #[inline(always)]
14 fn from(variant: IntStatus) -> Self {
15 variant as u8 != 0
16 }
17}
18#[doc = "Field `INT_STATUS` reader - Interrupt Status."]
19pub type IntStatusR = crate::BitReader<IntStatus>;
20impl IntStatusR {
21 #[doc = "Get enumerated values variant"]
22 #[inline(always)]
23 pub const fn variant(&self) -> IntStatus {
24 match self.bits {
25 false => IntStatus::Disable,
26 true => IntStatus::Enable,
27 }
28 }
29 #[doc = "No effect"]
30 #[inline(always)]
31 pub fn is_disable(&self) -> bool {
32 *self == IntStatus::Disable
33 }
34 #[doc = "Triggers interrupt"]
35 #[inline(always)]
36 pub fn is_enable(&self) -> bool {
37 *self == IntStatus::Enable
38 }
39}
40#[doc = "Provides the current lock status of indexes.\n\nValue on reset: 0"]
41#[cfg_attr(feature = "defmt", derive(defmt::Format))]
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum LockStatus {
44 #[doc = "0: Current read index is not locked"]
45 Lock0 = 0,
46 #[doc = "1: Current read index is locked"]
47 Lock1 = 1,
48}
49impl From<LockStatus> for bool {
50 #[inline(always)]
51 fn from(variant: LockStatus) -> Self {
52 variant as u8 != 0
53 }
54}
55#[doc = "Field `LOCK_STATUS` reader - Provides the current lock status of indexes."]
56pub type LockStatusR = crate::BitReader<LockStatus>;
57impl LockStatusR {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub const fn variant(&self) -> LockStatus {
61 match self.bits {
62 false => LockStatus::Lock0,
63 true => LockStatus::Lock1,
64 }
65 }
66 #[doc = "Current read index is not locked"]
67 #[inline(always)]
68 pub fn is_lock0(&self) -> bool {
69 *self == LockStatus::Lock0
70 }
71 #[doc = "Current read index is locked"]
72 #[inline(always)]
73 pub fn is_lock1(&self) -> bool {
74 *self == LockStatus::Lock1
75 }
76}
77#[doc = "Status of the Error\n\nValue on reset: 0"]
78#[cfg_attr(feature = "defmt", derive(defmt::Format))]
79#[derive(Clone, Copy, Debug, PartialEq, Eq)]
80#[repr(u8)]
81pub enum ErrorStatus {
82 #[doc = "0: No error"]
83 Stat0 = 0,
84 #[doc = "1: FSM error has occurred"]
85 Stat1 = 1,
86 #[doc = "2: Write index out of the bound (OOB) error"]
87 Stat2 = 2,
88 #[doc = "3: Write index OOB and FSM error"]
89 Stat3 = 3,
90 #[doc = "4: Read index OOB error"]
91 Stat4 = 4,
92 #[doc = "6: Write index and read index OOB error"]
93 Stat5 = 6,
94 #[doc = "7: Read index OOB, write index OOB, and FSM error"]
95 Stat6 = 7,
96}
97impl From<ErrorStatus> for u8 {
98 #[inline(always)]
99 fn from(variant: ErrorStatus) -> Self {
100 variant as _
101 }
102}
103impl crate::FieldSpec for ErrorStatus {
104 type Ux = u8;
105}
106impl crate::IsEnum for ErrorStatus {}
107#[doc = "Field `ERROR_STATUS` reader - Status of the Error"]
108pub type ErrorStatusR = crate::FieldReader<ErrorStatus>;
109impl ErrorStatusR {
110 #[doc = "Get enumerated values variant"]
111 #[inline(always)]
112 pub const fn variant(&self) -> Option<ErrorStatus> {
113 match self.bits {
114 0 => Some(ErrorStatus::Stat0),
115 1 => Some(ErrorStatus::Stat1),
116 2 => Some(ErrorStatus::Stat2),
117 3 => Some(ErrorStatus::Stat3),
118 4 => Some(ErrorStatus::Stat4),
119 6 => Some(ErrorStatus::Stat5),
120 7 => Some(ErrorStatus::Stat6),
121 _ => None,
122 }
123 }
124 #[doc = "No error"]
125 #[inline(always)]
126 pub fn is_stat0(&self) -> bool {
127 *self == ErrorStatus::Stat0
128 }
129 #[doc = "FSM error has occurred"]
130 #[inline(always)]
131 pub fn is_stat1(&self) -> bool {
132 *self == ErrorStatus::Stat1
133 }
134 #[doc = "Write index out of the bound (OOB) error"]
135 #[inline(always)]
136 pub fn is_stat2(&self) -> bool {
137 *self == ErrorStatus::Stat2
138 }
139 #[doc = "Write index OOB and FSM error"]
140 #[inline(always)]
141 pub fn is_stat3(&self) -> bool {
142 *self == ErrorStatus::Stat3
143 }
144 #[doc = "Read index OOB error"]
145 #[inline(always)]
146 pub fn is_stat4(&self) -> bool {
147 *self == ErrorStatus::Stat4
148 }
149 #[doc = "Write index and read index OOB error"]
150 #[inline(always)]
151 pub fn is_stat5(&self) -> bool {
152 *self == ErrorStatus::Stat5
153 }
154 #[doc = "Read index OOB, write index OOB, and FSM error"]
155 #[inline(always)]
156 pub fn is_stat6(&self) -> bool {
157 *self == ErrorStatus::Stat6
158 }
159}
160#[doc = "Field `RESERVED18` reader - Reserved for Future Use"]
161pub type Reserved18R = crate::FieldReader<u16>;
162#[doc = "Field `FSM_STATE` reader - Status of FSM"]
163pub type FsmStateR = crate::FieldReader<u16>;
164impl R {
165 #[doc = "Bit 0 - Interrupt Status."]
166 #[inline(always)]
167 pub fn int_status(&self) -> IntStatusR {
168 IntStatusR::new((self.bits & 1) != 0)
169 }
170 #[doc = "Bit 1 - Provides the current lock status of indexes."]
171 #[inline(always)]
172 pub fn lock_status(&self) -> LockStatusR {
173 LockStatusR::new(((self.bits >> 1) & 1) != 0)
174 }
175 #[doc = "Bits 2:4 - Status of the Error"]
176 #[inline(always)]
177 pub fn error_status(&self) -> ErrorStatusR {
178 ErrorStatusR::new(((self.bits >> 2) & 7) as u8)
179 }
180 #[doc = "Bits 5:18 - Reserved for Future Use"]
181 #[inline(always)]
182 pub fn reserved18(&self) -> Reserved18R {
183 Reserved18R::new(((self.bits >> 5) & 0x3fff) as u16)
184 }
185 #[doc = "Bits 19:31 - Status of FSM"]
186 #[inline(always)]
187 pub fn fsm_state(&self) -> FsmStateR {
188 FsmStateR::new(((self.bits >> 19) & 0x1fff) as u16)
189 }
190}
191#[cfg(feature = "debug")]
192impl core::fmt::Debug for R {
193 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
194 f.debug_struct("STATUS")
195 .field("int_status", &self.int_status())
196 .field("lock_status", &self.lock_status())
197 .field("error_status", &self.error_status())
198 .field("reserved18", &self.reserved18())
199 .field("fsm_state", &self.fsm_state())
200 .finish()
201 }
202}
203#[doc = "Status\n\nYou can [`read`](crate::Reg::read) this register and get [`status::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
204pub struct StatusSpec;
205impl crate::RegisterSpec for StatusSpec {
206 type Ux = u32;
207}
208#[doc = "`read()` method returns [`status::R`](R) reader structure"]
209impl crate::Readable for StatusSpec {}
210#[doc = "`reset()` method sets STATUS to value 0x00b0_0000"]
211impl crate::Resettable for StatusSpec {
212 const RESET_VALUE: u32 = 0x00b0_0000;
213}