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
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
#[doc = "Register `CR1` reader"]
pub struct R(crate::R<CR1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CR1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<CR1_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CR1_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `CR1` writer"]
pub struct W(crate::W<CR1_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<CR1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<CR1_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<CR1_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Peripheral enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PE_A {
#[doc = "0: Peripheral disabled"]
DISABLED = 0,
#[doc = "1: Peripheral enabled"]
ENABLED = 1,
}
impl From<PE_A> for bool {
#[inline(always)]
fn from(variant: PE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `PE` reader - Peripheral enable"]
pub struct PE_R(crate::FieldReader<bool, PE_A>);
impl PE_R {
pub(crate) fn new(bits: bool) -> Self {
PE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> PE_A {
match self.bits {
false => PE_A::DISABLED,
true => PE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == PE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == PE_A::ENABLED
}
}
impl core::ops::Deref for PE_R {
type Target = crate::FieldReader<bool, PE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PE` writer - Peripheral enable"]
pub struct PE_W<'a> {
w: &'a mut W,
}
impl<'a> PE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PE_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Peripheral disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(PE_A::DISABLED)
}
#[doc = "Peripheral enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(PE_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
self.w
}
}
#[doc = "TX Interrupt enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXIE_A {
#[doc = "0: Transmit (TXIS) interrupt disabled"]
DISABLED = 0,
#[doc = "1: Transmit (TXIS) interrupt enabled"]
ENABLED = 1,
}
impl From<TXIE_A> for bool {
#[inline(always)]
fn from(variant: TXIE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `TXIE` reader - TX Interrupt enable"]
pub struct TXIE_R(crate::FieldReader<bool, TXIE_A>);
impl TXIE_R {
pub(crate) fn new(bits: bool) -> Self {
TXIE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TXIE_A {
match self.bits {
false => TXIE_A::DISABLED,
true => TXIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == TXIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == TXIE_A::ENABLED
}
}
impl core::ops::Deref for TXIE_R {
type Target = crate::FieldReader<bool, TXIE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `TXIE` writer - TX Interrupt enable"]
pub struct TXIE_W<'a> {
w: &'a mut W,
}
impl<'a> TXIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TXIE_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Transmit (TXIS) interrupt disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TXIE_A::DISABLED)
}
#[doc = "Transmit (TXIS) interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TXIE_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
self.w
}
}
#[doc = "RX Interrupt enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RXIE_A {
#[doc = "0: Receive (RXNE) interrupt disabled"]
DISABLED = 0,
#[doc = "1: Receive (RXNE) interrupt enabled"]
ENABLED = 1,
}
impl From<RXIE_A> for bool {
#[inline(always)]
fn from(variant: RXIE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `RXIE` reader - RX Interrupt enable"]
pub struct RXIE_R(crate::FieldReader<bool, RXIE_A>);
impl RXIE_R {
pub(crate) fn new(bits: bool) -> Self {
RXIE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RXIE_A {
match self.bits {
false => RXIE_A::DISABLED,
true => RXIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == RXIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == RXIE_A::ENABLED
}
}
impl core::ops::Deref for RXIE_R {
type Target = crate::FieldReader<bool, RXIE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `RXIE` writer - RX Interrupt enable"]
pub struct RXIE_W<'a> {
w: &'a mut W,
}
impl<'a> RXIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RXIE_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Receive (RXNE) interrupt disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(RXIE_A::DISABLED)
}
#[doc = "Receive (RXNE) interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(RXIE_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
self.w
}
}
#[doc = "Address match interrupt enable (slave only)\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADDRIE_A {
#[doc = "0: Address match (ADDR) interrupts disabled"]
DISABLED = 0,
#[doc = "1: Address match (ADDR) interrupts enabled"]
ENABLED = 1,
}
impl From<ADDRIE_A> for bool {
#[inline(always)]
fn from(variant: ADDRIE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `ADDRIE` reader - Address match interrupt enable (slave only)"]
pub struct ADDRIE_R(crate::FieldReader<bool, ADDRIE_A>);
impl ADDRIE_R {
pub(crate) fn new(bits: bool) -> Self {
ADDRIE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ADDRIE_A {
match self.bits {
false => ADDRIE_A::DISABLED,
true => ADDRIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == ADDRIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == ADDRIE_A::ENABLED
}
}
impl core::ops::Deref for ADDRIE_R {
type Target = crate::FieldReader<bool, ADDRIE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `ADDRIE` writer - Address match interrupt enable (slave only)"]
pub struct ADDRIE_W<'a> {
w: &'a mut W,
}
impl<'a> ADDRIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ADDRIE_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Address match (ADDR) interrupts disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(ADDRIE_A::DISABLED)
}
#[doc = "Address match (ADDR) interrupts enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(ADDRIE_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
self.w
}
}
#[doc = "Not acknowledge received interrupt enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NACKIE_A {
#[doc = "0: Not acknowledge (NACKF) received interrupts disabled"]
DISABLED = 0,
#[doc = "1: Not acknowledge (NACKF) received interrupts enabled"]
ENABLED = 1,
}
impl From<NACKIE_A> for bool {
#[inline(always)]
fn from(variant: NACKIE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `NACKIE` reader - Not acknowledge received interrupt enable"]
pub struct NACKIE_R(crate::FieldReader<bool, NACKIE_A>);
impl NACKIE_R {
pub(crate) fn new(bits: bool) -> Self {
NACKIE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> NACKIE_A {
match self.bits {
false => NACKIE_A::DISABLED,
true => NACKIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == NACKIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == NACKIE_A::ENABLED
}
}
impl core::ops::Deref for NACKIE_R {
type Target = crate::FieldReader<bool, NACKIE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `NACKIE` writer - Not acknowledge received interrupt enable"]
pub struct NACKIE_W<'a> {
w: &'a mut W,
}
impl<'a> NACKIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: NACKIE_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Not acknowledge (NACKF) received interrupts disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(NACKIE_A::DISABLED)
}
#[doc = "Not acknowledge (NACKF) received interrupts enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(NACKIE_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4);
self.w
}
}
#[doc = "STOP detection Interrupt enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum STOPIE_A {
#[doc = "0: Stop detection (STOPF) interrupt disabled"]
DISABLED = 0,
#[doc = "1: Stop detection (STOPF) interrupt enabled"]
ENABLED = 1,
}
impl From<STOPIE_A> for bool {
#[inline(always)]
fn from(variant: STOPIE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `STOPIE` reader - STOP detection Interrupt enable"]
pub struct STOPIE_R(crate::FieldReader<bool, STOPIE_A>);
impl STOPIE_R {
pub(crate) fn new(bits: bool) -> Self {
STOPIE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> STOPIE_A {
match self.bits {
false => STOPIE_A::DISABLED,
true => STOPIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == STOPIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == STOPIE_A::ENABLED
}
}
impl core::ops::Deref for STOPIE_R {
type Target = crate::FieldReader<bool, STOPIE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `STOPIE` writer - STOP detection Interrupt enable"]
pub struct STOPIE_W<'a> {
w: &'a mut W,
}
impl<'a> STOPIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: STOPIE_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Stop detection (STOPF) interrupt disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(STOPIE_A::DISABLED)
}
#[doc = "Stop detection (STOPF) interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(STOPIE_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
self.w
}
}
#[doc = "Transfer Complete interrupt enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TCIE_A {
#[doc = "0: Transfer Complete interrupt disabled"]
DISABLED = 0,
#[doc = "1: Transfer Complete interrupt enabled"]
ENABLED = 1,
}
impl From<TCIE_A> for bool {
#[inline(always)]
fn from(variant: TCIE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `TCIE` reader - Transfer Complete interrupt enable"]
pub struct TCIE_R(crate::FieldReader<bool, TCIE_A>);
impl TCIE_R {
pub(crate) fn new(bits: bool) -> Self {
TCIE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TCIE_A {
match self.bits {
false => TCIE_A::DISABLED,
true => TCIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == TCIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == TCIE_A::ENABLED
}
}
impl core::ops::Deref for TCIE_R {
type Target = crate::FieldReader<bool, TCIE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `TCIE` writer - Transfer Complete interrupt enable"]
pub struct TCIE_W<'a> {
w: &'a mut W,
}
impl<'a> TCIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TCIE_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Transfer Complete interrupt disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TCIE_A::DISABLED)
}
#[doc = "Transfer Complete interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TCIE_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u32 & 0x01) << 6);
self.w
}
}
#[doc = "Error interrupts enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ERRIE_A {
#[doc = "0: Error detection interrupts disabled"]
DISABLED = 0,
#[doc = "1: Error detection interrupts enabled"]
ENABLED = 1,
}
impl From<ERRIE_A> for bool {
#[inline(always)]
fn from(variant: ERRIE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `ERRIE` reader - Error interrupts enable"]
pub struct ERRIE_R(crate::FieldReader<bool, ERRIE_A>);
impl ERRIE_R {
pub(crate) fn new(bits: bool) -> Self {
ERRIE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ERRIE_A {
match self.bits {
false => ERRIE_A::DISABLED,
true => ERRIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == ERRIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == ERRIE_A::ENABLED
}
}
impl core::ops::Deref for ERRIE_R {
type Target = crate::FieldReader<bool, ERRIE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `ERRIE` writer - Error interrupts enable"]
pub struct ERRIE_W<'a> {
w: &'a mut W,
}
impl<'a> ERRIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ERRIE_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Error detection interrupts disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(ERRIE_A::DISABLED)
}
#[doc = "Error detection interrupts enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(ERRIE_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
self.w
}
}
#[doc = "Digital noise filter\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum DNF_A {
#[doc = "0: Digital filter disabled"]
NOFILTER = 0,
#[doc = "1: Digital filter enabled and filtering capability up to 1 tI2CCLK"]
FILTER1 = 1,
#[doc = "2: Digital filter enabled and filtering capability up to 2 tI2CCLK"]
FILTER2 = 2,
#[doc = "3: Digital filter enabled and filtering capability up to 3 tI2CCLK"]
FILTER3 = 3,
#[doc = "4: Digital filter enabled and filtering capability up to 4 tI2CCLK"]
FILTER4 = 4,
#[doc = "5: Digital filter enabled and filtering capability up to 5 tI2CCLK"]
FILTER5 = 5,
#[doc = "6: Digital filter enabled and filtering capability up to 6 tI2CCLK"]
FILTER6 = 6,
#[doc = "7: Digital filter enabled and filtering capability up to 7 tI2CCLK"]
FILTER7 = 7,
#[doc = "8: Digital filter enabled and filtering capability up to 8 tI2CCLK"]
FILTER8 = 8,
#[doc = "9: Digital filter enabled and filtering capability up to 9 tI2CCLK"]
FILTER9 = 9,
#[doc = "10: Digital filter enabled and filtering capability up to 10 tI2CCLK"]
FILTER10 = 10,
#[doc = "11: Digital filter enabled and filtering capability up to 11 tI2CCLK"]
FILTER11 = 11,
#[doc = "12: Digital filter enabled and filtering capability up to 12 tI2CCLK"]
FILTER12 = 12,
#[doc = "13: Digital filter enabled and filtering capability up to 13 tI2CCLK"]
FILTER13 = 13,
#[doc = "14: Digital filter enabled and filtering capability up to 14 tI2CCLK"]
FILTER14 = 14,
#[doc = "15: Digital filter enabled and filtering capability up to 15 tI2CCLK"]
FILTER15 = 15,
}
impl From<DNF_A> for u8 {
#[inline(always)]
fn from(variant: DNF_A) -> Self {
variant as _
}
}
#[doc = "Field `DNF` reader - Digital noise filter"]
pub struct DNF_R(crate::FieldReader<u8, DNF_A>);
impl DNF_R {
pub(crate) fn new(bits: u8) -> Self {
DNF_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> DNF_A {
match self.bits {
0 => DNF_A::NOFILTER,
1 => DNF_A::FILTER1,
2 => DNF_A::FILTER2,
3 => DNF_A::FILTER3,
4 => DNF_A::FILTER4,
5 => DNF_A::FILTER5,
6 => DNF_A::FILTER6,
7 => DNF_A::FILTER7,
8 => DNF_A::FILTER8,
9 => DNF_A::FILTER9,
10 => DNF_A::FILTER10,
11 => DNF_A::FILTER11,
12 => DNF_A::FILTER12,
13 => DNF_A::FILTER13,
14 => DNF_A::FILTER14,
15 => DNF_A::FILTER15,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `NOFILTER`"]
#[inline(always)]
pub fn is_no_filter(&self) -> bool {
**self == DNF_A::NOFILTER
}
#[doc = "Checks if the value of the field is `FILTER1`"]
#[inline(always)]
pub fn is_filter1(&self) -> bool {
**self == DNF_A::FILTER1
}
#[doc = "Checks if the value of the field is `FILTER2`"]
#[inline(always)]
pub fn is_filter2(&self) -> bool {
**self == DNF_A::FILTER2
}
#[doc = "Checks if the value of the field is `FILTER3`"]
#[inline(always)]
pub fn is_filter3(&self) -> bool {
**self == DNF_A::FILTER3
}
#[doc = "Checks if the value of the field is `FILTER4`"]
#[inline(always)]
pub fn is_filter4(&self) -> bool {
**self == DNF_A::FILTER4
}
#[doc = "Checks if the value of the field is `FILTER5`"]
#[inline(always)]
pub fn is_filter5(&self) -> bool {
**self == DNF_A::FILTER5
}
#[doc = "Checks if the value of the field is `FILTER6`"]
#[inline(always)]
pub fn is_filter6(&self) -> bool {
**self == DNF_A::FILTER6
}
#[doc = "Checks if the value of the field is `FILTER7`"]
#[inline(always)]
pub fn is_filter7(&self) -> bool {
**self == DNF_A::FILTER7
}
#[doc = "Checks if the value of the field is `FILTER8`"]
#[inline(always)]
pub fn is_filter8(&self) -> bool {
**self == DNF_A::FILTER8
}
#[doc = "Checks if the value of the field is `FILTER9`"]
#[inline(always)]
pub fn is_filter9(&self) -> bool {
**self == DNF_A::FILTER9
}
#[doc = "Checks if the value of the field is `FILTER10`"]
#[inline(always)]
pub fn is_filter10(&self) -> bool {
**self == DNF_A::FILTER10
}
#[doc = "Checks if the value of the field is `FILTER11`"]
#[inline(always)]
pub fn is_filter11(&self) -> bool {
**self == DNF_A::FILTER11
}
#[doc = "Checks if the value of the field is `FILTER12`"]
#[inline(always)]
pub fn is_filter12(&self) -> bool {
**self == DNF_A::FILTER12
}
#[doc = "Checks if the value of the field is `FILTER13`"]
#[inline(always)]
pub fn is_filter13(&self) -> bool {
**self == DNF_A::FILTER13
}
#[doc = "Checks if the value of the field is `FILTER14`"]
#[inline(always)]
pub fn is_filter14(&self) -> bool {
**self == DNF_A::FILTER14
}
#[doc = "Checks if the value of the field is `FILTER15`"]
#[inline(always)]
pub fn is_filter15(&self) -> bool {
**self == DNF_A::FILTER15
}
}
impl core::ops::Deref for DNF_R {
type Target = crate::FieldReader<u8, DNF_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `DNF` writer - Digital noise filter"]
pub struct DNF_W<'a> {
w: &'a mut W,
}
impl<'a> DNF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: DNF_A) -> &'a mut W {
self.bits(variant.into())
}
#[doc = "Digital filter disabled"]
#[inline(always)]
pub fn no_filter(self) -> &'a mut W {
self.variant(DNF_A::NOFILTER)
}
#[doc = "Digital filter enabled and filtering capability up to 1 tI2CCLK"]
#[inline(always)]
pub fn filter1(self) -> &'a mut W {
self.variant(DNF_A::FILTER1)
}
#[doc = "Digital filter enabled and filtering capability up to 2 tI2CCLK"]
#[inline(always)]
pub fn filter2(self) -> &'a mut W {
self.variant(DNF_A::FILTER2)
}
#[doc = "Digital filter enabled and filtering capability up to 3 tI2CCLK"]
#[inline(always)]
pub fn filter3(self) -> &'a mut W {
self.variant(DNF_A::FILTER3)
}
#[doc = "Digital filter enabled and filtering capability up to 4 tI2CCLK"]
#[inline(always)]
pub fn filter4(self) -> &'a mut W {
self.variant(DNF_A::FILTER4)
}
#[doc = "Digital filter enabled and filtering capability up to 5 tI2CCLK"]
#[inline(always)]
pub fn filter5(self) -> &'a mut W {
self.variant(DNF_A::FILTER5)
}
#[doc = "Digital filter enabled and filtering capability up to 6 tI2CCLK"]
#[inline(always)]
pub fn filter6(self) -> &'a mut W {
self.variant(DNF_A::FILTER6)
}
#[doc = "Digital filter enabled and filtering capability up to 7 tI2CCLK"]
#[inline(always)]
pub fn filter7(self) -> &'a mut W {
self.variant(DNF_A::FILTER7)
}
#[doc = "Digital filter enabled and filtering capability up to 8 tI2CCLK"]
#[inline(always)]
pub fn filter8(self) -> &'a mut W {
self.variant(DNF_A::FILTER8)
}
#[doc = "Digital filter enabled and filtering capability up to 9 tI2CCLK"]
#[inline(always)]
pub fn filter9(self) -> &'a mut W {
self.variant(DNF_A::FILTER9)
}
#[doc = "Digital filter enabled and filtering capability up to 10 tI2CCLK"]
#[inline(always)]
pub fn filter10(self) -> &'a mut W {
self.variant(DNF_A::FILTER10)
}
#[doc = "Digital filter enabled and filtering capability up to 11 tI2CCLK"]
#[inline(always)]
pub fn filter11(self) -> &'a mut W {
self.variant(DNF_A::FILTER11)
}
#[doc = "Digital filter enabled and filtering capability up to 12 tI2CCLK"]
#[inline(always)]
pub fn filter12(self) -> &'a mut W {
self.variant(DNF_A::FILTER12)
}
#[doc = "Digital filter enabled and filtering capability up to 13 tI2CCLK"]
#[inline(always)]
pub fn filter13(self) -> &'a mut W {
self.variant(DNF_A::FILTER13)
}
#[doc = "Digital filter enabled and filtering capability up to 14 tI2CCLK"]
#[inline(always)]
pub fn filter14(self) -> &'a mut W {
self.variant(DNF_A::FILTER14)
}
#[doc = "Digital filter enabled and filtering capability up to 15 tI2CCLK"]
#[inline(always)]
pub fn filter15(self) -> &'a mut W {
self.variant(DNF_A::FILTER15)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x0f << 8)) | ((value as u32 & 0x0f) << 8);
self.w
}
}
#[doc = "Analog noise filter OFF\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ANFOFF_A {
#[doc = "0: Analog noise filter enabled"]
ENABLED = 0,
#[doc = "1: Analog noise filter disabled"]
DISABLED = 1,
}
impl From<ANFOFF_A> for bool {
#[inline(always)]
fn from(variant: ANFOFF_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `ANFOFF` reader - Analog noise filter OFF"]
pub struct ANFOFF_R(crate::FieldReader<bool, ANFOFF_A>);
impl ANFOFF_R {
pub(crate) fn new(bits: bool) -> Self {
ANFOFF_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ANFOFF_A {
match self.bits {
false => ANFOFF_A::ENABLED,
true => ANFOFF_A::DISABLED,
}
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == ANFOFF_A::ENABLED
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == ANFOFF_A::DISABLED
}
}
impl core::ops::Deref for ANFOFF_R {
type Target = crate::FieldReader<bool, ANFOFF_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `ANFOFF` writer - Analog noise filter OFF"]
pub struct ANFOFF_W<'a> {
w: &'a mut W,
}
impl<'a> ANFOFF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ANFOFF_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Analog noise filter enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(ANFOFF_A::ENABLED)
}
#[doc = "Analog noise filter disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(ANFOFF_A::DISABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 12)) | ((value as u32 & 0x01) << 12);
self.w
}
}
#[doc = "DMA transmission requests enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXDMAEN_A {
#[doc = "0: DMA mode disabled for transmission"]
DISABLED = 0,
#[doc = "1: DMA mode enabled for transmission"]
ENABLED = 1,
}
impl From<TXDMAEN_A> for bool {
#[inline(always)]
fn from(variant: TXDMAEN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `TXDMAEN` reader - DMA transmission requests enable"]
pub struct TXDMAEN_R(crate::FieldReader<bool, TXDMAEN_A>);
impl TXDMAEN_R {
pub(crate) fn new(bits: bool) -> Self {
TXDMAEN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TXDMAEN_A {
match self.bits {
false => TXDMAEN_A::DISABLED,
true => TXDMAEN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == TXDMAEN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == TXDMAEN_A::ENABLED
}
}
impl core::ops::Deref for TXDMAEN_R {
type Target = crate::FieldReader<bool, TXDMAEN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `TXDMAEN` writer - DMA transmission requests enable"]
pub struct TXDMAEN_W<'a> {
w: &'a mut W,
}
impl<'a> TXDMAEN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TXDMAEN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "DMA mode disabled for transmission"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TXDMAEN_A::DISABLED)
}
#[doc = "DMA mode enabled for transmission"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TXDMAEN_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 14)) | ((value as u32 & 0x01) << 14);
self.w
}
}
#[doc = "DMA reception requests enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RXDMAEN_A {
#[doc = "0: DMA mode disabled for reception"]
DISABLED = 0,
#[doc = "1: DMA mode enabled for reception"]
ENABLED = 1,
}
impl From<RXDMAEN_A> for bool {
#[inline(always)]
fn from(variant: RXDMAEN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `RXDMAEN` reader - DMA reception requests enable"]
pub struct RXDMAEN_R(crate::FieldReader<bool, RXDMAEN_A>);
impl RXDMAEN_R {
pub(crate) fn new(bits: bool) -> Self {
RXDMAEN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RXDMAEN_A {
match self.bits {
false => RXDMAEN_A::DISABLED,
true => RXDMAEN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == RXDMAEN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == RXDMAEN_A::ENABLED
}
}
impl core::ops::Deref for RXDMAEN_R {
type Target = crate::FieldReader<bool, RXDMAEN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `RXDMAEN` writer - DMA reception requests enable"]
pub struct RXDMAEN_W<'a> {
w: &'a mut W,
}
impl<'a> RXDMAEN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RXDMAEN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "DMA mode disabled for reception"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(RXDMAEN_A::DISABLED)
}
#[doc = "DMA mode enabled for reception"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(RXDMAEN_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15);
self.w
}
}
#[doc = "Slave byte control\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SBC_A {
#[doc = "0: Slave byte control disabled"]
DISABLED = 0,
#[doc = "1: Slave byte control enabled"]
ENABLED = 1,
}
impl From<SBC_A> for bool {
#[inline(always)]
fn from(variant: SBC_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `SBC` reader - Slave byte control"]
pub struct SBC_R(crate::FieldReader<bool, SBC_A>);
impl SBC_R {
pub(crate) fn new(bits: bool) -> Self {
SBC_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> SBC_A {
match self.bits {
false => SBC_A::DISABLED,
true => SBC_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == SBC_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == SBC_A::ENABLED
}
}
impl core::ops::Deref for SBC_R {
type Target = crate::FieldReader<bool, SBC_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SBC` writer - Slave byte control"]
pub struct SBC_W<'a> {
w: &'a mut W,
}
impl<'a> SBC_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: SBC_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Slave byte control disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(SBC_A::DISABLED)
}
#[doc = "Slave byte control enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(SBC_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
self.w
}
}
#[doc = "Clock stretching disable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NOSTRETCH_A {
#[doc = "0: Clock stretching enabled"]
ENABLED = 0,
#[doc = "1: Clock stretching disabled"]
DISABLED = 1,
}
impl From<NOSTRETCH_A> for bool {
#[inline(always)]
fn from(variant: NOSTRETCH_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `NOSTRETCH` reader - Clock stretching disable"]
pub struct NOSTRETCH_R(crate::FieldReader<bool, NOSTRETCH_A>);
impl NOSTRETCH_R {
pub(crate) fn new(bits: bool) -> Self {
NOSTRETCH_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> NOSTRETCH_A {
match self.bits {
false => NOSTRETCH_A::ENABLED,
true => NOSTRETCH_A::DISABLED,
}
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == NOSTRETCH_A::ENABLED
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == NOSTRETCH_A::DISABLED
}
}
impl core::ops::Deref for NOSTRETCH_R {
type Target = crate::FieldReader<bool, NOSTRETCH_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `NOSTRETCH` writer - Clock stretching disable"]
pub struct NOSTRETCH_W<'a> {
w: &'a mut W,
}
impl<'a> NOSTRETCH_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: NOSTRETCH_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Clock stretching enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(NOSTRETCH_A::ENABLED)
}
#[doc = "Clock stretching disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(NOSTRETCH_A::DISABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
self.w
}
}
#[doc = "Wakeup from STOP enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum WUPEN_A {
#[doc = "0: Wakeup from Stop mode disabled"]
DISABLED = 0,
#[doc = "1: Wakeup from Stop mode enabled"]
ENABLED = 1,
}
impl From<WUPEN_A> for bool {
#[inline(always)]
fn from(variant: WUPEN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `WUPEN` reader - Wakeup from STOP enable"]
pub struct WUPEN_R(crate::FieldReader<bool, WUPEN_A>);
impl WUPEN_R {
pub(crate) fn new(bits: bool) -> Self {
WUPEN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> WUPEN_A {
match self.bits {
false => WUPEN_A::DISABLED,
true => WUPEN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == WUPEN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == WUPEN_A::ENABLED
}
}
impl core::ops::Deref for WUPEN_R {
type Target = crate::FieldReader<bool, WUPEN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `WUPEN` writer - Wakeup from STOP enable"]
pub struct WUPEN_W<'a> {
w: &'a mut W,
}
impl<'a> WUPEN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: WUPEN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Wakeup from Stop mode disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(WUPEN_A::DISABLED)
}
#[doc = "Wakeup from Stop mode enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(WUPEN_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 18)) | ((value as u32 & 0x01) << 18);
self.w
}
}
#[doc = "General call enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum GCEN_A {
#[doc = "0: General call disabled. Address 0b00000000 is NACKed"]
DISABLED = 0,
#[doc = "1: General call enabled. Address 0b00000000 is ACKed"]
ENABLED = 1,
}
impl From<GCEN_A> for bool {
#[inline(always)]
fn from(variant: GCEN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `GCEN` reader - General call enable"]
pub struct GCEN_R(crate::FieldReader<bool, GCEN_A>);
impl GCEN_R {
pub(crate) fn new(bits: bool) -> Self {
GCEN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> GCEN_A {
match self.bits {
false => GCEN_A::DISABLED,
true => GCEN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == GCEN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == GCEN_A::ENABLED
}
}
impl core::ops::Deref for GCEN_R {
type Target = crate::FieldReader<bool, GCEN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `GCEN` writer - General call enable"]
pub struct GCEN_W<'a> {
w: &'a mut W,
}
impl<'a> GCEN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: GCEN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "General call disabled. Address 0b00000000 is NACKed"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(GCEN_A::DISABLED)
}
#[doc = "General call enabled. Address 0b00000000 is ACKed"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(GCEN_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 19)) | ((value as u32 & 0x01) << 19);
self.w
}
}
#[doc = "SMBus Host address enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SMBHEN_A {
#[doc = "0: Host address disabled. Address 0b0001000x is NACKed"]
DISABLED = 0,
#[doc = "1: Host address enabled. Address 0b0001000x is ACKed"]
ENABLED = 1,
}
impl From<SMBHEN_A> for bool {
#[inline(always)]
fn from(variant: SMBHEN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `SMBHEN` reader - SMBus Host address enable"]
pub struct SMBHEN_R(crate::FieldReader<bool, SMBHEN_A>);
impl SMBHEN_R {
pub(crate) fn new(bits: bool) -> Self {
SMBHEN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> SMBHEN_A {
match self.bits {
false => SMBHEN_A::DISABLED,
true => SMBHEN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == SMBHEN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == SMBHEN_A::ENABLED
}
}
impl core::ops::Deref for SMBHEN_R {
type Target = crate::FieldReader<bool, SMBHEN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SMBHEN` writer - SMBus Host address enable"]
pub struct SMBHEN_W<'a> {
w: &'a mut W,
}
impl<'a> SMBHEN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: SMBHEN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Host address disabled. Address 0b0001000x is NACKed"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(SMBHEN_A::DISABLED)
}
#[doc = "Host address enabled. Address 0b0001000x is ACKed"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(SMBHEN_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 20)) | ((value as u32 & 0x01) << 20);
self.w
}
}
#[doc = "SMBus Device Default address enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SMBDEN_A {
#[doc = "0: Device default address disabled. Address 0b1100001x is NACKed"]
DISABLED = 0,
#[doc = "1: Device default address enabled. Address 0b1100001x is ACKed"]
ENABLED = 1,
}
impl From<SMBDEN_A> for bool {
#[inline(always)]
fn from(variant: SMBDEN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `SMBDEN` reader - SMBus Device Default address enable"]
pub struct SMBDEN_R(crate::FieldReader<bool, SMBDEN_A>);
impl SMBDEN_R {
pub(crate) fn new(bits: bool) -> Self {
SMBDEN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> SMBDEN_A {
match self.bits {
false => SMBDEN_A::DISABLED,
true => SMBDEN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == SMBDEN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == SMBDEN_A::ENABLED
}
}
impl core::ops::Deref for SMBDEN_R {
type Target = crate::FieldReader<bool, SMBDEN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SMBDEN` writer - SMBus Device Default address enable"]
pub struct SMBDEN_W<'a> {
w: &'a mut W,
}
impl<'a> SMBDEN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: SMBDEN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Device default address disabled. Address 0b1100001x is NACKed"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(SMBDEN_A::DISABLED)
}
#[doc = "Device default address enabled. Address 0b1100001x is ACKed"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(SMBDEN_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 21)) | ((value as u32 & 0x01) << 21);
self.w
}
}
#[doc = "SMBUS alert enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ALERTEN_A {
#[doc = "0: In device mode (SMBHEN=Disabled) Releases SMBA pin high and Alert Response Address Header disabled (0001100x) followed by NACK. In host mode (SMBHEN=Enabled) SMBus Alert pin (SMBA) not supported"]
DISABLED = 0,
#[doc = "1: In device mode (SMBHEN=Disabled) Drives SMBA pin low and Alert Response Address Header enabled (0001100x) followed by ACK.In host mode (SMBHEN=Enabled) SMBus Alert pin (SMBA) supported"]
ENABLED = 1,
}
impl From<ALERTEN_A> for bool {
#[inline(always)]
fn from(variant: ALERTEN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `ALERTEN` reader - SMBUS alert enable"]
pub struct ALERTEN_R(crate::FieldReader<bool, ALERTEN_A>);
impl ALERTEN_R {
pub(crate) fn new(bits: bool) -> Self {
ALERTEN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ALERTEN_A {
match self.bits {
false => ALERTEN_A::DISABLED,
true => ALERTEN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == ALERTEN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == ALERTEN_A::ENABLED
}
}
impl core::ops::Deref for ALERTEN_R {
type Target = crate::FieldReader<bool, ALERTEN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `ALERTEN` writer - SMBUS alert enable"]
pub struct ALERTEN_W<'a> {
w: &'a mut W,
}
impl<'a> ALERTEN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ALERTEN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "In device mode (SMBHEN=Disabled) Releases SMBA pin high and Alert Response Address Header disabled (0001100x) followed by NACK. In host mode (SMBHEN=Enabled) SMBus Alert pin (SMBA) not supported"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(ALERTEN_A::DISABLED)
}
#[doc = "In device mode (SMBHEN=Disabled) Drives SMBA pin low and Alert Response Address Header enabled (0001100x) followed by ACK.In host mode (SMBHEN=Enabled) SMBus Alert pin (SMBA) supported"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(ALERTEN_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 22)) | ((value as u32 & 0x01) << 22);
self.w
}
}
#[doc = "PEC enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PECEN_A {
#[doc = "0: PEC calculation disabled"]
DISABLED = 0,
#[doc = "1: PEC calculation enabled"]
ENABLED = 1,
}
impl From<PECEN_A> for bool {
#[inline(always)]
fn from(variant: PECEN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `PECEN` reader - PEC enable"]
pub struct PECEN_R(crate::FieldReader<bool, PECEN_A>);
impl PECEN_R {
pub(crate) fn new(bits: bool) -> Self {
PECEN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> PECEN_A {
match self.bits {
false => PECEN_A::DISABLED,
true => PECEN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == PECEN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == PECEN_A::ENABLED
}
}
impl core::ops::Deref for PECEN_R {
type Target = crate::FieldReader<bool, PECEN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PECEN` writer - PEC enable"]
pub struct PECEN_W<'a> {
w: &'a mut W,
}
impl<'a> PECEN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PECEN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "PEC calculation disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(PECEN_A::DISABLED)
}
#[doc = "PEC calculation enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(PECEN_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 23)) | ((value as u32 & 0x01) << 23);
self.w
}
}
impl R {
#[doc = "Bit 0 - Peripheral enable"]
#[inline(always)]
pub fn pe(&self) -> PE_R {
PE_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - TX Interrupt enable"]
#[inline(always)]
pub fn txie(&self) -> TXIE_R {
TXIE_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - RX Interrupt enable"]
#[inline(always)]
pub fn rxie(&self) -> RXIE_R {
RXIE_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Address match interrupt enable (slave only)"]
#[inline(always)]
pub fn addrie(&self) -> ADDRIE_R {
ADDRIE_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - Not acknowledge received interrupt enable"]
#[inline(always)]
pub fn nackie(&self) -> NACKIE_R {
NACKIE_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 5 - STOP detection Interrupt enable"]
#[inline(always)]
pub fn stopie(&self) -> STOPIE_R {
STOPIE_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 6 - Transfer Complete interrupt enable"]
#[inline(always)]
pub fn tcie(&self) -> TCIE_R {
TCIE_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 7 - Error interrupts enable"]
#[inline(always)]
pub fn errie(&self) -> ERRIE_R {
ERRIE_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bits 8:11 - Digital noise filter"]
#[inline(always)]
pub fn dnf(&self) -> DNF_R {
DNF_R::new(((self.bits >> 8) & 0x0f) as u8)
}
#[doc = "Bit 12 - Analog noise filter OFF"]
#[inline(always)]
pub fn anfoff(&self) -> ANFOFF_R {
ANFOFF_R::new(((self.bits >> 12) & 0x01) != 0)
}
#[doc = "Bit 14 - DMA transmission requests enable"]
#[inline(always)]
pub fn txdmaen(&self) -> TXDMAEN_R {
TXDMAEN_R::new(((self.bits >> 14) & 0x01) != 0)
}
#[doc = "Bit 15 - DMA reception requests enable"]
#[inline(always)]
pub fn rxdmaen(&self) -> RXDMAEN_R {
RXDMAEN_R::new(((self.bits >> 15) & 0x01) != 0)
}
#[doc = "Bit 16 - Slave byte control"]
#[inline(always)]
pub fn sbc(&self) -> SBC_R {
SBC_R::new(((self.bits >> 16) & 0x01) != 0)
}
#[doc = "Bit 17 - Clock stretching disable"]
#[inline(always)]
pub fn nostretch(&self) -> NOSTRETCH_R {
NOSTRETCH_R::new(((self.bits >> 17) & 0x01) != 0)
}
#[doc = "Bit 18 - Wakeup from STOP enable"]
#[inline(always)]
pub fn wupen(&self) -> WUPEN_R {
WUPEN_R::new(((self.bits >> 18) & 0x01) != 0)
}
#[doc = "Bit 19 - General call enable"]
#[inline(always)]
pub fn gcen(&self) -> GCEN_R {
GCEN_R::new(((self.bits >> 19) & 0x01) != 0)
}
#[doc = "Bit 20 - SMBus Host address enable"]
#[inline(always)]
pub fn smbhen(&self) -> SMBHEN_R {
SMBHEN_R::new(((self.bits >> 20) & 0x01) != 0)
}
#[doc = "Bit 21 - SMBus Device Default address enable"]
#[inline(always)]
pub fn smbden(&self) -> SMBDEN_R {
SMBDEN_R::new(((self.bits >> 21) & 0x01) != 0)
}
#[doc = "Bit 22 - SMBUS alert enable"]
#[inline(always)]
pub fn alerten(&self) -> ALERTEN_R {
ALERTEN_R::new(((self.bits >> 22) & 0x01) != 0)
}
#[doc = "Bit 23 - PEC enable"]
#[inline(always)]
pub fn pecen(&self) -> PECEN_R {
PECEN_R::new(((self.bits >> 23) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Peripheral enable"]
#[inline(always)]
pub fn pe(&mut self) -> PE_W {
PE_W { w: self }
}
#[doc = "Bit 1 - TX Interrupt enable"]
#[inline(always)]
pub fn txie(&mut self) -> TXIE_W {
TXIE_W { w: self }
}
#[doc = "Bit 2 - RX Interrupt enable"]
#[inline(always)]
pub fn rxie(&mut self) -> RXIE_W {
RXIE_W { w: self }
}
#[doc = "Bit 3 - Address match interrupt enable (slave only)"]
#[inline(always)]
pub fn addrie(&mut self) -> ADDRIE_W {
ADDRIE_W { w: self }
}
#[doc = "Bit 4 - Not acknowledge received interrupt enable"]
#[inline(always)]
pub fn nackie(&mut self) -> NACKIE_W {
NACKIE_W { w: self }
}
#[doc = "Bit 5 - STOP detection Interrupt enable"]
#[inline(always)]
pub fn stopie(&mut self) -> STOPIE_W {
STOPIE_W { w: self }
}
#[doc = "Bit 6 - Transfer Complete interrupt enable"]
#[inline(always)]
pub fn tcie(&mut self) -> TCIE_W {
TCIE_W { w: self }
}
#[doc = "Bit 7 - Error interrupts enable"]
#[inline(always)]
pub fn errie(&mut self) -> ERRIE_W {
ERRIE_W { w: self }
}
#[doc = "Bits 8:11 - Digital noise filter"]
#[inline(always)]
pub fn dnf(&mut self) -> DNF_W {
DNF_W { w: self }
}
#[doc = "Bit 12 - Analog noise filter OFF"]
#[inline(always)]
pub fn anfoff(&mut self) -> ANFOFF_W {
ANFOFF_W { w: self }
}
#[doc = "Bit 14 - DMA transmission requests enable"]
#[inline(always)]
pub fn txdmaen(&mut self) -> TXDMAEN_W {
TXDMAEN_W { w: self }
}
#[doc = "Bit 15 - DMA reception requests enable"]
#[inline(always)]
pub fn rxdmaen(&mut self) -> RXDMAEN_W {
RXDMAEN_W { w: self }
}
#[doc = "Bit 16 - Slave byte control"]
#[inline(always)]
pub fn sbc(&mut self) -> SBC_W {
SBC_W { w: self }
}
#[doc = "Bit 17 - Clock stretching disable"]
#[inline(always)]
pub fn nostretch(&mut self) -> NOSTRETCH_W {
NOSTRETCH_W { w: self }
}
#[doc = "Bit 18 - Wakeup from STOP enable"]
#[inline(always)]
pub fn wupen(&mut self) -> WUPEN_W {
WUPEN_W { w: self }
}
#[doc = "Bit 19 - General call enable"]
#[inline(always)]
pub fn gcen(&mut self) -> GCEN_W {
GCEN_W { w: self }
}
#[doc = "Bit 20 - SMBus Host address enable"]
#[inline(always)]
pub fn smbhen(&mut self) -> SMBHEN_W {
SMBHEN_W { w: self }
}
#[doc = "Bit 21 - SMBus Device Default address enable"]
#[inline(always)]
pub fn smbden(&mut self) -> SMBDEN_W {
SMBDEN_W { w: self }
}
#[doc = "Bit 22 - SMBUS alert enable"]
#[inline(always)]
pub fn alerten(&mut self) -> ALERTEN_W {
ALERTEN_W { w: self }
}
#[doc = "Bit 23 - PEC enable"]
#[inline(always)]
pub fn pecen(&mut self) -> PECEN_W {
PECEN_W { w: self }
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "Control register 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr1](index.html) module"]
pub struct CR1_SPEC;
impl crate::RegisterSpec for CR1_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [cr1::R](R) reader structure"]
impl crate::Readable for CR1_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cr1::W](W) writer structure"]
impl crate::Writable for CR1_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets CR1 to value 0"]
impl crate::Resettable for CR1_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}