1#[doc = "Register `twi_stat` reader"]
2pub type R = crate::R<TWI_STAT_SPEC>;
3#[doc = "Field `sta` reader - "]
4pub type STA_R = crate::FieldReader<STA_A>;
5#[doc = "\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum STA_A {
9 #[doc = "0: Bus error"]
10 BE = 0,
11 #[doc = "8: START condition transmitted"]
12 SCT = 8,
13 #[doc = "16: Repeated START condition transmitted"]
14 RSCT = 16,
15 #[doc = "24: Address + Write bit transmitted, ACK received"]
16 AWBT_AR = 24,
17 #[doc = "32: Address + Write bit transmitted, ACK not received"]
18 AWBT_ANR = 32,
19 #[doc = "40: Data byte transmitted in master mode, ACK received"]
20 DBTM_AR = 40,
21 #[doc = "48: Data byte transmitted in master mode, ACK not received"]
22 DBTM_ANR = 48,
23 #[doc = "56: Arbitration lost in address or data byte"]
24 AL_A_DB = 56,
25 #[doc = "64: Address + Read bit transmitted, ACK received"]
26 ARBT_AR = 64,
27 #[doc = "72: Address + Read bit transmitted, ACK not received"]
28 ARBT_ANR = 72,
29 #[doc = "80: Data byte received in master mode, ACK transmitted"]
30 DBRM_AT = 80,
31 #[doc = "88: Data byte received in master mode, not ACK transmitted"]
32 DBRM_ANT = 88,
33 #[doc = "96: Slave address + Write bit received, ACK transmitted"]
34 SAWR_AT = 96,
35 #[doc = "104: Arbitration lost in the address as master, slave address + Write bit received, ACK transmitted"]
36 AL_AM_SAWR_AT = 104,
37 #[doc = "112: General Call address received, ACK transmitted"]
38 GCAR_AT = 112,
39 #[doc = "120: Arbitration lost in the address as master, General Call address received, ACK transmitted"]
40 AL_AM_GCAR_AT = 120,
41 #[doc = "128: Data byte received after slave address received, ACK transmitted"]
42 DBR_SAR_AT = 128,
43 #[doc = "136: Data byte received after slave address received, not ACK transmitted"]
44 DBR_SAR_ANT = 136,
45 #[doc = "144: Data byte received after General Call received, ACK transmitted"]
46 DBR_GCR_AT = 144,
47 #[doc = "152: Data byte received after General Call received, not ACK transmitted"]
48 DBR_GCR_ANT = 152,
49 #[doc = "160: STOP or repeated START condition received in slave mode"]
50 SRSCRS = 160,
51 #[doc = "168: Slave address + Read bit received, ACK transmitted"]
52 SARR_AT = 168,
53 #[doc = "176: Arbitration lost in the address as master, slave address + Read bit received, ACK transmitted"]
54 AL_AM_SARR_AT = 176,
55 #[doc = "184: Data byte transmitted in slave mode, ACK received"]
56 DBTS_AR = 184,
57 #[doc = "192: Data byte transmitted in slave mode, ACK not received"]
58 DBTS_ANR = 192,
59 #[doc = "200: The Last byte transmitted in slave mode, ACK received"]
60 LBTS_AR = 200,
61 #[doc = "208: Second Address byte + Write bit transmitted, ACK received"]
62 SAWT_AR = 208,
63 #[doc = "216: Second Address byte + Write bit transmitted, ACK not received"]
64 SAWT_ANR = 216,
65 #[doc = "248: No relevant status information, INT_FLAG=0"]
66 NRSI = 248,
67}
68impl From<STA_A> for u8 {
69 #[inline(always)]
70 fn from(variant: STA_A) -> Self {
71 variant as _
72 }
73}
74impl crate::FieldSpec for STA_A {
75 type Ux = u8;
76}
77impl STA_R {
78 #[doc = "Get enumerated values variant"]
79 #[inline(always)]
80 pub const fn variant(&self) -> Option<STA_A> {
81 match self.bits {
82 0 => Some(STA_A::BE),
83 8 => Some(STA_A::SCT),
84 16 => Some(STA_A::RSCT),
85 24 => Some(STA_A::AWBT_AR),
86 32 => Some(STA_A::AWBT_ANR),
87 40 => Some(STA_A::DBTM_AR),
88 48 => Some(STA_A::DBTM_ANR),
89 56 => Some(STA_A::AL_A_DB),
90 64 => Some(STA_A::ARBT_AR),
91 72 => Some(STA_A::ARBT_ANR),
92 80 => Some(STA_A::DBRM_AT),
93 88 => Some(STA_A::DBRM_ANT),
94 96 => Some(STA_A::SAWR_AT),
95 104 => Some(STA_A::AL_AM_SAWR_AT),
96 112 => Some(STA_A::GCAR_AT),
97 120 => Some(STA_A::AL_AM_GCAR_AT),
98 128 => Some(STA_A::DBR_SAR_AT),
99 136 => Some(STA_A::DBR_SAR_ANT),
100 144 => Some(STA_A::DBR_GCR_AT),
101 152 => Some(STA_A::DBR_GCR_ANT),
102 160 => Some(STA_A::SRSCRS),
103 168 => Some(STA_A::SARR_AT),
104 176 => Some(STA_A::AL_AM_SARR_AT),
105 184 => Some(STA_A::DBTS_AR),
106 192 => Some(STA_A::DBTS_ANR),
107 200 => Some(STA_A::LBTS_AR),
108 208 => Some(STA_A::SAWT_AR),
109 216 => Some(STA_A::SAWT_ANR),
110 248 => Some(STA_A::NRSI),
111 _ => None,
112 }
113 }
114 #[doc = "Bus error"]
115 #[inline(always)]
116 pub fn is_be(&self) -> bool {
117 *self == STA_A::BE
118 }
119 #[doc = "START condition transmitted"]
120 #[inline(always)]
121 pub fn is_sct(&self) -> bool {
122 *self == STA_A::SCT
123 }
124 #[doc = "Repeated START condition transmitted"]
125 #[inline(always)]
126 pub fn is_rsct(&self) -> bool {
127 *self == STA_A::RSCT
128 }
129 #[doc = "Address + Write bit transmitted, ACK received"]
130 #[inline(always)]
131 pub fn is_awbt_ar(&self) -> bool {
132 *self == STA_A::AWBT_AR
133 }
134 #[doc = "Address + Write bit transmitted, ACK not received"]
135 #[inline(always)]
136 pub fn is_awbt_anr(&self) -> bool {
137 *self == STA_A::AWBT_ANR
138 }
139 #[doc = "Data byte transmitted in master mode, ACK received"]
140 #[inline(always)]
141 pub fn is_dbtm_ar(&self) -> bool {
142 *self == STA_A::DBTM_AR
143 }
144 #[doc = "Data byte transmitted in master mode, ACK not received"]
145 #[inline(always)]
146 pub fn is_dbtm_anr(&self) -> bool {
147 *self == STA_A::DBTM_ANR
148 }
149 #[doc = "Arbitration lost in address or data byte"]
150 #[inline(always)]
151 pub fn is_al_a_db(&self) -> bool {
152 *self == STA_A::AL_A_DB
153 }
154 #[doc = "Address + Read bit transmitted, ACK received"]
155 #[inline(always)]
156 pub fn is_arbt_ar(&self) -> bool {
157 *self == STA_A::ARBT_AR
158 }
159 #[doc = "Address + Read bit transmitted, ACK not received"]
160 #[inline(always)]
161 pub fn is_arbt_anr(&self) -> bool {
162 *self == STA_A::ARBT_ANR
163 }
164 #[doc = "Data byte received in master mode, ACK transmitted"]
165 #[inline(always)]
166 pub fn is_dbrm_at(&self) -> bool {
167 *self == STA_A::DBRM_AT
168 }
169 #[doc = "Data byte received in master mode, not ACK transmitted"]
170 #[inline(always)]
171 pub fn is_dbrm_ant(&self) -> bool {
172 *self == STA_A::DBRM_ANT
173 }
174 #[doc = "Slave address + Write bit received, ACK transmitted"]
175 #[inline(always)]
176 pub fn is_sawr_at(&self) -> bool {
177 *self == STA_A::SAWR_AT
178 }
179 #[doc = "Arbitration lost in the address as master, slave address + Write bit received, ACK transmitted"]
180 #[inline(always)]
181 pub fn is_al_am_sawr_at(&self) -> bool {
182 *self == STA_A::AL_AM_SAWR_AT
183 }
184 #[doc = "General Call address received, ACK transmitted"]
185 #[inline(always)]
186 pub fn is_gcar_at(&self) -> bool {
187 *self == STA_A::GCAR_AT
188 }
189 #[doc = "Arbitration lost in the address as master, General Call address received, ACK transmitted"]
190 #[inline(always)]
191 pub fn is_al_am_gcar_at(&self) -> bool {
192 *self == STA_A::AL_AM_GCAR_AT
193 }
194 #[doc = "Data byte received after slave address received, ACK transmitted"]
195 #[inline(always)]
196 pub fn is_dbr_sar_at(&self) -> bool {
197 *self == STA_A::DBR_SAR_AT
198 }
199 #[doc = "Data byte received after slave address received, not ACK transmitted"]
200 #[inline(always)]
201 pub fn is_dbr_sar_ant(&self) -> bool {
202 *self == STA_A::DBR_SAR_ANT
203 }
204 #[doc = "Data byte received after General Call received, ACK transmitted"]
205 #[inline(always)]
206 pub fn is_dbr_gcr_at(&self) -> bool {
207 *self == STA_A::DBR_GCR_AT
208 }
209 #[doc = "Data byte received after General Call received, not ACK transmitted"]
210 #[inline(always)]
211 pub fn is_dbr_gcr_ant(&self) -> bool {
212 *self == STA_A::DBR_GCR_ANT
213 }
214 #[doc = "STOP or repeated START condition received in slave mode"]
215 #[inline(always)]
216 pub fn is_srscrs(&self) -> bool {
217 *self == STA_A::SRSCRS
218 }
219 #[doc = "Slave address + Read bit received, ACK transmitted"]
220 #[inline(always)]
221 pub fn is_sarr_at(&self) -> bool {
222 *self == STA_A::SARR_AT
223 }
224 #[doc = "Arbitration lost in the address as master, slave address + Read bit received, ACK transmitted"]
225 #[inline(always)]
226 pub fn is_al_am_sarr_at(&self) -> bool {
227 *self == STA_A::AL_AM_SARR_AT
228 }
229 #[doc = "Data byte transmitted in slave mode, ACK received"]
230 #[inline(always)]
231 pub fn is_dbts_ar(&self) -> bool {
232 *self == STA_A::DBTS_AR
233 }
234 #[doc = "Data byte transmitted in slave mode, ACK not received"]
235 #[inline(always)]
236 pub fn is_dbts_anr(&self) -> bool {
237 *self == STA_A::DBTS_ANR
238 }
239 #[doc = "The Last byte transmitted in slave mode, ACK received"]
240 #[inline(always)]
241 pub fn is_lbts_ar(&self) -> bool {
242 *self == STA_A::LBTS_AR
243 }
244 #[doc = "Second Address byte + Write bit transmitted, ACK received"]
245 #[inline(always)]
246 pub fn is_sawt_ar(&self) -> bool {
247 *self == STA_A::SAWT_AR
248 }
249 #[doc = "Second Address byte + Write bit transmitted, ACK not received"]
250 #[inline(always)]
251 pub fn is_sawt_anr(&self) -> bool {
252 *self == STA_A::SAWT_ANR
253 }
254 #[doc = "No relevant status information, INT_FLAG=0"]
255 #[inline(always)]
256 pub fn is_nrsi(&self) -> bool {
257 *self == STA_A::NRSI
258 }
259}
260impl R {
261 #[doc = "Bits 0:7"]
262 #[inline(always)]
263 pub fn sta(&self) -> STA_R {
264 STA_R::new((self.bits & 0xff) as u8)
265 }
266}
267#[doc = "TWI Status Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`twi_stat::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
268pub struct TWI_STAT_SPEC;
269impl crate::RegisterSpec for TWI_STAT_SPEC {
270 type Ux = u32;
271}
272#[doc = "`read()` method returns [`twi_stat::R`](R) reader structure"]
273impl crate::Readable for TWI_STAT_SPEC {}
274#[doc = "`reset()` method sets twi_stat to value 0"]
275impl crate::Resettable for TWI_STAT_SPEC {
276 const RESET_VALUE: Self::Ux = 0;
277}