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
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
#[doc = "Reader of register I2C_STATUS"]
pub type R = crate::R<u32, super::I2C_STATUS>;
#[doc = "Same as BUS_ERROR_S: Bus error status bit (sticky) - This status bit is automatically reset when the I2C_STATUS register is read.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ERROR_S_A {
    #[doc = "0: I2C interface is not and has not been in the bus error state"]
    I2C_NO_ERROR_S = 0,
    #[doc = "1: I2C interface is or has been in the bus error state"]
    I2C_ERROR_S = 1,
}
impl From<ERROR_S_A> for bool {
    #[inline(always)]
    fn from(variant: ERROR_S_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `ERROR_S`"]
pub type ERROR_S_R = crate::R<bool, ERROR_S_A>;
impl ERROR_S_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ERROR_S_A {
        match self.bits {
            false => ERROR_S_A::I2C_NO_ERROR_S,
            true => ERROR_S_A::I2C_ERROR_S,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_NO_ERROR_S`"]
    #[inline(always)]
    pub fn is_i2c_no_error_s(&self) -> bool {
        *self == ERROR_S_A::I2C_NO_ERROR_S
    }
    #[doc = "Checks if the value of the field is `I2C_ERROR_S`"]
    #[inline(always)]
    pub fn is_i2c_error_s(&self) -> bool {
        *self == ERROR_S_A::I2C_ERROR_S
    }
}
#[doc = "Bus error status bit (sticky) - This status bit is automatically reset when the I2C_STATUS register is read.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BUS_ERROR_S_A {
    #[doc = "0: I2C interface is not and has not been in the bus error state"]
    I2C_NO_BUS_ERROR_S = 0,
    #[doc = "1: I2C interface is or has been in the bus error state"]
    I2C_BUS_ERROR_S = 1,
}
impl From<BUS_ERROR_S_A> for bool {
    #[inline(always)]
    fn from(variant: BUS_ERROR_S_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `BUS_ERROR_S`"]
pub type BUS_ERROR_S_R = crate::R<bool, BUS_ERROR_S_A>;
impl BUS_ERROR_S_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BUS_ERROR_S_A {
        match self.bits {
            false => BUS_ERROR_S_A::I2C_NO_BUS_ERROR_S,
            true => BUS_ERROR_S_A::I2C_BUS_ERROR_S,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_NO_BUS_ERROR_S`"]
    #[inline(always)]
    pub fn is_i2c_no_bus_error_s(&self) -> bool {
        *self == BUS_ERROR_S_A::I2C_NO_BUS_ERROR_S
    }
    #[doc = "Checks if the value of the field is `I2C_BUS_ERROR_S`"]
    #[inline(always)]
    pub fn is_i2c_bus_error_s(&self) -> bool {
        *self == BUS_ERROR_S_A::I2C_BUS_ERROR_S
    }
}
#[doc = "Master frame start pending status bit\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum START_PENDING_A {
    #[doc = "0: No pending master start frame"]
    I2C_START_NOT_PENDING = 0,
    #[doc = "1: A master frame is pending to start (bit is set when I2C_ADDR_START is written)"]
    I2C_START_PENDING = 1,
}
impl From<START_PENDING_A> for bool {
    #[inline(always)]
    fn from(variant: START_PENDING_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `START_PENDING`"]
pub type START_PENDING_R = crate::R<bool, START_PENDING_A>;
impl START_PENDING_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> START_PENDING_A {
        match self.bits {
            false => START_PENDING_A::I2C_START_NOT_PENDING,
            true => START_PENDING_A::I2C_START_PENDING,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_START_NOT_PENDING`"]
    #[inline(always)]
    pub fn is_i2c_start_not_pending(&self) -> bool {
        *self == START_PENDING_A::I2C_START_NOT_PENDING
    }
    #[doc = "Checks if the value of the field is `I2C_START_PENDING`"]
    #[inline(always)]
    pub fn is_i2c_start_pending(&self) -> bool {
        *self == START_PENDING_A::I2C_START_PENDING
    }
}
#[doc = "Master mode status bit\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MASTER_MODE_A {
    #[doc = "0: I2C interface is not operating in master mode"]
    I2C_MASTER_INACTIVE = 0,
    #[doc = "1: I2C interface is operating in master mode"]
    I2C_MASTER_ACTIVE = 1,
}
impl From<MASTER_MODE_A> for bool {
    #[inline(always)]
    fn from(variant: MASTER_MODE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `MASTER_MODE`"]
pub type MASTER_MODE_R = crate::R<bool, MASTER_MODE_A>;
impl MASTER_MODE_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> MASTER_MODE_A {
        match self.bits {
            false => MASTER_MODE_A::I2C_MASTER_INACTIVE,
            true => MASTER_MODE_A::I2C_MASTER_ACTIVE,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_MASTER_INACTIVE`"]
    #[inline(always)]
    pub fn is_i2c_master_inactive(&self) -> bool {
        *self == MASTER_MODE_A::I2C_MASTER_INACTIVE
    }
    #[doc = "Checks if the value of the field is `I2C_MASTER_ACTIVE`"]
    #[inline(always)]
    pub fn is_i2c_master_active(&self) -> bool {
        *self == MASTER_MODE_A::I2C_MASTER_ACTIVE
    }
}
#[doc = "Indicate if the I2C interface is currently requesting DMA data\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DMA_REQ_A {
    #[doc = "0: The I2C interface is not requesting a DMA action"]
    I2C_NO_DMA_REQUEST = 0,
    #[doc = "1: The I2C interface is requesting a DMA action"]
    I2C_DMA_REQUEST = 1,
}
impl From<DMA_REQ_A> for bool {
    #[inline(always)]
    fn from(variant: DMA_REQ_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `DMA_REQ`"]
pub type DMA_REQ_R = crate::R<bool, DMA_REQ_A>;
impl DMA_REQ_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> DMA_REQ_A {
        match self.bits {
            false => DMA_REQ_A::I2C_NO_DMA_REQUEST,
            true => DMA_REQ_A::I2C_DMA_REQUEST,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_NO_DMA_REQUEST`"]
    #[inline(always)]
    pub fn is_i2c_no_dma_request(&self) -> bool {
        *self == DMA_REQ_A::I2C_NO_DMA_REQUEST
    }
    #[doc = "Checks if the value of the field is `I2C_DMA_REQUEST`"]
    #[inline(always)]
    pub fn is_i2c_dma_request(&self) -> bool {
        *self == DMA_REQ_A::I2C_DMA_REQUEST
    }
}
#[doc = "Indicate if an I2C stop bit has been detected\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum STOP_DETECT_A {
    #[doc = "0: No stop condition has been detected on the I2C bus"]
    I2C_NO_STOP_DETECTED = 0,
    #[doc = "1: A stop condition has been detected on the I2C bus"]
    I2C_STOP_DETECTED = 1,
}
impl From<STOP_DETECT_A> for bool {
    #[inline(always)]
    fn from(variant: STOP_DETECT_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `STOP_DETECT`"]
pub type STOP_DETECT_R = crate::R<bool, STOP_DETECT_A>;
impl STOP_DETECT_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> STOP_DETECT_A {
        match self.bits {
            false => STOP_DETECT_A::I2C_NO_STOP_DETECTED,
            true => STOP_DETECT_A::I2C_STOP_DETECTED,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_NO_STOP_DETECTED`"]
    #[inline(always)]
    pub fn is_i2c_no_stop_detected(&self) -> bool {
        *self == STOP_DETECT_A::I2C_NO_STOP_DETECTED
    }
    #[doc = "Checks if the value of the field is `I2C_STOP_DETECTED`"]
    #[inline(always)]
    pub fn is_i2c_stop_detected(&self) -> bool {
        *self == STOP_DETECT_A::I2C_STOP_DETECTED
    }
}
#[doc = "Indicate that I2C interface either needs data to transmit or has received data\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DATA_EVENT_A {
    #[doc = "0: No I2C data is needed or available"]
    I2C_NON_DATA_EVENT = 0,
    #[doc = "1: I2C data is needed or is available"]
    I2C_DATA_EVENT = 1,
}
impl From<DATA_EVENT_A> for bool {
    #[inline(always)]
    fn from(variant: DATA_EVENT_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `DATA_EVENT`"]
pub type DATA_EVENT_R = crate::R<bool, DATA_EVENT_A>;
impl DATA_EVENT_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> DATA_EVENT_A {
        match self.bits {
            false => DATA_EVENT_A::I2C_NON_DATA_EVENT,
            true => DATA_EVENT_A::I2C_DATA_EVENT,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_NON_DATA_EVENT`"]
    #[inline(always)]
    pub fn is_i2c_non_data_event(&self) -> bool {
        *self == DATA_EVENT_A::I2C_NON_DATA_EVENT
    }
    #[doc = "Checks if the value of the field is `I2C_DATA_EVENT`"]
    #[inline(always)]
    pub fn is_i2c_data_event(&self) -> bool {
        *self == DATA_EVENT_A::I2C_DATA_EVENT
    }
}
#[doc = "Same as BUS_ERROR: Indicate if the I2C interface has detected a bus error (automatically cleared when a stop condition is detected)\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ERROR_A {
    #[doc = "0: I2C interface is not in the bus error state"]
    I2C_NO_ERROR = 0,
    #[doc = "1: I2C interface is in the bus error state"]
    I2C_ERROR = 1,
}
impl From<ERROR_A> for bool {
    #[inline(always)]
    fn from(variant: ERROR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `ERROR`"]
pub type ERROR_R = crate::R<bool, ERROR_A>;
impl ERROR_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ERROR_A {
        match self.bits {
            false => ERROR_A::I2C_NO_ERROR,
            true => ERROR_A::I2C_ERROR,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_NO_ERROR`"]
    #[inline(always)]
    pub fn is_i2c_no_error(&self) -> bool {
        *self == ERROR_A::I2C_NO_ERROR
    }
    #[doc = "Checks if the value of the field is `I2C_ERROR`"]
    #[inline(always)]
    pub fn is_i2c_error(&self) -> bool {
        *self == ERROR_A::I2C_ERROR
    }
}
#[doc = "Indicate if the I2C interface has detected a bus error (automatically cleared when a stop condition is detected)\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BUS_ERROR_A {
    #[doc = "0: I2C interface is not in the bus error state"]
    I2C_NO_BUS_ERROR = 0,
    #[doc = "1: I2C interface is in the bus error state"]
    I2C_BUS_ERROR = 1,
}
impl From<BUS_ERROR_A> for bool {
    #[inline(always)]
    fn from(variant: BUS_ERROR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `BUS_ERROR`"]
pub type BUS_ERROR_R = crate::R<bool, BUS_ERROR_A>;
impl BUS_ERROR_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BUS_ERROR_A {
        match self.bits {
            false => BUS_ERROR_A::I2C_NO_BUS_ERROR,
            true => BUS_ERROR_A::I2C_BUS_ERROR,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_NO_BUS_ERROR`"]
    #[inline(always)]
    pub fn is_i2c_no_bus_error(&self) -> bool {
        *self == BUS_ERROR_A::I2C_NO_BUS_ERROR
    }
    #[doc = "Checks if the value of the field is `I2C_BUS_ERROR`"]
    #[inline(always)]
    pub fn is_i2c_bus_error(&self) -> bool {
        *self == BUS_ERROR_A::I2C_BUS_ERROR
    }
}
#[doc = "Indicate if the I2C data buffer is full\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BUFFER_FULL_A {
    #[doc = "0: The I2C interface buffer is empty"]
    I2C_BUFFER_EMPTY = 0,
    #[doc = "1: The I2C interface buffer is full"]
    I2C_BUFFER_FULL = 1,
}
impl From<BUFFER_FULL_A> for bool {
    #[inline(always)]
    fn from(variant: BUFFER_FULL_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `BUFFER_FULL`"]
pub type BUFFER_FULL_R = crate::R<bool, BUFFER_FULL_A>;
impl BUFFER_FULL_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BUFFER_FULL_A {
        match self.bits {
            false => BUFFER_FULL_A::I2C_BUFFER_EMPTY,
            true => BUFFER_FULL_A::I2C_BUFFER_FULL,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_BUFFER_EMPTY`"]
    #[inline(always)]
    pub fn is_i2c_buffer_empty(&self) -> bool {
        *self == BUFFER_FULL_A::I2C_BUFFER_EMPTY
    }
    #[doc = "Checks if the value of the field is `I2C_BUFFER_FULL`"]
    #[inline(always)]
    pub fn is_i2c_buffer_full(&self) -> bool {
        *self == BUFFER_FULL_A::I2C_BUFFER_FULL
    }
}
#[doc = "Indicate if the I2C interface is holding the clock signal\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CLK_STRETCH_A {
    #[doc = "0: The I2C clock line is not being stretched"]
    I2C_CLK_NOT_STRETCHED = 0,
    #[doc = "1: The I2C SCL line is being held low"]
    I2C_CLK_STRETCHED = 1,
}
impl From<CLK_STRETCH_A> for bool {
    #[inline(always)]
    fn from(variant: CLK_STRETCH_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `CLK_STRETCH`"]
pub type CLK_STRETCH_R = crate::R<bool, CLK_STRETCH_A>;
impl CLK_STRETCH_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CLK_STRETCH_A {
        match self.bits {
            false => CLK_STRETCH_A::I2C_CLK_NOT_STRETCHED,
            true => CLK_STRETCH_A::I2C_CLK_STRETCHED,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_CLK_NOT_STRETCHED`"]
    #[inline(always)]
    pub fn is_i2c_clk_not_stretched(&self) -> bool {
        *self == CLK_STRETCH_A::I2C_CLK_NOT_STRETCHED
    }
    #[doc = "Checks if the value of the field is `I2C_CLK_STRETCHED`"]
    #[inline(always)]
    pub fn is_i2c_clk_stretched(&self) -> bool {
        *self == CLK_STRETCH_A::I2C_CLK_STRETCHED
    }
}
#[doc = "Indicate if the I2C interface bus is free\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BUS_FREE_A {
    #[doc = "0: One or both of the I2C bus lines is currently 0"]
    I2C_BUS_BUSY = 0,
    #[doc = "1: Both I2C bus lines are currently free"]
    I2C_BUS_FREE = 1,
}
impl From<BUS_FREE_A> for bool {
    #[inline(always)]
    fn from(variant: BUS_FREE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `BUS_FREE`"]
pub type BUS_FREE_R = crate::R<bool, BUS_FREE_A>;
impl BUS_FREE_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BUS_FREE_A {
        match self.bits {
            false => BUS_FREE_A::I2C_BUS_BUSY,
            true => BUS_FREE_A::I2C_BUS_FREE,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_BUS_BUSY`"]
    #[inline(always)]
    pub fn is_i2c_bus_busy(&self) -> bool {
        *self == BUS_FREE_A::I2C_BUS_BUSY
    }
    #[doc = "Checks if the value of the field is `I2C_BUS_FREE`"]
    #[inline(always)]
    pub fn is_i2c_bus_free(&self) -> bool {
        *self == BUS_FREE_A::I2C_BUS_FREE
    }
}
#[doc = "Indicate if the I2C data register holds an address or data byte\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADDR_DATA_A {
    #[doc = "0: The I2C data register holds data"]
    I2C_DATA_IS_DATA = 0,
    #[doc = "1: The I2C data register holds an address"]
    I2C_DATA_IS_ADDR = 1,
}
impl From<ADDR_DATA_A> for bool {
    #[inline(always)]
    fn from(variant: ADDR_DATA_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `ADDR_DATA`"]
pub type ADDR_DATA_R = crate::R<bool, ADDR_DATA_A>;
impl ADDR_DATA_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ADDR_DATA_A {
        match self.bits {
            false => ADDR_DATA_A::I2C_DATA_IS_DATA,
            true => ADDR_DATA_A::I2C_DATA_IS_ADDR,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_DATA_IS_DATA`"]
    #[inline(always)]
    pub fn is_i2c_data_is_data(&self) -> bool {
        *self == ADDR_DATA_A::I2C_DATA_IS_DATA
    }
    #[doc = "Checks if the value of the field is `I2C_DATA_IS_ADDR`"]
    #[inline(always)]
    pub fn is_i2c_data_is_addr(&self) -> bool {
        *self == ADDR_DATA_A::I2C_DATA_IS_ADDR
    }
}
#[doc = "Indicate whether the I2C bus transfer is a read or a write\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum READ_WRITE_A {
    #[doc = "0: The current I2C transfer is a write"]
    I2C_IS_WRITE = 0,
    #[doc = "1: The current I2C transfer is a read"]
    I2C_IS_READ = 1,
}
impl From<READ_WRITE_A> for bool {
    #[inline(always)]
    fn from(variant: READ_WRITE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `READ_WRITE`"]
pub type READ_WRITE_R = crate::R<bool, READ_WRITE_A>;
impl READ_WRITE_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> READ_WRITE_A {
        match self.bits {
            false => READ_WRITE_A::I2C_IS_WRITE,
            true => READ_WRITE_A::I2C_IS_READ,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_IS_WRITE`"]
    #[inline(always)]
    pub fn is_i2c_is_write(&self) -> bool {
        *self == READ_WRITE_A::I2C_IS_WRITE
    }
    #[doc = "Checks if the value of the field is `I2C_IS_READ`"]
    #[inline(always)]
    pub fn is_i2c_is_read(&self) -> bool {
        *self == READ_WRITE_A::I2C_IS_READ
    }
}
#[doc = "Indicate whether the I2C bus transfer is using the general call address or another address\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum GEN_CALL_A {
    #[doc = "0: The address used for the current I2C transfer is not the general call address"]
    I2C_ADDR_OTHER = 0,
    #[doc = "1: The address used for the current I2C transfer is the general call address"]
    I2C_ADDR_GEN_CALL = 1,
}
impl From<GEN_CALL_A> for bool {
    #[inline(always)]
    fn from(variant: GEN_CALL_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `GEN_CALL`"]
pub type GEN_CALL_R = crate::R<bool, GEN_CALL_A>;
impl GEN_CALL_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> GEN_CALL_A {
        match self.bits {
            false => GEN_CALL_A::I2C_ADDR_OTHER,
            true => GEN_CALL_A::I2C_ADDR_GEN_CALL,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_ADDR_OTHER`"]
    #[inline(always)]
    pub fn is_i2c_addr_other(&self) -> bool {
        *self == GEN_CALL_A::I2C_ADDR_OTHER
    }
    #[doc = "Checks if the value of the field is `I2C_ADDR_GEN_CALL`"]
    #[inline(always)]
    pub fn is_i2c_addr_gen_call(&self) -> bool {
        *self == GEN_CALL_A::I2C_ADDR_GEN_CALL
    }
}
#[doc = "Indicate whether an acknowledge or a not acknowledge has been received\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ACK_STATUS_A {
    #[doc = "0: Indicate that the last I2C byte was acknowledged"]
    I2C_HAS_ACK = 0,
    #[doc = "1: Indicate that the last I2C byte was not acknowledged"]
    I2C_HAS_NACK = 1,
}
impl From<ACK_STATUS_A> for bool {
    #[inline(always)]
    fn from(variant: ACK_STATUS_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `ACK_STATUS`"]
pub type ACK_STATUS_R = crate::R<bool, ACK_STATUS_A>;
impl ACK_STATUS_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ACK_STATUS_A {
        match self.bits {
            false => ACK_STATUS_A::I2C_HAS_ACK,
            true => ACK_STATUS_A::I2C_HAS_NACK,
        }
    }
    #[doc = "Checks if the value of the field is `I2C_HAS_ACK`"]
    #[inline(always)]
    pub fn is_i2c_has_ack(&self) -> bool {
        *self == ACK_STATUS_A::I2C_HAS_ACK
    }
    #[doc = "Checks if the value of the field is `I2C_HAS_NACK`"]
    #[inline(always)]
    pub fn is_i2c_has_nack(&self) -> bool {
        *self == ACK_STATUS_A::I2C_HAS_NACK
    }
}
impl R {
    #[doc = "Bit 15 - Same as BUS_ERROR_S: Bus error status bit (sticky) - This status bit is automatically reset when the I2C_STATUS register is read."]
    #[inline(always)]
    pub fn error_s(&self) -> ERROR_S_R {
        ERROR_S_R::new(((self.bits >> 15) & 0x01) != 0)
    }
    #[doc = "Bit 14 - Bus error status bit (sticky) - This status bit is automatically reset when the I2C_STATUS register is read."]
    #[inline(always)]
    pub fn bus_error_s(&self) -> BUS_ERROR_S_R {
        BUS_ERROR_S_R::new(((self.bits >> 14) & 0x01) != 0)
    }
    #[doc = "Bit 13 - Master frame start pending status bit"]
    #[inline(always)]
    pub fn start_pending(&self) -> START_PENDING_R {
        START_PENDING_R::new(((self.bits >> 13) & 0x01) != 0)
    }
    #[doc = "Bit 12 - Master mode status bit"]
    #[inline(always)]
    pub fn master_mode(&self) -> MASTER_MODE_R {
        MASTER_MODE_R::new(((self.bits >> 12) & 0x01) != 0)
    }
    #[doc = "Bit 11 - Indicate if the I2C interface is currently requesting DMA data"]
    #[inline(always)]
    pub fn dma_req(&self) -> DMA_REQ_R {
        DMA_REQ_R::new(((self.bits >> 11) & 0x01) != 0)
    }
    #[doc = "Bit 10 - Indicate if an I2C stop bit has been detected"]
    #[inline(always)]
    pub fn stop_detect(&self) -> STOP_DETECT_R {
        STOP_DETECT_R::new(((self.bits >> 10) & 0x01) != 0)
    }
    #[doc = "Bit 9 - Indicate that I2C interface either needs data to transmit or has received data"]
    #[inline(always)]
    pub fn data_event(&self) -> DATA_EVENT_R {
        DATA_EVENT_R::new(((self.bits >> 9) & 0x01) != 0)
    }
    #[doc = "Bit 8 - Same as BUS_ERROR: Indicate if the I2C interface has detected a bus error (automatically cleared when a stop condition is detected)"]
    #[inline(always)]
    pub fn error(&self) -> ERROR_R {
        ERROR_R::new(((self.bits >> 8) & 0x01) != 0)
    }
    #[doc = "Bit 7 - Indicate if the I2C interface has detected a bus error (automatically cleared when a stop condition is detected)"]
    #[inline(always)]
    pub fn bus_error(&self) -> BUS_ERROR_R {
        BUS_ERROR_R::new(((self.bits >> 7) & 0x01) != 0)
    }
    #[doc = "Bit 6 - Indicate if the I2C data buffer is full"]
    #[inline(always)]
    pub fn buffer_full(&self) -> BUFFER_FULL_R {
        BUFFER_FULL_R::new(((self.bits >> 6) & 0x01) != 0)
    }
    #[doc = "Bit 5 - Indicate if the I2C interface is holding the clock signal"]
    #[inline(always)]
    pub fn clk_stretch(&self) -> CLK_STRETCH_R {
        CLK_STRETCH_R::new(((self.bits >> 5) & 0x01) != 0)
    }
    #[doc = "Bit 4 - Indicate if the I2C interface bus is free"]
    #[inline(always)]
    pub fn bus_free(&self) -> BUS_FREE_R {
        BUS_FREE_R::new(((self.bits >> 4) & 0x01) != 0)
    }
    #[doc = "Bit 3 - Indicate if the I2C data register holds an address or data byte"]
    #[inline(always)]
    pub fn addr_data(&self) -> ADDR_DATA_R {
        ADDR_DATA_R::new(((self.bits >> 3) & 0x01) != 0)
    }
    #[doc = "Bit 2 - Indicate whether the I2C bus transfer is a read or a write"]
    #[inline(always)]
    pub fn read_write(&self) -> READ_WRITE_R {
        READ_WRITE_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 1 - Indicate whether the I2C bus transfer is using the general call address or another address"]
    #[inline(always)]
    pub fn gen_call(&self) -> GEN_CALL_R {
        GEN_CALL_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 0 - Indicate whether an acknowledge or a not acknowledge has been received"]
    #[inline(always)]
    pub fn ack_status(&self) -> ACK_STATUS_R {
        ACK_STATUS_R::new((self.bits & 0x01) != 0)
    }
}