1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
#[doc = "Register `EEP_CONT_STAT` reader"]
pub type R = crate::R<EEP_CONT_STAT_SPEC>;
#[doc = "Register `EEP_CONT_STAT` writer"]
pub type W = crate::W<EEP_CONT_STAT_SPEC>;
#[doc = "ECAT write enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum W_EN_A {
    #[doc = "0: Write requests are disabled"]
    VALUE1 = 0,
    #[doc = "1: Write requests are enabled"]
    VALUE2 = 1,
}
impl From<W_EN_A> for bool {
    #[inline(always)]
    fn from(variant: W_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `W_EN` reader - ECAT write enable"]
pub type W_EN_R = crate::BitReader<W_EN_A>;
impl W_EN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> W_EN_A {
        match self.bits {
            false => W_EN_A::VALUE1,
            true => W_EN_A::VALUE2,
        }
    }
    #[doc = "Write requests are disabled"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == W_EN_A::VALUE1
    }
    #[doc = "Write requests are enabled"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == W_EN_A::VALUE2
    }
}
#[doc = "EEPROM emulation\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EMUL_A {
    #[doc = "0: Normal operation (I2C interface used)"]
    VALUE1 = 0,
    #[doc = "1: PDI emulates EEPROM (I2C not used)"]
    VALUE2 = 1,
}
impl From<EMUL_A> for bool {
    #[inline(always)]
    fn from(variant: EMUL_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `EMUL` reader - EEPROM emulation"]
pub type EMUL_R = crate::BitReader<EMUL_A>;
impl EMUL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> EMUL_A {
        match self.bits {
            false => EMUL_A::VALUE1,
            true => EMUL_A::VALUE2,
        }
    }
    #[doc = "Normal operation (I2C interface used)"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == EMUL_A::VALUE1
    }
    #[doc = "PDI emulates EEPROM (I2C not used)"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == EMUL_A::VALUE2
    }
}
#[doc = "Supported number of EEPROM read bytes\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BYTES_A {
    #[doc = "0: 4 Bytes"]
    VALUE1 = 0,
    #[doc = "1: 8 Bytes"]
    VALUE2 = 1,
}
impl From<BYTES_A> for bool {
    #[inline(always)]
    fn from(variant: BYTES_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BYTES` reader - Supported number of EEPROM read bytes"]
pub type BYTES_R = crate::BitReader<BYTES_A>;
impl BYTES_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> BYTES_A {
        match self.bits {
            false => BYTES_A::VALUE1,
            true => BYTES_A::VALUE2,
        }
    }
    #[doc = "4 Bytes"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == BYTES_A::VALUE1
    }
    #[doc = "8 Bytes"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == BYTES_A::VALUE2
    }
}
#[doc = "Selected EEPROM Algorithm\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ALG_A {
    #[doc = "0: 1 address byte (1 KBit - 16 KBit EEPROMs)"]
    VALUE1 = 0,
    #[doc = "1: 2 address bytes (32 KBit - 4 MBit EEPROMs)"]
    VALUE2 = 1,
}
impl From<ALG_A> for bool {
    #[inline(always)]
    fn from(variant: ALG_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ALG` reader - Selected EEPROM Algorithm"]
pub type ALG_R = crate::BitReader<ALG_A>;
impl ALG_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> ALG_A {
        match self.bits {
            false => ALG_A::VALUE1,
            true => ALG_A::VALUE2,
        }
    }
    #[doc = "1 address byte (1 KBit - 16 KBit EEPROMs)"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == ALG_A::VALUE1
    }
    #[doc = "2 address bytes (32 KBit - 4 MBit EEPROMs)"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == ALG_A::VALUE2
    }
}
#[doc = "Command register\n\nValue on reset: 4"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CMD_REG_A {
    #[doc = "0: No command/EEPROM idle (clear error bits)"]
    VALUE1 = 0,
    #[doc = "1: Read"]
    VALUE2 = 1,
    #[doc = "2: Write"]
    VALUE3 = 2,
    #[doc = "4: Reload"]
    VALUE4 = 4,
}
impl From<CMD_REG_A> for u8 {
    #[inline(always)]
    fn from(variant: CMD_REG_A) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for CMD_REG_A {
    type Ux = u8;
}
impl crate::IsEnum for CMD_REG_A {}
#[doc = "Field `CMD_REG` reader - Command register"]
pub type CMD_REG_R = crate::FieldReader<CMD_REG_A>;
impl CMD_REG_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<CMD_REG_A> {
        match self.bits {
            0 => Some(CMD_REG_A::VALUE1),
            1 => Some(CMD_REG_A::VALUE2),
            2 => Some(CMD_REG_A::VALUE3),
            4 => Some(CMD_REG_A::VALUE4),
            _ => None,
        }
    }
    #[doc = "No command/EEPROM idle (clear error bits)"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == CMD_REG_A::VALUE1
    }
    #[doc = "Read"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == CMD_REG_A::VALUE2
    }
    #[doc = "Write"]
    #[inline(always)]
    pub fn is_value3(&self) -> bool {
        *self == CMD_REG_A::VALUE3
    }
    #[doc = "Reload"]
    #[inline(always)]
    pub fn is_value4(&self) -> bool {
        *self == CMD_REG_A::VALUE4
    }
}
#[doc = "Field `CMD_REG` writer - Command register"]
pub type CMD_REG_W<'a, REG> = crate::FieldWriter<'a, REG, 3, CMD_REG_A>;
impl<'a, REG> CMD_REG_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "No command/EEPROM idle (clear error bits)"]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(CMD_REG_A::VALUE1)
    }
    #[doc = "Read"]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(CMD_REG_A::VALUE2)
    }
    #[doc = "Write"]
    #[inline(always)]
    pub fn value3(self) -> &'a mut crate::W<REG> {
        self.variant(CMD_REG_A::VALUE3)
    }
    #[doc = "Reload"]
    #[inline(always)]
    pub fn value4(self) -> &'a mut crate::W<REG> {
        self.variant(CMD_REG_A::VALUE4)
    }
}
#[doc = "Checksum Error at in ESC Configuration Area\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ERROR_A {
    #[doc = "0: Checksum OK"]
    VALUE1 = 0,
    #[doc = "1: Checksum error"]
    VALUE2 = 1,
}
impl From<ERROR_A> for bool {
    #[inline(always)]
    fn from(variant: ERROR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ERROR` reader - Checksum Error at in ESC Configuration Area"]
pub type ERROR_R = crate::BitReader<ERROR_A>;
impl ERROR_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> ERROR_A {
        match self.bits {
            false => ERROR_A::VALUE1,
            true => ERROR_A::VALUE2,
        }
    }
    #[doc = "Checksum OK"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == ERROR_A::VALUE1
    }
    #[doc = "Checksum error"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == ERROR_A::VALUE2
    }
}
#[doc = "EEPROM loading status\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum L_STAT_A {
    #[doc = "0: EEPROM loaded, device information OK"]
    VALUE1 = 0,
    #[doc = "1: EEPROM not loaded, device information not available (EEPROM loading in progress or finished with a failure)"]
    VALUE2 = 1,
}
impl From<L_STAT_A> for bool {
    #[inline(always)]
    fn from(variant: L_STAT_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `L_STAT` reader - EEPROM loading status"]
pub type L_STAT_R = crate::BitReader<L_STAT_A>;
impl L_STAT_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> L_STAT_A {
        match self.bits {
            false => L_STAT_A::VALUE1,
            true => L_STAT_A::VALUE2,
        }
    }
    #[doc = "EEPROM loaded, device information OK"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == L_STAT_A::VALUE1
    }
    #[doc = "EEPROM not loaded, device information not available (EEPROM loading in progress or finished with a failure)"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == L_STAT_A::VALUE2
    }
}
#[doc = "Error Acknowledge/Command\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ERROR_AC_A {
    #[doc = "0: No error"]
    VALUE1 = 0,
    #[doc = "1: Missing EEPROM acknowledge or invalid command"]
    VALUE2 = 1,
}
impl From<ERROR_AC_A> for bool {
    #[inline(always)]
    fn from(variant: ERROR_AC_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ERROR_AC` reader - Error Acknowledge/Command"]
pub type ERROR_AC_R = crate::BitReader<ERROR_AC_A>;
impl ERROR_AC_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> ERROR_AC_A {
        match self.bits {
            false => ERROR_AC_A::VALUE1,
            true => ERROR_AC_A::VALUE2,
        }
    }
    #[doc = "No error"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == ERROR_AC_A::VALUE1
    }
    #[doc = "Missing EEPROM acknowledge or invalid command"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == ERROR_AC_A::VALUE2
    }
}
#[doc = "Field `ERROR_AC` writer - Error Acknowledge/Command"]
pub type ERROR_AC_W<'a, REG> = crate::BitWriter<'a, REG, ERROR_AC_A>;
impl<'a, REG> ERROR_AC_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "No error"]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(ERROR_AC_A::VALUE1)
    }
    #[doc = "Missing EEPROM acknowledge or invalid command"]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(ERROR_AC_A::VALUE2)
    }
}
#[doc = "Error Write Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ERROR_WE_A {
    #[doc = "0: No error"]
    VALUE1 = 0,
    #[doc = "1: Write Command without Write enable"]
    VALUE2 = 1,
}
impl From<ERROR_WE_A> for bool {
    #[inline(always)]
    fn from(variant: ERROR_WE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ERROR_WE` reader - Error Write Enable"]
pub type ERROR_WE_R = crate::BitReader<ERROR_WE_A>;
impl ERROR_WE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> ERROR_WE_A {
        match self.bits {
            false => ERROR_WE_A::VALUE1,
            true => ERROR_WE_A::VALUE2,
        }
    }
    #[doc = "No error"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == ERROR_WE_A::VALUE1
    }
    #[doc = "Write Command without Write enable"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == ERROR_WE_A::VALUE2
    }
}
#[doc = "Busy\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BUSY_A {
    #[doc = "0: EEPROM Interface is idle"]
    VALUE1 = 0,
    #[doc = "1: EEPROM Interface is busy"]
    VALUE2 = 1,
}
impl From<BUSY_A> for bool {
    #[inline(always)]
    fn from(variant: BUSY_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BUSY` reader - Busy"]
pub type BUSY_R = crate::BitReader<BUSY_A>;
impl BUSY_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> BUSY_A {
        match self.bits {
            false => BUSY_A::VALUE1,
            true => BUSY_A::VALUE2,
        }
    }
    #[doc = "EEPROM Interface is idle"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == BUSY_A::VALUE1
    }
    #[doc = "EEPROM Interface is busy"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == BUSY_A::VALUE2
    }
}
impl R {
    #[doc = "Bit 0 - ECAT write enable"]
    #[inline(always)]
    pub fn w_en(&self) -> W_EN_R {
        W_EN_R::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 5 - EEPROM emulation"]
    #[inline(always)]
    pub fn emul(&self) -> EMUL_R {
        EMUL_R::new(((self.bits >> 5) & 1) != 0)
    }
    #[doc = "Bit 6 - Supported number of EEPROM read bytes"]
    #[inline(always)]
    pub fn bytes(&self) -> BYTES_R {
        BYTES_R::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bit 7 - Selected EEPROM Algorithm"]
    #[inline(always)]
    pub fn alg(&self) -> ALG_R {
        ALG_R::new(((self.bits >> 7) & 1) != 0)
    }
    #[doc = "Bits 8:10 - Command register"]
    #[inline(always)]
    pub fn cmd_reg(&self) -> CMD_REG_R {
        CMD_REG_R::new(((self.bits >> 8) & 7) as u8)
    }
    #[doc = "Bit 11 - Checksum Error at in ESC Configuration Area"]
    #[inline(always)]
    pub fn error(&self) -> ERROR_R {
        ERROR_R::new(((self.bits >> 11) & 1) != 0)
    }
    #[doc = "Bit 12 - EEPROM loading status"]
    #[inline(always)]
    pub fn l_stat(&self) -> L_STAT_R {
        L_STAT_R::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bit 13 - Error Acknowledge/Command"]
    #[inline(always)]
    pub fn error_ac(&self) -> ERROR_AC_R {
        ERROR_AC_R::new(((self.bits >> 13) & 1) != 0)
    }
    #[doc = "Bit 14 - Error Write Enable"]
    #[inline(always)]
    pub fn error_we(&self) -> ERROR_WE_R {
        ERROR_WE_R::new(((self.bits >> 14) & 1) != 0)
    }
    #[doc = "Bit 15 - Busy"]
    #[inline(always)]
    pub fn busy(&self) -> BUSY_R {
        BUSY_R::new(((self.bits >> 15) & 1) != 0)
    }
}
impl W {
    #[doc = "Bits 8:10 - Command register"]
    #[inline(always)]
    #[must_use]
    pub fn cmd_reg(&mut self) -> CMD_REG_W<EEP_CONT_STAT_SPEC> {
        CMD_REG_W::new(self, 8)
    }
    #[doc = "Bit 13 - Error Acknowledge/Command"]
    #[inline(always)]
    #[must_use]
    pub fn error_ac(&mut self) -> ERROR_AC_W<EEP_CONT_STAT_SPEC> {
        ERROR_AC_W::new(self, 13)
    }
}
#[doc = "EEPROM Control/Status\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`eep_cont_stat::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`eep_cont_stat::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct EEP_CONT_STAT_SPEC;
impl crate::RegisterSpec for EEP_CONT_STAT_SPEC {
    type Ux = u16;
}
#[doc = "`read()` method returns [`eep_cont_stat::R`](R) reader structure"]
impl crate::Readable for EEP_CONT_STAT_SPEC {}
#[doc = "`write(|w| ..)` method takes [`eep_cont_stat::W`](W) writer structure"]
impl crate::Writable for EEP_CONT_STAT_SPEC {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
}
#[doc = "`reset()` method sets EEP_CONT_STAT to value 0x9460"]
impl crate::Resettable for EEP_CONT_STAT_SPEC {
    const RESET_VALUE: u16 = 0x9460;
}