stm32-metapac 18.0.0

Peripheral Access Crate (PAC) for all STM32 chips, including metadata.
Documentation
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
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::identity_op)]
#![allow(clippy::unnecessary_cast)]
#![allow(clippy::erasing_op)]

#[doc = "Embedded Flash memory."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Flash {
    ptr: *mut u8,
}
unsafe impl Send for Flash {}
unsafe impl Sync for Flash {}
impl Flash {
    #[inline(always)]
    pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
        Self { ptr: ptr as _ }
    }
    #[inline(always)]
    pub const fn as_ptr(&self) -> *mut () {
        self.ptr as _
    }
    #[doc = "Access control register."]
    #[inline(always)]
    pub const fn acr(self) -> crate::common::Reg<regs::Acr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0usize) as _) }
    }
    #[doc = "FLASH control key register."]
    #[inline(always)]
    pub const fn keyr(self) -> crate::common::Reg<regs::Keyr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x04usize) as _) }
    }
    #[doc = "FLASH control register."]
    #[inline(always)]
    pub const fn cr(self) -> crate::common::Reg<regs::Cr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x10usize) as _) }
    }
    #[doc = "FLASH status register."]
    #[inline(always)]
    pub const fn sr(self) -> crate::common::Reg<regs::Sr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x14usize) as _) }
    }
    #[doc = "FLASH status register."]
    #[inline(always)]
    pub const fn fcr(self) -> crate::common::Reg<regs::Fcr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x18usize) as _) }
    }
    #[doc = "FLASH interrupt enable register."]
    #[inline(always)]
    pub const fn ier(self) -> crate::common::Reg<regs::Ier, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x20usize) as _) }
    }
    #[doc = "FLASH interrupt status register."]
    #[inline(always)]
    pub const fn isr(self) -> crate::common::Reg<regs::Isr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x24usize) as _) }
    }
    #[doc = "FLASH interrupt clear register."]
    #[inline(always)]
    pub const fn icr(self) -> crate::common::Reg<regs::Icr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x28usize) as _) }
    }
    #[doc = "FLASH CRC control register."]
    #[inline(always)]
    pub const fn crccr(self) -> crate::common::Reg<regs::Crccr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x30usize) as _) }
    }
    #[doc = "FLASH CRC start address register."]
    #[inline(always)]
    pub const fn crcsaddr(self) -> crate::common::Reg<regs::Crcsaddr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x34usize) as _) }
    }
    #[doc = "FLASH CRC end address register."]
    #[inline(always)]
    pub const fn crceaddr(self) -> crate::common::Reg<regs::Crceaddr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x38usize) as _) }
    }
    #[doc = "FLASH CRC data register."]
    #[inline(always)]
    pub const fn crcdatar(self) -> crate::common::Reg<regs::Crcdatar, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x3cusize) as _) }
    }
    #[doc = "FLASH ECC single error fail address."]
    #[inline(always)]
    pub const fn eccsfaddr(self) -> crate::common::Reg<regs::Eccsfaddr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x40usize) as _) }
    }
    #[doc = "FLASH ECC double error fail address."]
    #[inline(always)]
    pub const fn eccdfaddr(self) -> crate::common::Reg<regs::Eccdfaddr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x44usize) as _) }
    }
    #[doc = "FLASH options key register."]
    #[inline(always)]
    pub const fn optkeyr(self) -> crate::common::Reg<regs::Optkeyr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0100usize) as _) }
    }
    #[doc = "FLASH options control register."]
    #[inline(always)]
    pub const fn optcr(self) -> crate::common::Reg<regs::Optcr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0104usize) as _) }
    }
    #[doc = "FLASH options interrupt status register."]
    #[inline(always)]
    pub const fn optisr(self) -> crate::common::Reg<regs::Optisr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0108usize) as _) }
    }
    #[doc = "FLASH options interrupt clear register."]
    #[inline(always)]
    pub const fn opticr(self) -> crate::common::Reg<regs::Opticr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x010cusize) as _) }
    }
    #[doc = "FLASH option byte key control register."]
    #[inline(always)]
    pub const fn obkcr(self) -> crate::common::Reg<regs::Obkcr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0110usize) as _) }
    }
    #[doc = "FLASH option bytes key data register 0."]
    #[inline(always)]
    pub const fn obkdr(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
        assert!(n < 8usize);
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0118usize + n * 4usize) as _) }
    }
    #[doc = "FLASH non-volatile status register."]
    #[inline(always)]
    pub const fn nvsr(self) -> crate::common::Reg<regs::Nvsr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0200usize) as _) }
    }
    #[doc = "FLASH security status register programming."]
    #[inline(always)]
    pub const fn nvsrp(self) -> crate::common::Reg<regs::Nvsrp, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0204usize) as _) }
    }
    #[doc = "FLASH RoT status register."]
    #[inline(always)]
    pub const fn rotsr(self) -> crate::common::Reg<regs::Rotsr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0208usize) as _) }
    }
    #[doc = "FLASH RoT status register programming."]
    #[inline(always)]
    pub const fn rotsrp(self) -> crate::common::Reg<regs::Rotsrp, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x020cusize) as _) }
    }
    #[doc = "FLASH OTP lock status register."]
    #[inline(always)]
    pub const fn otplsr(self) -> crate::common::Reg<regs::Otplsr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0210usize) as _) }
    }
    #[doc = "FLASH OTP lock status register programming."]
    #[inline(always)]
    pub const fn otplsrp(self) -> crate::common::Reg<regs::Otplsrp, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0214usize) as _) }
    }
    #[doc = "FLASH write protection status register."]
    #[inline(always)]
    pub const fn wrpsr(self) -> crate::common::Reg<regs::Wrpsr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0218usize) as _) }
    }
    #[doc = "FLASH write protection status register programming."]
    #[inline(always)]
    pub const fn wrpsrp(self) -> crate::common::Reg<regs::Wrpsrp, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x021cusize) as _) }
    }
    #[doc = "FLASH hide protection status register."]
    #[inline(always)]
    pub const fn hdpsr(self) -> crate::common::Reg<regs::Hdpsr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0230usize) as _) }
    }
    #[doc = "FLASH hide protection status register programming."]
    #[inline(always)]
    pub const fn hdpsrp(self) -> crate::common::Reg<regs::Hdpsrp, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0234usize) as _) }
    }
    #[doc = "FLASH epoch status register."]
    #[inline(always)]
    pub const fn epochsr(self) -> crate::common::Reg<regs::Epochsr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0250usize) as _) }
    }
    #[doc = "FLASH RoT status register programming."]
    #[inline(always)]
    pub const fn epochsrp(self) -> crate::common::Reg<regs::Epochsrp, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0254usize) as _) }
    }
    #[doc = "FLASH option byte word 1 status register."]
    #[inline(always)]
    pub const fn obw1sr(self) -> crate::common::Reg<regs::Obw1sr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0260usize) as _) }
    }
    #[doc = "FLASH option byte word 1 status register programming."]
    #[inline(always)]
    pub const fn obw1srp(self) -> crate::common::Reg<regs::Obw1srp, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0264usize) as _) }
    }
    #[doc = "FLASH option byte word 2 status register."]
    #[inline(always)]
    pub const fn obw2sr(self) -> crate::common::Reg<regs::Obw2sr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0268usize) as _) }
    }
    #[doc = "FLASH option byte word 2 status register programming."]
    #[inline(always)]
    pub const fn obw2srp(self) -> crate::common::Reg<regs::Obw2srp, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x026cusize) as _) }
    }
}
pub mod regs {
    #[doc = "Access control register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Acr(pub u32);
    impl Acr {
        #[doc = "Read latency These bits are used to control the number of wait states used during read operations on both non-volatile memory banks. The application software has to program them to the correct value depending on the embedded Flash memory interface frequency and voltage conditions. Please refer to Table 27 for details. ... Note: Embedded Flash does not verify that the configuration is correct."]
        #[inline(always)]
        pub const fn latency(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0x0f;
            val as u8
        }
        #[doc = "Read latency These bits are used to control the number of wait states used during read operations on both non-volatile memory banks. The application software has to program them to the correct value depending on the embedded Flash memory interface frequency and voltage conditions. Please refer to Table 27 for details. ... Note: Embedded Flash does not verify that the configuration is correct."]
        #[inline(always)]
        pub fn set_latency(&mut self, val: u8) {
            self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
        }
        #[doc = "Flash signal delay These bits are used to control the delay between non-volatile memory signals during programming operations. Application software has to program them to the correct value depending on the embedded Flash memory interface frequency. Please refer to Table 27 for details. Note: Embedded Flash does not verify that the configuration is correct."]
        #[inline(always)]
        pub const fn wrhighfreq(&self) -> u8 {
            let val = (self.0 >> 4usize) & 0x03;
            val as u8
        }
        #[doc = "Flash signal delay These bits are used to control the delay between non-volatile memory signals during programming operations. Application software has to program them to the correct value depending on the embedded Flash memory interface frequency. Please refer to Table 27 for details. Note: Embedded Flash does not verify that the configuration is correct."]
        #[inline(always)]
        pub fn set_wrhighfreq(&mut self, val: u8) {
            self.0 = (self.0 & !(0x03 << 4usize)) | (((val as u32) & 0x03) << 4usize);
        }
    }
    impl Default for Acr {
        #[inline(always)]
        fn default() -> Acr {
            Acr(0)
        }
    }
    impl core::fmt::Debug for Acr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Acr")
                .field("latency", &self.latency())
                .field("wrhighfreq", &self.wrhighfreq())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Acr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "Acr {{ latency: {=u8:?}, wrhighfreq: {=u8:?} }}",
                self.latency(),
                self.wrhighfreq()
            )
        }
    }
    #[doc = "FLASH control register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Cr(pub u32);
    impl Cr {
        #[doc = "Configuration lock bit When this bit is set write to all other bits in this register, and to FLASH_IER register, are ignored. Clearing this bit requires the correct write sequence to FLASH_KEYR register (see this register for details). If a wrong sequence is executed, or if the unlock sequence is performed twice, this bit remains locked until the next system reset. During the write access to set LOCK bit from 0 to 1, it is possible to change the other bits of this register."]
        #[inline(always)]
        pub const fn lock(&self) -> bool {
            let val = (self.0 >> 0usize) & 0x01;
            val != 0
        }
        #[doc = "Configuration lock bit When this bit is set write to all other bits in this register, and to FLASH_IER register, are ignored. Clearing this bit requires the correct write sequence to FLASH_KEYR register (see this register for details). If a wrong sequence is executed, or if the unlock sequence is performed twice, this bit remains locked until the next system reset. During the write access to set LOCK bit from 0 to 1, it is possible to change the other bits of this register."]
        #[inline(always)]
        pub fn set_lock(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
        }
        #[doc = "Internal buffer control bit Setting this bit enables internal buffer for write operations. This allows preparing program operations even if a sector or bank erase is ongoing. When PG is cleared, the internal buffer is disabled for write operations, and all the data stored in the buffer but not sent to the operation queue are lost."]
        #[inline(always)]
        pub const fn pg(&self) -> bool {
            let val = (self.0 >> 1usize) & 0x01;
            val != 0
        }
        #[doc = "Internal buffer control bit Setting this bit enables internal buffer for write operations. This allows preparing program operations even if a sector or bank erase is ongoing. When PG is cleared, the internal buffer is disabled for write operations, and all the data stored in the buffer but not sent to the operation queue are lost."]
        #[inline(always)]
        pub fn set_pg(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
        }
        #[doc = "Sector erase request Setting this bit requests a sector erase. Write protection error is triggered when a sector erase is required on at least one protected sector. BER has a higher priority than SER: if both bits are set, the embedded Flash memory executes a bank erase."]
        #[inline(always)]
        pub const fn ser(&self) -> bool {
            let val = (self.0 >> 2usize) & 0x01;
            val != 0
        }
        #[doc = "Sector erase request Setting this bit requests a sector erase. Write protection error is triggered when a sector erase is required on at least one protected sector. BER has a higher priority than SER: if both bits are set, the embedded Flash memory executes a bank erase."]
        #[inline(always)]
        pub fn set_ser(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
        }
        #[doc = "Bank erase request Setting this bit requests a bank erase operation (user Flash memory only). Write protection error is triggered when a bank erase is required and some sectors are protected. BER has a higher priority than SER: if both are set, the embedded Flash memory executes a bank erase."]
        #[inline(always)]
        pub const fn ber(&self) -> bool {
            let val = (self.0 >> 3usize) & 0x01;
            val != 0
        }
        #[doc = "Bank erase request Setting this bit requests a bank erase operation (user Flash memory only). Write protection error is triggered when a bank erase is required and some sectors are protected. BER has a higher priority than SER: if both are set, the embedded Flash memory executes a bank erase."]
        #[inline(always)]
        pub fn set_ber(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
        }
        #[doc = "Force write This bit forces a write operation even if the write buffer is not full. In this case all bits not written are set by hardware. The embedded Flash memory resets FW when the corresponding operation has been acknowledged. Note: Using a force-write operation prevents the application from updating later the missing bits with something else than 1, because it is likely that it will lead to permanent ECC error. Write forcing is effective only if the write buffer is not empty (in particular, FW does not start several write operations when the force-write operations are performed consecutively)."]
        #[inline(always)]
        pub const fn fw(&self) -> bool {
            let val = (self.0 >> 4usize) & 0x01;
            val != 0
        }
        #[doc = "Force write This bit forces a write operation even if the write buffer is not full. In this case all bits not written are set by hardware. The embedded Flash memory resets FW when the corresponding operation has been acknowledged. Note: Using a force-write operation prevents the application from updating later the missing bits with something else than 1, because it is likely that it will lead to permanent ECC error. Write forcing is effective only if the write buffer is not empty (in particular, FW does not start several write operations when the force-write operations are performed consecutively)."]
        #[inline(always)]
        pub fn set_fw(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
        }
        #[doc = "Erase start control bit This bit is used to start a sector erase or a bank erase operation. The embedded Flash memory resets START when the corresponding operation has been acknowledged. The user application cannot access any embedded Flash memory register until the operation is acknowledged."]
        #[inline(always)]
        pub const fn start(&self) -> bool {
            let val = (self.0 >> 5usize) & 0x01;
            val != 0
        }
        #[doc = "Erase start control bit This bit is used to start a sector erase or a bank erase operation. The embedded Flash memory resets START when the corresponding operation has been acknowledged. The user application cannot access any embedded Flash memory register until the operation is acknowledged."]
        #[inline(always)]
        pub fn set_start(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
        }
        #[doc = "Sector erase selection number These bits are used to select the target sector for an erase operation (they are unused otherwise). ..."]
        #[inline(always)]
        pub const fn ssn(&self) -> u8 {
            let val = (self.0 >> 6usize) & 0x07;
            val as u8
        }
        #[doc = "Sector erase selection number These bits are used to select the target sector for an erase operation (they are unused otherwise). ..."]
        #[inline(always)]
        pub fn set_ssn(&mut self, val: u8) {
            self.0 = (self.0 & !(0x07 << 6usize)) | (((val as u32) & 0x07) << 6usize);
        }
        #[doc = "Program Enable for OTP Area Set this bit to enable write operations to OTP area."]
        #[inline(always)]
        pub const fn pg_otp(&self) -> bool {
            let val = (self.0 >> 16usize) & 0x01;
            val != 0
        }
        #[doc = "Program Enable for OTP Area Set this bit to enable write operations to OTP area."]
        #[inline(always)]
        pub fn set_pg_otp(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
        }
        #[doc = "CRC enable Setting this bit enables the CRC calculation. CRC_EN does not start CRC calculation but enables CRC configuration through FLASH_CRCCR register. When CRC calculation is performed it can be disabled by clearing CRC_EN bit. Doing so sets CRCDATA to 0x0, clears CRC configuration and resets the content of FLASH_CRCDATAR register."]
        #[inline(always)]
        pub const fn crc_en(&self) -> bool {
            let val = (self.0 >> 17usize) & 0x01;
            val != 0
        }
        #[doc = "CRC enable Setting this bit enables the CRC calculation. CRC_EN does not start CRC calculation but enables CRC configuration through FLASH_CRCCR register. When CRC calculation is performed it can be disabled by clearing CRC_EN bit. Doing so sets CRCDATA to 0x0, clears CRC configuration and resets the content of FLASH_CRCDATAR register."]
        #[inline(always)]
        pub fn set_crc_en(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
        }
        #[doc = "All banks select bit When this bit is set the erase is done on all Flash Memory sectors. ALL_BANKS is used only if a bank erase is required (BER=1). In all others operations, this control bit is ignored."]
        #[inline(always)]
        pub const fn all_banks(&self) -> bool {
            let val = (self.0 >> 24usize) & 0x01;
            val != 0
        }
        #[doc = "All banks select bit When this bit is set the erase is done on all Flash Memory sectors. ALL_BANKS is used only if a bank erase is required (BER=1). In all others operations, this control bit is ignored."]
        #[inline(always)]
        pub fn set_all_banks(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
        }
    }
    impl Default for Cr {
        #[inline(always)]
        fn default() -> Cr {
            Cr(0)
        }
    }
    impl core::fmt::Debug for Cr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Cr")
                .field("lock", &self.lock())
                .field("pg", &self.pg())
                .field("ser", &self.ser())
                .field("ber", &self.ber())
                .field("fw", &self.fw())
                .field("start", &self.start())
                .field("ssn", &self.ssn())
                .field("pg_otp", &self.pg_otp())
                .field("crc_en", &self.crc_en())
                .field("all_banks", &self.all_banks())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Cr {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Cr {{ lock: {=bool:?}, pg: {=bool:?}, ser: {=bool:?}, ber: {=bool:?}, fw: {=bool:?}, start: {=bool:?}, ssn: {=u8:?}, pg_otp: {=bool:?}, crc_en: {=bool:?}, all_banks: {=bool:?} }}" , self . lock () , self . pg () , self . ser () , self . ber () , self . fw () , self . start () , self . ssn () , self . pg_otp () , self . crc_en () , self . all_banks ())
        }
    }
    #[doc = "FLASH CRC control register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Crccr(pub u32);
    impl Crccr {
        #[doc = "CRC sector number CRC_SECT is used to select one user Flash sectors to be added to the list of sectors on which the CRC is calculated. The CRC can be computed either between two addresses (using registers FLASH_CRCSADDR and FLASH_CRCEADDR) or on a list of sectors using this register. If this latter option is selected, it is possible to add a sector to the list of sectors by programming the sector number in CRC_SECT and then setting ADD_SECT bit. The list of sectors can be erased either by setting CLEAN_SECT bit or by disabling the CRC computation. ..."]
        #[inline(always)]
        pub const fn crc_sect(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0x03;
            val as u8
        }
        #[doc = "CRC sector number CRC_SECT is used to select one user Flash sectors to be added to the list of sectors on which the CRC is calculated. The CRC can be computed either between two addresses (using registers FLASH_CRCSADDR and FLASH_CRCEADDR) or on a list of sectors using this register. If this latter option is selected, it is possible to add a sector to the list of sectors by programming the sector number in CRC_SECT and then setting ADD_SECT bit. The list of sectors can be erased either by setting CLEAN_SECT bit or by disabling the CRC computation. ..."]
        #[inline(always)]
        pub fn set_crc_sect(&mut self, val: u8) {
            self.0 = (self.0 & !(0x03 << 0usize)) | (((val as u32) & 0x03) << 0usize);
        }
        #[doc = "CRC sector mode select bit When this bit is set the CRC calculation is performed at sector level, on the sectors present in the list of sectors. To add a sector to this list, use ADD_SECT and CRC_SECT bits. To clean the list, use CLEAN_SECT bit. When CRC_BY_SECT is cleared the CRC calculation is performed on all addresses defined between start and end addresses defined in FLASH_CRCSADDR and FLASH_CRCEADDR registers."]
        #[inline(always)]
        pub const fn crc_by_sect(&self) -> bool {
            let val = (self.0 >> 9usize) & 0x01;
            val != 0
        }
        #[doc = "CRC sector mode select bit When this bit is set the CRC calculation is performed at sector level, on the sectors present in the list of sectors. To add a sector to this list, use ADD_SECT and CRC_SECT bits. To clean the list, use CLEAN_SECT bit. When CRC_BY_SECT is cleared the CRC calculation is performed on all addresses defined between start and end addresses defined in FLASH_CRCSADDR and FLASH_CRCEADDR registers."]
        #[inline(always)]
        pub fn set_crc_by_sect(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
        }
        #[doc = "CRC sector select bit When this bit is set the sector whose number is written in CRC_SECT is added to the list of sectors on which the CRC is calculated."]
        #[inline(always)]
        pub const fn add_sect(&self) -> bool {
            let val = (self.0 >> 10usize) & 0x01;
            val != 0
        }
        #[doc = "CRC sector select bit When this bit is set the sector whose number is written in CRC_SECT is added to the list of sectors on which the CRC is calculated."]
        #[inline(always)]
        pub fn set_add_sect(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
        }
        #[doc = "CRC sector list clear bit When this bit is set the list of sectors on which the CRC is calculated is cleared."]
        #[inline(always)]
        pub const fn clean_sect(&self) -> bool {
            let val = (self.0 >> 11usize) & 0x01;
            val != 0
        }
        #[doc = "CRC sector list clear bit When this bit is set the list of sectors on which the CRC is calculated is cleared."]
        #[inline(always)]
        pub fn set_clean_sect(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
        }
        #[doc = "CRC start bit START_CRC bit triggers a CRC calculation using the current configuration. No CRC calculation can launched when an option byte change operation is ongoing because all read accesses to embedded Flash memory registers are put on hold until the option byte change operation has completed. This bit is cleared when CRC computation starts."]
        #[inline(always)]
        pub const fn start_crc(&self) -> bool {
            let val = (self.0 >> 16usize) & 0x01;
            val != 0
        }
        #[doc = "CRC start bit START_CRC bit triggers a CRC calculation using the current configuration. No CRC calculation can launched when an option byte change operation is ongoing because all read accesses to embedded Flash memory registers are put on hold until the option byte change operation has completed. This bit is cleared when CRC computation starts."]
        #[inline(always)]
        pub fn set_start_crc(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
        }
        #[doc = "CRC clear bit Setting CLEAN_CRC to 1 clears the current CRC result stored in the FLASH_CRCDATAR register."]
        #[inline(always)]
        pub const fn clean_crc(&self) -> bool {
            let val = (self.0 >> 17usize) & 0x01;
            val != 0
        }
        #[doc = "CRC clear bit Setting CLEAN_CRC to 1 clears the current CRC result stored in the FLASH_CRCDATAR register."]
        #[inline(always)]
        pub fn set_clean_crc(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
        }
        #[doc = "CRC burst size CRC_BURST bits set the size of the bursts that are generated by the CRC calculation unit. A Flash word is 128-bit."]
        #[inline(always)]
        pub const fn crc_burst(&self) -> super::vals::CrcBurst {
            let val = (self.0 >> 20usize) & 0x03;
            super::vals::CrcBurst::from_bits(val as u8)
        }
        #[doc = "CRC burst size CRC_BURST bits set the size of the bursts that are generated by the CRC calculation unit. A Flash word is 128-bit."]
        #[inline(always)]
        pub fn set_crc_burst(&mut self, val: super::vals::CrcBurst) {
            self.0 = (self.0 & !(0x03 << 20usize)) | (((val.to_bits() as u32) & 0x03) << 20usize);
        }
        #[doc = "All sectors selection When this bit is set all the sectors in user Flash are added to list of sectors on which the CRC shall be calculated. This bit is cleared when CRC computation starts."]
        #[inline(always)]
        pub const fn all_sect(&self) -> bool {
            let val = (self.0 >> 24usize) & 0x01;
            val != 0
        }
        #[doc = "All sectors selection When this bit is set all the sectors in user Flash are added to list of sectors on which the CRC shall be calculated. This bit is cleared when CRC computation starts."]
        #[inline(always)]
        pub fn set_all_sect(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
        }
    }
    impl Default for Crccr {
        #[inline(always)]
        fn default() -> Crccr {
            Crccr(0)
        }
    }
    impl core::fmt::Debug for Crccr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Crccr")
                .field("crc_sect", &self.crc_sect())
                .field("crc_by_sect", &self.crc_by_sect())
                .field("add_sect", &self.add_sect())
                .field("clean_sect", &self.clean_sect())
                .field("start_crc", &self.start_crc())
                .field("clean_crc", &self.clean_crc())
                .field("crc_burst", &self.crc_burst())
                .field("all_sect", &self.all_sect())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Crccr {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Crccr {{ crc_sect: {=u8:?}, crc_by_sect: {=bool:?}, add_sect: {=bool:?}, clean_sect: {=bool:?}, start_crc: {=bool:?}, clean_crc: {=bool:?}, crc_burst: {:?}, all_sect: {=bool:?} }}" , self . crc_sect () , self . crc_by_sect () , self . add_sect () , self . clean_sect () , self . start_crc () , self . clean_crc () , self . crc_burst () , self . all_sect ())
        }
    }
    #[doc = "FLASH CRC data register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Crcdatar(pub u32);
    impl Crcdatar {
        #[doc = "CRC result This bitfield contains the result of the last CRC calculation. The value is valid only when CRC calculation completed (CRCENDF is set in FLASH_ISR register). CRC_DATA is cleared when CRC_EN is cleared in FLASH_CR register (CRC disabled), or when CLEAN_CRC bit is set in FLASH_CRCCR register."]
        #[inline(always)]
        pub const fn crc_data(&self) -> u32 {
            let val = (self.0 >> 0usize) & 0xffff_ffff;
            val as u32
        }
        #[doc = "CRC result This bitfield contains the result of the last CRC calculation. The value is valid only when CRC calculation completed (CRCENDF is set in FLASH_ISR register). CRC_DATA is cleared when CRC_EN is cleared in FLASH_CR register (CRC disabled), or when CLEAN_CRC bit is set in FLASH_CRCCR register."]
        #[inline(always)]
        pub fn set_crc_data(&mut self, val: u32) {
            self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
        }
    }
    impl Default for Crcdatar {
        #[inline(always)]
        fn default() -> Crcdatar {
            Crcdatar(0)
        }
    }
    impl core::fmt::Debug for Crcdatar {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Crcdatar").field("crc_data", &self.crc_data()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Crcdatar {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Crcdatar {{ crc_data: {=u32:?} }}", self.crc_data())
        }
    }
    #[doc = "FLASH CRC end address register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Crceaddr(pub u32);
    impl Crceaddr {
        #[doc = "CRC end address This register is used when CRC_BY_SECT is cleared. It must be programmed to the address of the Flash word starting the last burst of the CRC calculation. The burst size is defined in CRC_BURST of FLASH_CRCCR register. The least significant bits \\[5:0\\]
of the address are set by hardware to 0 (minimum burst size= 64 bytes). The address is relative to the Flash bank."]
        #[inline(always)]
        pub const fn crc_end_addr(&self) -> u16 {
            let val = (self.0 >> 6usize) & 0x07ff;
            val as u16
        }
        #[doc = "CRC end address This register is used when CRC_BY_SECT is cleared. It must be programmed to the address of the Flash word starting the last burst of the CRC calculation. The burst size is defined in CRC_BURST of FLASH_CRCCR register. The least significant bits \\[5:0\\]
of the address are set by hardware to 0 (minimum burst size= 64 bytes). The address is relative to the Flash bank."]
        #[inline(always)]
        pub fn set_crc_end_addr(&mut self, val: u16) {
            self.0 = (self.0 & !(0x07ff << 6usize)) | (((val as u32) & 0x07ff) << 6usize);
        }
    }
    impl Default for Crceaddr {
        #[inline(always)]
        fn default() -> Crceaddr {
            Crceaddr(0)
        }
    }
    impl core::fmt::Debug for Crceaddr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Crceaddr")
                .field("crc_end_addr", &self.crc_end_addr())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Crceaddr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Crceaddr {{ crc_end_addr: {=u16:?} }}", self.crc_end_addr())
        }
    }
    #[doc = "FLASH CRC start address register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Crcsaddr(pub u32);
    impl Crcsaddr {
        #[doc = "CRC start address This register is used when CRC_BY_SECT is cleared. It must be programmed to the address of the first Flash word to use for the CRC calculation, done burst by burst. CRC computation starts at an address aligned to the burst size defined in CRC_BURST of FLASH_CRCCR register. Hence least significant bits \\[5:0\\]
of the address are set by hardware to 0 (minimum burst size= 64 bytes). The address is relative to the Flash bank."]
        #[inline(always)]
        pub const fn crc_start_addr(&self) -> u16 {
            let val = (self.0 >> 6usize) & 0x07ff;
            val as u16
        }
        #[doc = "CRC start address This register is used when CRC_BY_SECT is cleared. It must be programmed to the address of the first Flash word to use for the CRC calculation, done burst by burst. CRC computation starts at an address aligned to the burst size defined in CRC_BURST of FLASH_CRCCR register. Hence least significant bits \\[5:0\\]
of the address are set by hardware to 0 (minimum burst size= 64 bytes). The address is relative to the Flash bank."]
        #[inline(always)]
        pub fn set_crc_start_addr(&mut self, val: u16) {
            self.0 = (self.0 & !(0x07ff << 6usize)) | (((val as u32) & 0x07ff) << 6usize);
        }
    }
    impl Default for Crcsaddr {
        #[inline(always)]
        fn default() -> Crcsaddr {
            Crcsaddr(0)
        }
    }
    impl core::fmt::Debug for Crcsaddr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Crcsaddr")
                .field("crc_start_addr", &self.crc_start_addr())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Crcsaddr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Crcsaddr {{ crc_start_addr: {=u16:?} }}", self.crc_start_addr())
        }
    }
    #[doc = "FLASH ECC double error fail address."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Eccdfaddr(pub u32);
    impl Eccdfaddr {
        #[doc = "ECC double error detection fail address When a double ECC detection occurs during a read operation, the DED_FADD bitfield contains the system bus address that generated the error. This register is automatically cleared when the DBECCERRF flag that generated the error is cleared. Note that only the first address that generated an ECC double error detection error is saved in this register."]
        #[inline(always)]
        pub const fn ded_fadd(&self) -> u32 {
            let val = (self.0 >> 0usize) & 0xffff_ffff;
            val as u32
        }
        #[doc = "ECC double error detection fail address When a double ECC detection occurs during a read operation, the DED_FADD bitfield contains the system bus address that generated the error. This register is automatically cleared when the DBECCERRF flag that generated the error is cleared. Note that only the first address that generated an ECC double error detection error is saved in this register."]
        #[inline(always)]
        pub fn set_ded_fadd(&mut self, val: u32) {
            self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
        }
    }
    impl Default for Eccdfaddr {
        #[inline(always)]
        fn default() -> Eccdfaddr {
            Eccdfaddr(0)
        }
    }
    impl core::fmt::Debug for Eccdfaddr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Eccdfaddr").field("ded_fadd", &self.ded_fadd()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Eccdfaddr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Eccdfaddr {{ ded_fadd: {=u32:?} }}", self.ded_fadd())
        }
    }
    #[doc = "FLASH ECC single error fail address."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Eccsfaddr(pub u32);
    impl Eccsfaddr {
        #[doc = "ECC single error correction fail address When a single ECC error correction occurs during a read operation, the SEC_FADD bitfield contains the system bus address that generated the error. This register is automatically cleared when SNECCERRF flag that generated the error is cleared. Note that only the first address that generated an ECC single error correction error is saved in this register."]
        #[inline(always)]
        pub const fn sec_fadd(&self) -> u32 {
            let val = (self.0 >> 0usize) & 0xffff_ffff;
            val as u32
        }
        #[doc = "ECC single error correction fail address When a single ECC error correction occurs during a read operation, the SEC_FADD bitfield contains the system bus address that generated the error. This register is automatically cleared when SNECCERRF flag that generated the error is cleared. Note that only the first address that generated an ECC single error correction error is saved in this register."]
        #[inline(always)]
        pub fn set_sec_fadd(&mut self, val: u32) {
            self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
        }
    }
    impl Default for Eccsfaddr {
        #[inline(always)]
        fn default() -> Eccsfaddr {
            Eccsfaddr(0)
        }
    }
    impl core::fmt::Debug for Eccsfaddr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Eccsfaddr").field("sec_fadd", &self.sec_fadd()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Eccsfaddr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Eccsfaddr {{ sec_fadd: {=u32:?} }}", self.sec_fadd())
        }
    }
    #[doc = "FLASH epoch status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Epochsr(pub u32);
    impl Epochsr {
        #[doc = "Epoch This value is distributed by hardware to the SAES peripheral."]
        #[inline(always)]
        pub const fn epoch(&self) -> u32 {
            let val = (self.0 >> 0usize) & 0x00ff_ffff;
            val as u32
        }
        #[doc = "Epoch This value is distributed by hardware to the SAES peripheral."]
        #[inline(always)]
        pub fn set_epoch(&mut self, val: u32) {
            self.0 = (self.0 & !(0x00ff_ffff << 0usize)) | (((val as u32) & 0x00ff_ffff) << 0usize);
        }
    }
    impl Default for Epochsr {
        #[inline(always)]
        fn default() -> Epochsr {
            Epochsr(0)
        }
    }
    impl core::fmt::Debug for Epochsr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Epochsr").field("epoch", &self.epoch()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Epochsr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Epochsr {{ epoch: {=u32:?} }}", self.epoch())
        }
    }
    #[doc = "FLASH RoT status register programming."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Epochsrp(pub u32);
    impl Epochsrp {
        #[doc = "Epoch programming Write to change corresponding bits in FLASH_EPOCHSR register."]
        #[inline(always)]
        pub const fn epoch(&self) -> u32 {
            let val = (self.0 >> 0usize) & 0x00ff_ffff;
            val as u32
        }
        #[doc = "Epoch programming Write to change corresponding bits in FLASH_EPOCHSR register."]
        #[inline(always)]
        pub fn set_epoch(&mut self, val: u32) {
            self.0 = (self.0 & !(0x00ff_ffff << 0usize)) | (((val as u32) & 0x00ff_ffff) << 0usize);
        }
    }
    impl Default for Epochsrp {
        #[inline(always)]
        fn default() -> Epochsrp {
            Epochsrp(0)
        }
    }
    impl core::fmt::Debug for Epochsrp {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Epochsrp").field("epoch", &self.epoch()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Epochsrp {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Epochsrp {{ epoch: {=u32:?} }}", self.epoch())
        }
    }
    #[doc = "FLASH status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Fcr(pub u32);
    impl Fcr {
        #[doc = "Root code check flag clear Set this bit to clear RCHECKF bit in FLASH_SR."]
        #[inline(always)]
        pub const fn rcheckf(&self) -> bool {
            let val = (self.0 >> 25usize) & 0x01;
            val != 0
        }
        #[doc = "Root code check flag clear Set this bit to clear RCHECKF bit in FLASH_SR."]
        #[inline(always)]
        pub fn set_rcheckf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
        }
    }
    impl Default for Fcr {
        #[inline(always)]
        fn default() -> Fcr {
            Fcr(0)
        }
    }
    impl core::fmt::Debug for Fcr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Fcr").field("rcheckf", &self.rcheckf()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Fcr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Fcr {{ rcheckf: {=bool:?} }}", self.rcheckf())
        }
    }
    #[doc = "FLASH hide protection status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Hdpsr(pub u32);
    impl Hdpsr {
        #[doc = "Hide protection user Flash area start This option sets the start address that contains the first 256-byte block of the hide protection (HDP) area in user Flash area. If HDP_AREA_END=HDP_AREA_START all the sectors are protected. If HDP_AREA_END<HDP_AREA_START no sectors are protected."]
        #[inline(always)]
        pub const fn hdp_area_start(&self) -> u16 {
            let val = (self.0 >> 0usize) & 0x01ff;
            val as u16
        }
        #[doc = "Hide protection user Flash area start This option sets the start address that contains the first 256-byte block of the hide protection (HDP) area in user Flash area. If HDP_AREA_END=HDP_AREA_START all the sectors are protected. If HDP_AREA_END<HDP_AREA_START no sectors are protected."]
        #[inline(always)]
        pub fn set_hdp_area_start(&mut self, val: u16) {
            self.0 = (self.0 & !(0x01ff << 0usize)) | (((val as u32) & 0x01ff) << 0usize);
        }
        #[doc = "Hide protection user Flash area end This option sets the end address that contains the last 256-byte block of the hide protection (HDP) area in user Flash area. If HDP_AREA_END=HDP_AREA_START all the sectors are protected. If HDP_AREA_END<HDP_AREA_START no sectors are protected."]
        #[inline(always)]
        pub const fn hdp_area_end(&self) -> u16 {
            let val = (self.0 >> 16usize) & 0x01ff;
            val as u16
        }
        #[doc = "Hide protection user Flash area end This option sets the end address that contains the last 256-byte block of the hide protection (HDP) area in user Flash area. If HDP_AREA_END=HDP_AREA_START all the sectors are protected. If HDP_AREA_END<HDP_AREA_START no sectors are protected."]
        #[inline(always)]
        pub fn set_hdp_area_end(&mut self, val: u16) {
            self.0 = (self.0 & !(0x01ff << 16usize)) | (((val as u32) & 0x01ff) << 16usize);
        }
    }
    impl Default for Hdpsr {
        #[inline(always)]
        fn default() -> Hdpsr {
            Hdpsr(0)
        }
    }
    impl core::fmt::Debug for Hdpsr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Hdpsr")
                .field("hdp_area_start", &self.hdp_area_start())
                .field("hdp_area_end", &self.hdp_area_end())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Hdpsr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "Hdpsr {{ hdp_area_start: {=u16:?}, hdp_area_end: {=u16:?} }}",
                self.hdp_area_start(),
                self.hdp_area_end()
            )
        }
    }
    #[doc = "FLASH hide protection status register programming."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Hdpsrp(pub u32);
    impl Hdpsrp {
        #[doc = "Hide protection user Flash area start programming Write to change corresponding option byte bits in FLASH_HDPSR. If HDP_AREA_END=HDP_AREA_START all the sectors are protected. If HDP_AREA_END<HDP_AREA_START no sectors are protected."]
        #[inline(always)]
        pub const fn hdp_area_start(&self) -> u16 {
            let val = (self.0 >> 0usize) & 0x01ff;
            val as u16
        }
        #[doc = "Hide protection user Flash area start programming Write to change corresponding option byte bits in FLASH_HDPSR. If HDP_AREA_END=HDP_AREA_START all the sectors are protected. If HDP_AREA_END<HDP_AREA_START no sectors are protected."]
        #[inline(always)]
        pub fn set_hdp_area_start(&mut self, val: u16) {
            self.0 = (self.0 & !(0x01ff << 0usize)) | (((val as u32) & 0x01ff) << 0usize);
        }
        #[doc = "Hide protection user Flash area end programming Write to change corresponding option byte bits in FLASH_HDPSR. If HDP_AREA_END=HDP_AREA_START all the sectors are protected. If HDP_AREA_END<HDP_AREA_START no sectors are protected."]
        #[inline(always)]
        pub const fn hdp_area_end(&self) -> u16 {
            let val = (self.0 >> 16usize) & 0x01ff;
            val as u16
        }
        #[doc = "Hide protection user Flash area end programming Write to change corresponding option byte bits in FLASH_HDPSR. If HDP_AREA_END=HDP_AREA_START all the sectors are protected. If HDP_AREA_END<HDP_AREA_START no sectors are protected."]
        #[inline(always)]
        pub fn set_hdp_area_end(&mut self, val: u16) {
            self.0 = (self.0 & !(0x01ff << 16usize)) | (((val as u32) & 0x01ff) << 16usize);
        }
    }
    impl Default for Hdpsrp {
        #[inline(always)]
        fn default() -> Hdpsrp {
            Hdpsrp(0)
        }
    }
    impl core::fmt::Debug for Hdpsrp {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Hdpsrp")
                .field("hdp_area_start", &self.hdp_area_start())
                .field("hdp_area_end", &self.hdp_area_end())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Hdpsrp {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "Hdpsrp {{ hdp_area_start: {=u16:?}, hdp_area_end: {=u16:?} }}",
                self.hdp_area_start(),
                self.hdp_area_end()
            )
        }
    }
    #[doc = "FLASH interrupt clear register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Icr(pub u32);
    impl Icr {
        #[doc = "End-of-program flag clear Setting this bit clears EOPF flag in FLASH_ISR register."]
        #[inline(always)]
        pub const fn eopf(&self) -> bool {
            let val = (self.0 >> 16usize) & 0x01;
            val != 0
        }
        #[doc = "End-of-program flag clear Setting this bit clears EOPF flag in FLASH_ISR register."]
        #[inline(always)]
        pub fn set_eopf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
        }
        #[doc = "Write protection error flag clear Setting this bit clears WRPERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub const fn wrperrf(&self) -> bool {
            let val = (self.0 >> 17usize) & 0x01;
            val != 0
        }
        #[doc = "Write protection error flag clear Setting this bit clears WRPERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub fn set_wrperrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
        }
        #[doc = "Programming sequence error flag clear Setting this bit clears PGSERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub const fn pgserrf(&self) -> bool {
            let val = (self.0 >> 18usize) & 0x01;
            val != 0
        }
        #[doc = "Programming sequence error flag clear Setting this bit clears PGSERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub fn set_pgserrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
        }
        #[doc = "Strobe error flag clear Setting this bit clears STRBERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub const fn strberrf(&self) -> bool {
            let val = (self.0 >> 19usize) & 0x01;
            val != 0
        }
        #[doc = "Strobe error flag clear Setting this bit clears STRBERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub fn set_strberrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
        }
        #[doc = "Option byte loading error flag clear Setting this bit clears OBLERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub const fn oblerrf(&self) -> bool {
            let val = (self.0 >> 20usize) & 0x01;
            val != 0
        }
        #[doc = "Option byte loading error flag clear Setting this bit clears OBLERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub fn set_oblerrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
        }
        #[doc = "Inconsistency error flag clear Setting this bit clears INCERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub const fn incerrf(&self) -> bool {
            let val = (self.0 >> 21usize) & 0x01;
            val != 0
        }
        #[doc = "Inconsistency error flag clear Setting this bit clears INCERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub fn set_incerrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
        }
        #[doc = "Read security error flag clear Setting this bit clears RDSERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub const fn rdserrf(&self) -> bool {
            let val = (self.0 >> 24usize) & 0x01;
            val != 0
        }
        #[doc = "Read security error flag clear Setting this bit clears RDSERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub fn set_rdserrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
        }
        #[doc = "ECC single error flag clear Setting this bit clears SNECCERRF flag in FLASH_ISR register. If the DBECCERRF flag of FLASH_ISR register is also cleared, FLASH_ECCFAR register is reset to zero as well."]
        #[inline(always)]
        pub const fn sneccerrf(&self) -> bool {
            let val = (self.0 >> 25usize) & 0x01;
            val != 0
        }
        #[doc = "ECC single error flag clear Setting this bit clears SNECCERRF flag in FLASH_ISR register. If the DBECCERRF flag of FLASH_ISR register is also cleared, FLASH_ECCFAR register is reset to zero as well."]
        #[inline(always)]
        pub fn set_sneccerrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
        }
        #[doc = "ECC double error flag clear Setting this bit clears DBECCERRF flag in FLASH_ISR register. If the SNECCERRF flag of FLASH_ISR register is also cleared, FLASH_ECCFAR register is reset to zero as well."]
        #[inline(always)]
        pub const fn dbeccerrf(&self) -> bool {
            let val = (self.0 >> 26usize) & 0x01;
            val != 0
        }
        #[doc = "ECC double error flag clear Setting this bit clears DBECCERRF flag in FLASH_ISR register. If the SNECCERRF flag of FLASH_ISR register is also cleared, FLASH_ECCFAR register is reset to zero as well."]
        #[inline(always)]
        pub fn set_dbeccerrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
        }
        #[doc = "CRC end flag clear Setting this bit clears CRCENDF flag in FLASH_ISR register."]
        #[inline(always)]
        pub const fn crcendf(&self) -> bool {
            let val = (self.0 >> 27usize) & 0x01;
            val != 0
        }
        #[doc = "CRC end flag clear Setting this bit clears CRCENDF flag in FLASH_ISR register."]
        #[inline(always)]
        pub fn set_crcendf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
        }
        #[doc = "CRC error flag clear Setting this bit clears CRCRDERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub const fn crcrderrf(&self) -> bool {
            let val = (self.0 >> 28usize) & 0x01;
            val != 0
        }
        #[doc = "CRC error flag clear Setting this bit clears CRCRDERRF flag in FLASH_ISR register."]
        #[inline(always)]
        pub fn set_crcrderrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
        }
    }
    impl Default for Icr {
        #[inline(always)]
        fn default() -> Icr {
            Icr(0)
        }
    }
    impl core::fmt::Debug for Icr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Icr")
                .field("eopf", &self.eopf())
                .field("wrperrf", &self.wrperrf())
                .field("pgserrf", &self.pgserrf())
                .field("strberrf", &self.strberrf())
                .field("oblerrf", &self.oblerrf())
                .field("incerrf", &self.incerrf())
                .field("rdserrf", &self.rdserrf())
                .field("sneccerrf", &self.sneccerrf())
                .field("dbeccerrf", &self.dbeccerrf())
                .field("crcendf", &self.crcendf())
                .field("crcrderrf", &self.crcrderrf())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Icr {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Icr {{ eopf: {=bool:?}, wrperrf: {=bool:?}, pgserrf: {=bool:?}, strberrf: {=bool:?}, oblerrf: {=bool:?}, incerrf: {=bool:?}, rdserrf: {=bool:?}, sneccerrf: {=bool:?}, dbeccerrf: {=bool:?}, crcendf: {=bool:?}, crcrderrf: {=bool:?} }}" , self . eopf () , self . wrperrf () , self . pgserrf () , self . strberrf () , self . oblerrf () , self . incerrf () , self . rdserrf () , self . sneccerrf () , self . dbeccerrf () , self . crcendf () , self . crcrderrf ())
        }
    }
    #[doc = "FLASH interrupt enable register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Ier(pub u32);
    impl Ier {
        #[doc = "End-of-program interrupt control bit."]
        #[inline(always)]
        pub const fn eopie(&self) -> bool {
            let val = (self.0 >> 16usize) & 0x01;
            val != 0
        }
        #[doc = "End-of-program interrupt control bit."]
        #[inline(always)]
        pub fn set_eopie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
        }
        #[doc = "Write protection error interrupt enable bit."]
        #[inline(always)]
        pub const fn wrperrie(&self) -> bool {
            let val = (self.0 >> 17usize) & 0x01;
            val != 0
        }
        #[doc = "Write protection error interrupt enable bit."]
        #[inline(always)]
        pub fn set_wrperrie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
        }
        #[doc = "Programming sequence error interrupt enable bit."]
        #[inline(always)]
        pub const fn pgserrie(&self) -> bool {
            let val = (self.0 >> 18usize) & 0x01;
            val != 0
        }
        #[doc = "Programming sequence error interrupt enable bit."]
        #[inline(always)]
        pub fn set_pgserrie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
        }
        #[doc = "Strobe error interrupt enable bit."]
        #[inline(always)]
        pub const fn strberrie(&self) -> bool {
            let val = (self.0 >> 19usize) & 0x01;
            val != 0
        }
        #[doc = "Strobe error interrupt enable bit."]
        #[inline(always)]
        pub fn set_strberrie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
        }
        #[doc = "Option byte loading error interrupt enable bit."]
        #[inline(always)]
        pub const fn oblerrie(&self) -> bool {
            let val = (self.0 >> 20usize) & 0x01;
            val != 0
        }
        #[doc = "Option byte loading error interrupt enable bit."]
        #[inline(always)]
        pub fn set_oblerrie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
        }
        #[doc = "Inconsistency error interrupt enable bit."]
        #[inline(always)]
        pub const fn incerrie(&self) -> bool {
            let val = (self.0 >> 21usize) & 0x01;
            val != 0
        }
        #[doc = "Inconsistency error interrupt enable bit."]
        #[inline(always)]
        pub fn set_incerrie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
        }
        #[doc = "Read security error interrupt enable bit."]
        #[inline(always)]
        pub const fn rdserrie(&self) -> bool {
            let val = (self.0 >> 24usize) & 0x01;
            val != 0
        }
        #[doc = "Read security error interrupt enable bit."]
        #[inline(always)]
        pub fn set_rdserrie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
        }
        #[doc = "ECC single correction error interrupt enable bit."]
        #[inline(always)]
        pub const fn sneccerrie(&self) -> bool {
            let val = (self.0 >> 25usize) & 0x01;
            val != 0
        }
        #[doc = "ECC single correction error interrupt enable bit."]
        #[inline(always)]
        pub fn set_sneccerrie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
        }
        #[doc = "ECC double detection error interrupt enable bit."]
        #[inline(always)]
        pub const fn dbeccerrie(&self) -> bool {
            let val = (self.0 >> 26usize) & 0x01;
            val != 0
        }
        #[doc = "ECC double detection error interrupt enable bit."]
        #[inline(always)]
        pub fn set_dbeccerrie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
        }
        #[doc = "CRC end of calculation interrupt enable bit."]
        #[inline(always)]
        pub const fn crcendie(&self) -> bool {
            let val = (self.0 >> 27usize) & 0x01;
            val != 0
        }
        #[doc = "CRC end of calculation interrupt enable bit."]
        #[inline(always)]
        pub fn set_crcendie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
        }
        #[doc = "CRC read error interrupt enable bit."]
        #[inline(always)]
        pub const fn crcrderrie(&self) -> bool {
            let val = (self.0 >> 28usize) & 0x01;
            val != 0
        }
        #[doc = "CRC read error interrupt enable bit."]
        #[inline(always)]
        pub fn set_crcrderrie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
        }
    }
    impl Default for Ier {
        #[inline(always)]
        fn default() -> Ier {
            Ier(0)
        }
    }
    impl core::fmt::Debug for Ier {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Ier")
                .field("eopie", &self.eopie())
                .field("wrperrie", &self.wrperrie())
                .field("pgserrie", &self.pgserrie())
                .field("strberrie", &self.strberrie())
                .field("oblerrie", &self.oblerrie())
                .field("incerrie", &self.incerrie())
                .field("rdserrie", &self.rdserrie())
                .field("sneccerrie", &self.sneccerrie())
                .field("dbeccerrie", &self.dbeccerrie())
                .field("crcendie", &self.crcendie())
                .field("crcrderrie", &self.crcrderrie())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Ier {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Ier {{ eopie: {=bool:?}, wrperrie: {=bool:?}, pgserrie: {=bool:?}, strberrie: {=bool:?}, oblerrie: {=bool:?}, incerrie: {=bool:?}, rdserrie: {=bool:?}, sneccerrie: {=bool:?}, dbeccerrie: {=bool:?}, crcendie: {=bool:?}, crcrderrie: {=bool:?} }}" , self . eopie () , self . wrperrie () , self . pgserrie () , self . strberrie () , self . oblerrie () , self . incerrie () , self . rdserrie () , self . sneccerrie () , self . dbeccerrie () , self . crcendie () , self . crcrderrie ())
        }
    }
    #[doc = "FLASH interrupt status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Isr(pub u32);
    impl Isr {
        #[doc = "End-of-program flag This bit is set when a programming operation completes. An interrupt is generated if the EOPIE is set. It is not necessary to reset EOPF before starting a new operation. Setting EOPF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub const fn eopf(&self) -> bool {
            let val = (self.0 >> 16usize) & 0x01;
            val != 0
        }
        #[doc = "End-of-program flag This bit is set when a programming operation completes. An interrupt is generated if the EOPIE is set. It is not necessary to reset EOPF before starting a new operation. Setting EOPF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub fn set_eopf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
        }
        #[doc = "Write protection error flag This bit is set when a protection error occurs during a program operation. An interrupt is also generated if the WRPERRIE is set. Setting WRPERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub const fn wrperrf(&self) -> bool {
            let val = (self.0 >> 17usize) & 0x01;
            val != 0
        }
        #[doc = "Write protection error flag This bit is set when a protection error occurs during a program operation. An interrupt is also generated if the WRPERRIE is set. Setting WRPERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub fn set_wrperrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
        }
        #[doc = "Programming sequence error flag This bit is set when a sequence error occurs. An interrupt is generated if the PGSERRIE bit is set. Setting PGSERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub const fn pgserrf(&self) -> bool {
            let val = (self.0 >> 18usize) & 0x01;
            val != 0
        }
        #[doc = "Programming sequence error flag This bit is set when a sequence error occurs. An interrupt is generated if the PGSERRIE bit is set. Setting PGSERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub fn set_pgserrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
        }
        #[doc = "Strobe error flag This bit is set when a strobe error occurs (when the master attempts to write several times the same byte in the write buffer). An interrupt is generated if the STRBERRIE bit is set. Setting STRBERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub const fn strberrf(&self) -> bool {
            let val = (self.0 >> 19usize) & 0x01;
            val != 0
        }
        #[doc = "Strobe error flag This bit is set when a strobe error occurs (when the master attempts to write several times the same byte in the write buffer). An interrupt is generated if the STRBERRIE bit is set. Setting STRBERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub fn set_strberrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
        }
        #[doc = "Option byte loading error flag This bit is set when an error is found during the option byte loading sequence. An interrupt is generated if OBLERRIE is set. Setting OBLERRF bit in the FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub const fn oblerrf(&self) -> bool {
            let val = (self.0 >> 20usize) & 0x01;
            val != 0
        }
        #[doc = "Option byte loading error flag This bit is set when an error is found during the option byte loading sequence. An interrupt is generated if OBLERRIE is set. Setting OBLERRF bit in the FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub fn set_oblerrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
        }
        #[doc = "Inconsistency error flag This bit is set when a inconsistency error occurs. An interrupt is generated if INCERRIE is set. Setting INCERRF bit in the FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub const fn incerrf(&self) -> bool {
            let val = (self.0 >> 21usize) & 0x01;
            val != 0
        }
        #[doc = "Inconsistency error flag This bit is set when a inconsistency error occurs. An interrupt is generated if INCERRIE is set. Setting INCERRF bit in the FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub fn set_incerrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
        }
        #[doc = "Read security error flag This bit is set when a read security error occurs (read access to hide protected area with incorrect hide protection level). An interrupt is generated if RDSERRIE is set. Setting RDSERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub const fn rdserrf(&self) -> bool {
            let val = (self.0 >> 24usize) & 0x01;
            val != 0
        }
        #[doc = "Read security error flag This bit is set when a read security error occurs (read access to hide protected area with incorrect hide protection level). An interrupt is generated if RDSERRIE is set. Setting RDSERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub fn set_rdserrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
        }
        #[doc = "ECC single error flag This bit is set when an ECC single correction error occurs during a read operation. An interrupt is generated if SNECCERRIE is set. Setting SNECCERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub const fn sneccerrf(&self) -> bool {
            let val = (self.0 >> 25usize) & 0x01;
            val != 0
        }
        #[doc = "ECC single error flag This bit is set when an ECC single correction error occurs during a read operation. An interrupt is generated if SNECCERRIE is set. Setting SNECCERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub fn set_sneccerrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
        }
        #[doc = "ECC double error flag This bit is set when an ECC double detection error occurs during a read operation. An interrupt is generated if DBECCERRIE is set. Setting DBECCERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub const fn dbeccerrf(&self) -> bool {
            let val = (self.0 >> 26usize) & 0x01;
            val != 0
        }
        #[doc = "ECC double error flag This bit is set when an ECC double detection error occurs during a read operation. An interrupt is generated if DBECCERRIE is set. Setting DBECCERRF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub fn set_dbeccerrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
        }
        #[doc = "CRC end flag This bit is set when the CRC computation has completed. An interrupt is generated if CRCENDIE is set. It is not necessary to reset CRCEND before restarting CRC computation. Setting CRCENDF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub const fn crcendf(&self) -> bool {
            let val = (self.0 >> 27usize) & 0x01;
            val != 0
        }
        #[doc = "CRC end flag This bit is set when the CRC computation has completed. An interrupt is generated if CRCENDIE is set. It is not necessary to reset CRCEND before restarting CRC computation. Setting CRCENDF bit in FLASH_ICR register clears this bit."]
        #[inline(always)]
        pub fn set_crcendf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
        }
        #[doc = "CRC read error flag This bit is set when a word is found read protected during a CRC operation. An interrupt is generated if CRCRDIE is set. Setting CRCRDERRF bit in FLASH_ICR register clears this bit. This flag is valid only when CRCEND bit is set."]
        #[inline(always)]
        pub const fn crcrderrf(&self) -> bool {
            let val = (self.0 >> 28usize) & 0x01;
            val != 0
        }
        #[doc = "CRC read error flag This bit is set when a word is found read protected during a CRC operation. An interrupt is generated if CRCRDIE is set. Setting CRCRDERRF bit in FLASH_ICR register clears this bit. This flag is valid only when CRCEND bit is set."]
        #[inline(always)]
        pub fn set_crcrderrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
        }
    }
    impl Default for Isr {
        #[inline(always)]
        fn default() -> Isr {
            Isr(0)
        }
    }
    impl core::fmt::Debug for Isr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Isr")
                .field("eopf", &self.eopf())
                .field("wrperrf", &self.wrperrf())
                .field("pgserrf", &self.pgserrf())
                .field("strberrf", &self.strberrf())
                .field("oblerrf", &self.oblerrf())
                .field("incerrf", &self.incerrf())
                .field("rdserrf", &self.rdserrf())
                .field("sneccerrf", &self.sneccerrf())
                .field("dbeccerrf", &self.dbeccerrf())
                .field("crcendf", &self.crcendf())
                .field("crcrderrf", &self.crcrderrf())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Isr {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Isr {{ eopf: {=bool:?}, wrperrf: {=bool:?}, pgserrf: {=bool:?}, strberrf: {=bool:?}, oblerrf: {=bool:?}, incerrf: {=bool:?}, rdserrf: {=bool:?}, sneccerrf: {=bool:?}, dbeccerrf: {=bool:?}, crcendf: {=bool:?}, crcrderrf: {=bool:?} }}" , self . eopf () , self . wrperrf () , self . pgserrf () , self . strberrf () , self . oblerrf () , self . incerrf () , self . rdserrf () , self . sneccerrf () , self . dbeccerrf () , self . crcendf () , self . crcrderrf ())
        }
    }
    #[doc = "FLASH control key register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Keyr(pub u32);
    impl Keyr {
        #[doc = "Control unlock key Following values must be written to FLASH_KEYR consecutively to unlock FLASH_CR register: 1st key = 0x4567 0123 2nd key = 0xCDEF 89AB Reads to this register returns zero. If above sequence is wrong or performed twice, the FLASH_CR register is locked until the next system reset, and access to it generates a bus error."]
        #[inline(always)]
        pub const fn cukey(&self) -> u32 {
            let val = (self.0 >> 0usize) & 0xffff_ffff;
            val as u32
        }
        #[doc = "Control unlock key Following values must be written to FLASH_KEYR consecutively to unlock FLASH_CR register: 1st key = 0x4567 0123 2nd key = 0xCDEF 89AB Reads to this register returns zero. If above sequence is wrong or performed twice, the FLASH_CR register is locked until the next system reset, and access to it generates a bus error."]
        #[inline(always)]
        pub fn set_cukey(&mut self, val: u32) {
            self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
        }
    }
    impl Default for Keyr {
        #[inline(always)]
        fn default() -> Keyr {
            Keyr(0)
        }
    }
    impl core::fmt::Debug for Keyr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Keyr").field("cukey", &self.cukey()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Keyr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Keyr {{ cukey: {=u32:?} }}", self.cukey())
        }
    }
    #[doc = "FLASH non-volatile status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Nvsr(pub u32);
    impl Nvsr {
        #[doc = "Non-volatile state others: invalid configuration."]
        #[inline(always)]
        pub const fn nvstate(&self) -> super::vals::NvsrNvstate {
            let val = (self.0 >> 0usize) & 0xff;
            super::vals::NvsrNvstate::from_bits(val as u8)
        }
        #[doc = "Non-volatile state others: invalid configuration."]
        #[inline(always)]
        pub fn set_nvstate(&mut self, val: super::vals::NvsrNvstate) {
            self.0 = (self.0 & !(0xff << 0usize)) | (((val.to_bits() as u32) & 0xff) << 0usize);
        }
    }
    impl Default for Nvsr {
        #[inline(always)]
        fn default() -> Nvsr {
            Nvsr(0)
        }
    }
    impl core::fmt::Debug for Nvsr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Nvsr").field("nvstate", &self.nvstate()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Nvsr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Nvsr {{ nvstate: {:?} }}", self.nvstate())
        }
    }
    #[doc = "FLASH security status register programming."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Nvsrp(pub u32);
    impl Nvsrp {
        #[doc = "Non-volatile state programming Write to change corresponding bits in FLASH_NVSR register: Actual option byte change from close to open is triggered only after memory clear hardware process is confirmed. When NVSTATE=0xB4 (resp. 0x51) writing any other value than 0x51 (resp. 0xB4) triggers an option byte change error (OPTERRF)."]
        #[inline(always)]
        pub const fn nvstate(&self) -> super::vals::NvsrpNvstate {
            let val = (self.0 >> 0usize) & 0xff;
            super::vals::NvsrpNvstate::from_bits(val as u8)
        }
        #[doc = "Non-volatile state programming Write to change corresponding bits in FLASH_NVSR register: Actual option byte change from close to open is triggered only after memory clear hardware process is confirmed. When NVSTATE=0xB4 (resp. 0x51) writing any other value than 0x51 (resp. 0xB4) triggers an option byte change error (OPTERRF)."]
        #[inline(always)]
        pub fn set_nvstate(&mut self, val: super::vals::NvsrpNvstate) {
            self.0 = (self.0 & !(0xff << 0usize)) | (((val.to_bits() as u32) & 0xff) << 0usize);
        }
    }
    impl Default for Nvsrp {
        #[inline(always)]
        fn default() -> Nvsrp {
            Nvsrp(0)
        }
    }
    impl core::fmt::Debug for Nvsrp {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Nvsrp").field("nvstate", &self.nvstate()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Nvsrp {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Nvsrp {{ nvstate: {:?} }}", self.nvstate())
        }
    }
    #[doc = "FLASH option byte key control register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Obkcr(pub u32);
    impl Obkcr {
        #[doc = "Option byte key index This bitfield represents the index of the option byte key in a given hide protection level. Reading keys with index lower that 8, the value is not be available in OBKDRx registers. It is instead sent directly to SAES peripheral. All others keys can be read using OBKDRx registers. Up to 32 keys can be provisioned per hide protection level (0, 1 or 2), provided there is enough space left in the Flash to store them."]
        #[inline(always)]
        pub const fn obkindex(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0x1f;
            val as u8
        }
        #[doc = "Option byte key index This bitfield represents the index of the option byte key in a given hide protection level. Reading keys with index lower that 8, the value is not be available in OBKDRx registers. It is instead sent directly to SAES peripheral. All others keys can be read using OBKDRx registers. Up to 32 keys can be provisioned per hide protection level (0, 1 or 2), provided there is enough space left in the Flash to store them."]
        #[inline(always)]
        pub fn set_obkindex(&mut self, val: u8) {
            self.0 = (self.0 & !(0x1f << 0usize)) | (((val as u32) & 0x1f) << 0usize);
        }
        #[doc = "Next key level 10 or 11: reserved."]
        #[inline(always)]
        pub const fn nextkl(&self) -> super::vals::Nextkl {
            let val = (self.0 >> 8usize) & 0x03;
            super::vals::Nextkl::from_bits(val as u8)
        }
        #[doc = "Next key level 10 or 11: reserved."]
        #[inline(always)]
        pub fn set_nextkl(&mut self, val: super::vals::Nextkl) {
            self.0 = (self.0 & !(0x03 << 8usize)) | (((val.to_bits() as u32) & 0x03) << 8usize);
        }
        #[doc = "Option byte key size Application must use this bitfield to specify how many bits must be used for the new key. Embedded Flash ignores OBKSIZE during read of option keys because size is stored with the key."]
        #[inline(always)]
        pub const fn obksize(&self) -> super::vals::Obksize {
            let val = (self.0 >> 10usize) & 0x03;
            super::vals::Obksize::from_bits(val as u8)
        }
        #[doc = "Option byte key size Application must use this bitfield to specify how many bits must be used for the new key. Embedded Flash ignores OBKSIZE during read of option keys because size is stored with the key."]
        #[inline(always)]
        pub fn set_obksize(&mut self, val: super::vals::Obksize) {
            self.0 = (self.0 & !(0x03 << 10usize)) | (((val.to_bits() as u32) & 0x03) << 10usize);
        }
        #[doc = "Key program This bit must be set to write option byte keys (keys are read otherwise)."]
        #[inline(always)]
        pub const fn keyprog(&self) -> bool {
            let val = (self.0 >> 14usize) & 0x01;
            val != 0
        }
        #[doc = "Key program This bit must be set to write option byte keys (keys are read otherwise)."]
        #[inline(always)]
        pub fn set_keyprog(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
        }
        #[doc = "Key option start This bit is used to start the option byte key operation defined by the PROG bit. The embedded Flash memory resets START when the corresponding operation has been acknowledged."]
        #[inline(always)]
        pub const fn keystart(&self) -> bool {
            let val = (self.0 >> 15usize) & 0x01;
            val != 0
        }
        #[doc = "Key option start This bit is used to start the option byte key operation defined by the PROG bit. The embedded Flash memory resets START when the corresponding operation has been acknowledged."]
        #[inline(always)]
        pub fn set_keystart(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
        }
    }
    impl Default for Obkcr {
        #[inline(always)]
        fn default() -> Obkcr {
            Obkcr(0)
        }
    }
    impl core::fmt::Debug for Obkcr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Obkcr")
                .field("obkindex", &self.obkindex())
                .field("nextkl", &self.nextkl())
                .field("obksize", &self.obksize())
                .field("keyprog", &self.keyprog())
                .field("keystart", &self.keystart())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Obkcr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "Obkcr {{ obkindex: {=u8:?}, nextkl: {:?}, obksize: {:?}, keyprog: {=bool:?}, keystart: {=bool:?} }}",
                self.obkindex(),
                self.nextkl(),
                self.obksize(),
                self.keyprog(),
                self.keystart()
            )
        }
    }
    #[doc = "FLASH option byte word 1 status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Obw1sr(pub u32);
    impl Obw1sr {
        #[doc = "Brownout level These bits reflects the power level that generates a system reset."]
        #[inline(always)]
        pub const fn bor_lev(&self) -> super::vals::BorLev {
            let val = (self.0 >> 2usize) & 0x03;
            super::vals::BorLev::from_bits(val as u8)
        }
        #[doc = "Brownout level These bits reflects the power level that generates a system reset."]
        #[inline(always)]
        pub fn set_bor_lev(&mut self, val: super::vals::BorLev) {
            self.0 = (self.0 & !(0x03 << 2usize)) | (((val.to_bits() as u32) & 0x03) << 2usize);
        }
        #[doc = "Independent watchdog HW Control."]
        #[inline(always)]
        pub const fn iwdg_hw(&self) -> bool {
            let val = (self.0 >> 4usize) & 0x01;
            val != 0
        }
        #[doc = "Independent watchdog HW Control."]
        #[inline(always)]
        pub fn set_iwdg_hw(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
        }
        #[doc = "Reset on stop mode."]
        #[inline(always)]
        pub const fn nrst_stop(&self) -> bool {
            let val = (self.0 >> 6usize) & 0x01;
            val != 0
        }
        #[doc = "Reset on stop mode."]
        #[inline(always)]
        pub fn set_nrst_stop(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
        }
        #[doc = "Reset on standby mode."]
        #[inline(always)]
        pub const fn nrst_stby(&self) -> bool {
            let val = (self.0 >> 7usize) & 0x01;
            val != 0
        }
        #[doc = "Reset on standby mode."]
        #[inline(always)]
        pub fn set_nrst_stby(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
        }
        #[doc = "XSPIM_P1 High-Speed at Low-Voltage."]
        #[inline(always)]
        pub const fn octo1_hslv(&self) -> bool {
            let val = (self.0 >> 8usize) & 0x01;
            val != 0
        }
        #[doc = "XSPIM_P1 High-Speed at Low-Voltage."]
        #[inline(always)]
        pub fn set_octo1_hslv(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
        }
        #[doc = "XSPIM_P2 High-Speed at Low-Voltage."]
        #[inline(always)]
        pub const fn octo2_hslv(&self) -> bool {
            let val = (self.0 >> 9usize) & 0x01;
            val != 0
        }
        #[doc = "XSPIM_P2 High-Speed at Low-Voltage."]
        #[inline(always)]
        pub fn set_octo2_hslv(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
        }
        #[doc = "IWDG stop mode freeze When set the independent watchdog IWDG is frozen in system Stop mode."]
        #[inline(always)]
        pub const fn iwdg_fz_stop(&self) -> bool {
            let val = (self.0 >> 17usize) & 0x01;
            val != 0
        }
        #[doc = "IWDG stop mode freeze When set the independent watchdog IWDG is frozen in system Stop mode."]
        #[inline(always)]
        pub fn set_iwdg_fz_stop(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
        }
        #[doc = "IWDG standby mode freeze When set the independent watchdog IWDG is frozen in system Standby mode."]
        #[inline(always)]
        pub const fn iwdg_fz_sdby(&self) -> bool {
            let val = (self.0 >> 18usize) & 0x01;
            val != 0
        }
        #[doc = "IWDG standby mode freeze When set the independent watchdog IWDG is frozen in system Standby mode."]
        #[inline(always)]
        pub fn set_iwdg_fz_sdby(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
        }
        #[doc = "Personalization OK This bit is set on STMicroelectronics production line."]
        #[inline(always)]
        pub const fn perso_ok(&self) -> bool {
            let val = (self.0 >> 28usize) & 0x01;
            val != 0
        }
        #[doc = "Personalization OK This bit is set on STMicroelectronics production line."]
        #[inline(always)]
        pub fn set_perso_ok(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
        }
        #[doc = "I/O High-Speed at Low-Voltage This bit indicates that the product operates below 2.5 V."]
        #[inline(always)]
        pub const fn vddio_hslv(&self) -> bool {
            let val = (self.0 >> 29usize) & 0x01;
            val != 0
        }
        #[doc = "I/O High-Speed at Low-Voltage This bit indicates that the product operates below 2.5 V."]
        #[inline(always)]
        pub fn set_vddio_hslv(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
        }
    }
    impl Default for Obw1sr {
        #[inline(always)]
        fn default() -> Obw1sr {
            Obw1sr(0)
        }
    }
    impl core::fmt::Debug for Obw1sr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Obw1sr")
                .field("bor_lev", &self.bor_lev())
                .field("iwdg_hw", &self.iwdg_hw())
                .field("nrst_stop", &self.nrst_stop())
                .field("nrst_stby", &self.nrst_stby())
                .field("octo1_hslv", &self.octo1_hslv())
                .field("octo2_hslv", &self.octo2_hslv())
                .field("iwdg_fz_stop", &self.iwdg_fz_stop())
                .field("iwdg_fz_sdby", &self.iwdg_fz_sdby())
                .field("perso_ok", &self.perso_ok())
                .field("vddio_hslv", &self.vddio_hslv())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Obw1sr {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Obw1sr {{ bor_lev: {:?}, iwdg_hw: {=bool:?}, nrst_stop: {=bool:?}, nrst_stby: {=bool:?}, octo1_hslv: {=bool:?}, octo2_hslv: {=bool:?}, iwdg_fz_stop: {=bool:?}, iwdg_fz_sdby: {=bool:?}, perso_ok: {=bool:?}, vddio_hslv: {=bool:?} }}" , self . bor_lev () , self . iwdg_hw () , self . nrst_stop () , self . nrst_stby () , self . octo1_hslv () , self . octo2_hslv () , self . iwdg_fz_stop () , self . iwdg_fz_sdby () , self . perso_ok () , self . vddio_hslv ())
        }
    }
    #[doc = "FLASH option byte word 1 status register programming."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Obw1srp(pub u32);
    impl Obw1srp {
        #[doc = "Brownout level Write to change corresponding bits in FLASH_OBW1SR register."]
        #[inline(always)]
        pub const fn bor_lev(&self) -> u8 {
            let val = (self.0 >> 2usize) & 0x03;
            val as u8
        }
        #[doc = "Brownout level Write to change corresponding bits in FLASH_OBW1SR register."]
        #[inline(always)]
        pub fn set_bor_lev(&mut self, val: u8) {
            self.0 = (self.0 & !(0x03 << 2usize)) | (((val as u32) & 0x03) << 2usize);
        }
        #[doc = "Independent watchdog HW Control Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub const fn iwdg_hw(&self) -> bool {
            let val = (self.0 >> 4usize) & 0x01;
            val != 0
        }
        #[doc = "Independent watchdog HW Control Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub fn set_iwdg_hw(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
        }
        #[doc = "Reset on stop mode programming Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub const fn nrst_stop(&self) -> bool {
            let val = (self.0 >> 6usize) & 0x01;
            val != 0
        }
        #[doc = "Reset on stop mode programming Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub fn set_nrst_stop(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
        }
        #[doc = "Reset on standby mode programming Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub const fn nrst_stby(&self) -> bool {
            let val = (self.0 >> 7usize) & 0x01;
            val != 0
        }
        #[doc = "Reset on standby mode programming Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub fn set_nrst_stby(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
        }
        #[doc = "XSPIM_P1 High-Speed at Low-Voltage Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub const fn octo1_hslv(&self) -> bool {
            let val = (self.0 >> 8usize) & 0x01;
            val != 0
        }
        #[doc = "XSPIM_P1 High-Speed at Low-Voltage Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub fn set_octo1_hslv(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
        }
        #[doc = "XSPIM_P2 High-Speed at Low-Voltage programming Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub const fn octo2_hslv(&self) -> bool {
            let val = (self.0 >> 9usize) & 0x01;
            val != 0
        }
        #[doc = "XSPIM_P2 High-Speed at Low-Voltage programming Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub fn set_octo2_hslv(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
        }
        #[doc = "IWDG stop mode freeze Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub const fn iwdg_fz_stop(&self) -> bool {
            let val = (self.0 >> 17usize) & 0x01;
            val != 0
        }
        #[doc = "IWDG stop mode freeze Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub fn set_iwdg_fz_stop(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
        }
        #[doc = "IWDG standby mode freeze programming Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub const fn iwdg_fz_sdby(&self) -> bool {
            let val = (self.0 >> 18usize) & 0x01;
            val != 0
        }
        #[doc = "IWDG standby mode freeze programming Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub fn set_iwdg_fz_sdby(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
        }
        #[doc = "I/O High-Speed at Low-Voltage programming Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub const fn vddio_hslv(&self) -> bool {
            let val = (self.0 >> 29usize) & 0x01;
            val != 0
        }
        #[doc = "I/O High-Speed at Low-Voltage programming Write to change corresponding bit in FLASH_OBW1SR register."]
        #[inline(always)]
        pub fn set_vddio_hslv(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
        }
    }
    impl Default for Obw1srp {
        #[inline(always)]
        fn default() -> Obw1srp {
            Obw1srp(0)
        }
    }
    impl core::fmt::Debug for Obw1srp {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Obw1srp")
                .field("bor_lev", &self.bor_lev())
                .field("iwdg_hw", &self.iwdg_hw())
                .field("nrst_stop", &self.nrst_stop())
                .field("nrst_stby", &self.nrst_stby())
                .field("octo1_hslv", &self.octo1_hslv())
                .field("octo2_hslv", &self.octo2_hslv())
                .field("iwdg_fz_stop", &self.iwdg_fz_stop())
                .field("iwdg_fz_sdby", &self.iwdg_fz_sdby())
                .field("vddio_hslv", &self.vddio_hslv())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Obw1srp {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Obw1srp {{ bor_lev: {=u8:?}, iwdg_hw: {=bool:?}, nrst_stop: {=bool:?}, nrst_stby: {=bool:?}, octo1_hslv: {=bool:?}, octo2_hslv: {=bool:?}, iwdg_fz_stop: {=bool:?}, iwdg_fz_sdby: {=bool:?}, vddio_hslv: {=bool:?} }}" , self . bor_lev () , self . iwdg_hw () , self . nrst_stop () , self . nrst_stby () , self . octo1_hslv () , self . octo2_hslv () , self . iwdg_fz_stop () , self . iwdg_fz_sdby () , self . vddio_hslv ())
        }
    }
    #[doc = "FLASH option byte word 2 status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Obw2sr(pub u32);
    impl Obw2sr {
        #[doc = "ITCM SRAM configuration."]
        #[inline(always)]
        pub const fn itcm_axi_share(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0x07;
            val as u8
        }
        #[doc = "ITCM SRAM configuration."]
        #[inline(always)]
        pub fn set_itcm_axi_share(&mut self, val: u8) {
            self.0 = (self.0 & !(0x07 << 0usize)) | (((val as u32) & 0x07) << 0usize);
        }
        #[doc = "DTCM SRAM configuration."]
        #[inline(always)]
        pub const fn dtcm_axi_share(&self) -> u8 {
            let val = (self.0 >> 4usize) & 0x07;
            val as u8
        }
        #[doc = "DTCM SRAM configuration."]
        #[inline(always)]
        pub fn set_dtcm_axi_share(&mut self, val: u8) {
            self.0 = (self.0 & !(0x07 << 4usize)) | (((val as u32) & 0x07) << 4usize);
        }
        #[doc = "ECC on SRAM."]
        #[inline(always)]
        pub const fn ecc_on_sram(&self) -> bool {
            let val = (self.0 >> 8usize) & 0x01;
            val != 0
        }
        #[doc = "ECC on SRAM."]
        #[inline(always)]
        pub fn set_ecc_on_sram(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
        }
        #[doc = "I2C Not I3C."]
        #[inline(always)]
        pub const fn i2c_ni3c(&self) -> bool {
            let val = (self.0 >> 9usize) & 0x01;
            val != 0
        }
        #[doc = "I2C Not I3C."]
        #[inline(always)]
        pub fn set_i2c_ni3c(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
        }
    }
    impl Default for Obw2sr {
        #[inline(always)]
        fn default() -> Obw2sr {
            Obw2sr(0)
        }
    }
    impl core::fmt::Debug for Obw2sr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Obw2sr")
                .field("itcm_axi_share", &self.itcm_axi_share())
                .field("dtcm_axi_share", &self.dtcm_axi_share())
                .field("ecc_on_sram", &self.ecc_on_sram())
                .field("i2c_ni3c", &self.i2c_ni3c())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Obw2sr {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Obw2sr {{ itcm_axi_share: {=u8:?}, dtcm_axi_share: {=u8:?}, ecc_on_sram: {=bool:?}, i2c_ni3c: {=bool:?} }}" , self . itcm_axi_share () , self . dtcm_axi_share () , self . ecc_on_sram () , self . i2c_ni3c ())
        }
    }
    #[doc = "FLASH option byte word 2 status register programming."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Obw2srp(pub u32);
    impl Obw2srp {
        #[doc = "ITCM AXI share programming Write to change corresponding bits in FLASH_OBW2SR register. Bit 2 should be kept to 0: ITCM_AXI_SHARE: = 000 or 011: ITCM 64 Kbytes ITCM_AXI_SHARE = 001: ITCM 128 Kbytes ITCM_AXI_SHARE = 010: ITCM 192 Kbytes."]
        #[inline(always)]
        pub const fn itcm_axi_share(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0x07;
            val as u8
        }
        #[doc = "ITCM AXI share programming Write to change corresponding bits in FLASH_OBW2SR register. Bit 2 should be kept to 0: ITCM_AXI_SHARE: = 000 or 011: ITCM 64 Kbytes ITCM_AXI_SHARE = 001: ITCM 128 Kbytes ITCM_AXI_SHARE = 010: ITCM 192 Kbytes."]
        #[inline(always)]
        pub fn set_itcm_axi_share(&mut self, val: u8) {
            self.0 = (self.0 & !(0x07 << 0usize)) | (((val as u32) & 0x07) << 0usize);
        }
        #[doc = "DTCM AXI share programming Write to change corresponding bits in the FLASH_OBW2SR register. Bit 2 should be kept to 0: DTCM_AXI_SHARE = 000 or 011: DTCM 64 Kbytes DTCM_AXI_SHARE = 001: DTCM 128 Kbytes DTCM_AXI_SHARE = 010: DTCM 192 Kbytes."]
        #[inline(always)]
        pub const fn dtcm_axi_share(&self) -> u8 {
            let val = (self.0 >> 4usize) & 0x07;
            val as u8
        }
        #[doc = "DTCM AXI share programming Write to change corresponding bits in the FLASH_OBW2SR register. Bit 2 should be kept to 0: DTCM_AXI_SHARE = 000 or 011: DTCM 64 Kbytes DTCM_AXI_SHARE = 001: DTCM 128 Kbytes DTCM_AXI_SHARE = 010: DTCM 192 Kbytes."]
        #[inline(always)]
        pub fn set_dtcm_axi_share(&mut self, val: u8) {
            self.0 = (self.0 & !(0x07 << 4usize)) | (((val as u32) & 0x07) << 4usize);
        }
        #[doc = "ECC on SRAM programming Write to change corresponding bit in FLASH_OBW2SR register."]
        #[inline(always)]
        pub const fn ecc_on_sram(&self) -> bool {
            let val = (self.0 >> 8usize) & 0x01;
            val != 0
        }
        #[doc = "ECC on SRAM programming Write to change corresponding bit in FLASH_OBW2SR register."]
        #[inline(always)]
        pub fn set_ecc_on_sram(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
        }
        #[doc = "I2C Not I3C Write to change corresponding bit in FLASH_OBW2SR register."]
        #[inline(always)]
        pub const fn i2c_ni3c(&self) -> bool {
            let val = (self.0 >> 9usize) & 0x01;
            val != 0
        }
        #[doc = "I2C Not I3C Write to change corresponding bit in FLASH_OBW2SR register."]
        #[inline(always)]
        pub fn set_i2c_ni3c(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
        }
    }
    impl Default for Obw2srp {
        #[inline(always)]
        fn default() -> Obw2srp {
            Obw2srp(0)
        }
    }
    impl core::fmt::Debug for Obw2srp {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Obw2srp")
                .field("itcm_axi_share", &self.itcm_axi_share())
                .field("dtcm_axi_share", &self.dtcm_axi_share())
                .field("ecc_on_sram", &self.ecc_on_sram())
                .field("i2c_ni3c", &self.i2c_ni3c())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Obw2srp {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Obw2srp {{ itcm_axi_share: {=u8:?}, dtcm_axi_share: {=u8:?}, ecc_on_sram: {=bool:?}, i2c_ni3c: {=bool:?} }}" , self . itcm_axi_share () , self . dtcm_axi_share () , self . ecc_on_sram () , self . i2c_ni3c ())
        }
    }
    #[doc = "FLASH options control register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Optcr(pub u32);
    impl Optcr {
        #[doc = "Options lock When this bit is set write to all other bits in this register, and write to OTP words, option bytes and option bytes keys control registers, are ignored. Clearing this bit requires the correct write sequence to FLASH_OPTKEYR register (see this register for details). If a wrong sequence is executed, or the unlock sequence is performed twice, this bit remains locked until next system reset. During the write access to set LOCK bit from 0 to 1, it is possible to change the other bits of this register."]
        #[inline(always)]
        pub const fn optlock(&self) -> bool {
            let val = (self.0 >> 0usize) & 0x01;
            val != 0
        }
        #[doc = "Options lock When this bit is set write to all other bits in this register, and write to OTP words, option bytes and option bytes keys control registers, are ignored. Clearing this bit requires the correct write sequence to FLASH_OPTKEYR register (see this register for details). If a wrong sequence is executed, or the unlock sequence is performed twice, this bit remains locked until next system reset. During the write access to set LOCK bit from 0 to 1, it is possible to change the other bits of this register."]
        #[inline(always)]
        pub fn set_optlock(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
        }
        #[doc = "Program options."]
        #[inline(always)]
        pub const fn pg_opt(&self) -> bool {
            let val = (self.0 >> 1usize) & 0x01;
            val != 0
        }
        #[doc = "Program options."]
        #[inline(always)]
        pub fn set_pg_opt(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
        }
        #[doc = "Key valid error interrupt enable bit This bit controls if an interrupt has to be generated when KVEF is set in FLASH_OPTISR."]
        #[inline(always)]
        pub const fn kveie(&self) -> bool {
            let val = (self.0 >> 27usize) & 0x01;
            val != 0
        }
        #[doc = "Key valid error interrupt enable bit This bit controls if an interrupt has to be generated when KVEF is set in FLASH_OPTISR."]
        #[inline(always)]
        pub fn set_kveie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
        }
        #[doc = "Key transfer error interrupt enable bit This bit controls if an interrupt has to be generated when KTEF is set in FLASH_OPTISR."]
        #[inline(always)]
        pub const fn kteie(&self) -> bool {
            let val = (self.0 >> 28usize) & 0x01;
            val != 0
        }
        #[doc = "Key transfer error interrupt enable bit This bit controls if an interrupt has to be generated when KTEF is set in FLASH_OPTISR."]
        #[inline(always)]
        pub fn set_kteie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
        }
        #[doc = "Option byte change error interrupt enable bit This bit controls if an interrupt has to be generated when an error occurs during an option byte change."]
        #[inline(always)]
        pub const fn opterrie(&self) -> bool {
            let val = (self.0 >> 30usize) & 0x01;
            val != 0
        }
        #[doc = "Option byte change error interrupt enable bit This bit controls if an interrupt has to be generated when an error occurs during an option byte change."]
        #[inline(always)]
        pub fn set_opterrie(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
        }
    }
    impl Default for Optcr {
        #[inline(always)]
        fn default() -> Optcr {
            Optcr(0)
        }
    }
    impl core::fmt::Debug for Optcr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Optcr")
                .field("optlock", &self.optlock())
                .field("pg_opt", &self.pg_opt())
                .field("kveie", &self.kveie())
                .field("kteie", &self.kteie())
                .field("opterrie", &self.opterrie())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Optcr {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Optcr {{ optlock: {=bool:?}, pg_opt: {=bool:?}, kveie: {=bool:?}, kteie: {=bool:?}, opterrie: {=bool:?} }}" , self . optlock () , self . pg_opt () , self . kveie () , self . kteie () , self . opterrie ())
        }
    }
    #[doc = "FLASH options interrupt clear register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Opticr(pub u32);
    impl Opticr {
        #[doc = "key valid error flag Set this bit to clear KVEF flag in FLASH_OPTISR register."]
        #[inline(always)]
        pub const fn kvef(&self) -> bool {
            let val = (self.0 >> 27usize) & 0x01;
            val != 0
        }
        #[doc = "key valid error flag Set this bit to clear KVEF flag in FLASH_OPTISR register."]
        #[inline(always)]
        pub fn set_kvef(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
        }
        #[doc = "key transfer error flag Set this bit to clear KTEF flag in FLASH_OPTISR register."]
        #[inline(always)]
        pub const fn ktef(&self) -> bool {
            let val = (self.0 >> 28usize) & 0x01;
            val != 0
        }
        #[doc = "key transfer error flag Set this bit to clear KTEF flag in FLASH_OPTISR register."]
        #[inline(always)]
        pub fn set_ktef(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
        }
        #[doc = "Option byte change error flag Set this bit to clear OPTERRF flag in FLASH_OPTISR register."]
        #[inline(always)]
        pub const fn opterrf(&self) -> bool {
            let val = (self.0 >> 30usize) & 0x01;
            val != 0
        }
        #[doc = "Option byte change error flag Set this bit to clear OPTERRF flag in FLASH_OPTISR register."]
        #[inline(always)]
        pub fn set_opterrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
        }
    }
    impl Default for Opticr {
        #[inline(always)]
        fn default() -> Opticr {
            Opticr(0)
        }
    }
    impl core::fmt::Debug for Opticr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Opticr")
                .field("kvef", &self.kvef())
                .field("ktef", &self.ktef())
                .field("opterrf", &self.opterrf())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Opticr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "Opticr {{ kvef: {=bool:?}, ktef: {=bool:?}, opterrf: {=bool:?} }}",
                self.kvef(),
                self.ktef(),
                self.opterrf()
            )
        }
    }
    #[doc = "FLASH options interrupt status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Optisr(pub u32);
    impl Optisr {
        #[doc = "Key valid error flag This bit is set when loading an unknown or corrupted option byte key. More specifically: Embedded Flash did not find an option byte key that corresponds to the given OBKINDEX\\[4:0\\]
and the requested HDPL (optionally modified by NEXTKL\\[1:0\\]). It can happen for example when requested key has not being provisioned. A double error detection was found when loading the requested option byte key. In this case, if this key is provisioned again the error should disappear. When KVEF is set write to START bit in FLASH_OBKCR is ignored. An interrupt is generated when this flag is raised if the KVEIE bit of FLASH_OPTCR register is set. Setting KVEF bit of register FLASH_OPTICR clears this bit."]
        #[inline(always)]
        pub const fn kvef(&self) -> bool {
            let val = (self.0 >> 27usize) & 0x01;
            val != 0
        }
        #[doc = "Key valid error flag This bit is set when loading an unknown or corrupted option byte key. More specifically: Embedded Flash did not find an option byte key that corresponds to the given OBKINDEX\\[4:0\\]
and the requested HDPL (optionally modified by NEXTKL\\[1:0\\]). It can happen for example when requested key has not being provisioned. A double error detection was found when loading the requested option byte key. In this case, if this key is provisioned again the error should disappear. When KVEF is set write to START bit in FLASH_OBKCR is ignored. An interrupt is generated when this flag is raised if the KVEIE bit of FLASH_OPTCR register is set. Setting KVEF bit of register FLASH_OPTICR clears this bit."]
        #[inline(always)]
        pub fn set_kvef(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
        }
        #[doc = "Key transfer error flag This bit is set when embedded Flash signals an error to the SAES peripheral. It happens when the key size (128-bit or 256-bit) is not matching between embedded Flash OBKSIZE\\[1:0\\]
and KEYSIZE bit in SAES_CR register. It also happen when an ECC dual error detection occurred while embedded Flash loaded an option byte key for the SAES peripheral. When KTEF is set write to START bit in FLASH_OBKCR is ignored. An interrupt is generated when this flag is raised if the KTEIE bit of FLASH_OPTCR register is set. Setting KTEF bit of register FLASH_OPTICR clears this bit."]
        #[inline(always)]
        pub const fn ktef(&self) -> bool {
            let val = (self.0 >> 28usize) & 0x01;
            val != 0
        }
        #[doc = "Key transfer error flag This bit is set when embedded Flash signals an error to the SAES peripheral. It happens when the key size (128-bit or 256-bit) is not matching between embedded Flash OBKSIZE\\[1:0\\]
and KEYSIZE bit in SAES_CR register. It also happen when an ECC dual error detection occurred while embedded Flash loaded an option byte key for the SAES peripheral. When KTEF is set write to START bit in FLASH_OBKCR is ignored. An interrupt is generated when this flag is raised if the KTEIE bit of FLASH_OPTCR register is set. Setting KTEF bit of register FLASH_OPTICR clears this bit."]
        #[inline(always)]
        pub fn set_ktef(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
        }
        #[doc = "Option byte change error flag When OPTERRF is set, the option byte change operation did not successfully complete. An interrupt is generated when this flag is raised if the OPTERRIE bit of FLASH_OPTCR register is set. Setting OPTERRF of register FLASH_OPTICR clears this bit."]
        #[inline(always)]
        pub const fn opterrf(&self) -> bool {
            let val = (self.0 >> 30usize) & 0x01;
            val != 0
        }
        #[doc = "Option byte change error flag When OPTERRF is set, the option byte change operation did not successfully complete. An interrupt is generated when this flag is raised if the OPTERRIE bit of FLASH_OPTCR register is set. Setting OPTERRF of register FLASH_OPTICR clears this bit."]
        #[inline(always)]
        pub fn set_opterrf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
        }
    }
    impl Default for Optisr {
        #[inline(always)]
        fn default() -> Optisr {
            Optisr(0)
        }
    }
    impl core::fmt::Debug for Optisr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Optisr")
                .field("kvef", &self.kvef())
                .field("ktef", &self.ktef())
                .field("opterrf", &self.opterrf())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Optisr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "Optisr {{ kvef: {=bool:?}, ktef: {=bool:?}, opterrf: {=bool:?} }}",
                self.kvef(),
                self.ktef(),
                self.opterrf()
            )
        }
    }
    #[doc = "FLASH options key register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Optkeyr(pub u32);
    impl Optkeyr {
        #[doc = "Options configuration unlock key Following values must be written to FLASH_OPTKEYR consecutively to unlock FLASH_OPTCR register: 1st key = 0x0819 2A3B 2nd key = 0x4C5D 6E7F Reads to this register returns zero. If above sequence is performed twice locks up the corresponding register/bit until the next system reset, and generates a bus error."]
        #[inline(always)]
        pub const fn ocukey(&self) -> u32 {
            let val = (self.0 >> 0usize) & 0xffff_ffff;
            val as u32
        }
        #[doc = "Options configuration unlock key Following values must be written to FLASH_OPTKEYR consecutively to unlock FLASH_OPTCR register: 1st key = 0x0819 2A3B 2nd key = 0x4C5D 6E7F Reads to this register returns zero. If above sequence is performed twice locks up the corresponding register/bit until the next system reset, and generates a bus error."]
        #[inline(always)]
        pub fn set_ocukey(&mut self, val: u32) {
            self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
        }
    }
    impl Default for Optkeyr {
        #[inline(always)]
        fn default() -> Optkeyr {
            Optkeyr(0)
        }
    }
    impl core::fmt::Debug for Optkeyr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Optkeyr").field("ocukey", &self.ocukey()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Optkeyr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Optkeyr {{ ocukey: {=u32:?} }}", self.ocukey())
        }
    }
    #[doc = "FLASH OTP lock status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Otplsr(pub u32);
    impl Otplsr {
        #[doc = "OTP lock n Block n corresponds to OTP 16-bit word 32 x n to 32 x n + 31. OTPL\\[n\\]
= 1 indicates that all OTP 16-bit words in OTP Block n are locked and can no longer be programmed. OTPL\\[n\\]
= 0 indicates that all OTP 16-bit words in OTP Block n are not locked and can still be modified."]
        #[inline(always)]
        pub const fn otpl(&self) -> u16 {
            let val = (self.0 >> 0usize) & 0xffff;
            val as u16
        }
        #[doc = "OTP lock n Block n corresponds to OTP 16-bit word 32 x n to 32 x n + 31. OTPL\\[n\\]
= 1 indicates that all OTP 16-bit words in OTP Block n are locked and can no longer be programmed. OTPL\\[n\\]
= 0 indicates that all OTP 16-bit words in OTP Block n are not locked and can still be modified."]
        #[inline(always)]
        pub fn set_otpl(&mut self, val: u16) {
            self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
        }
    }
    impl Default for Otplsr {
        #[inline(always)]
        fn default() -> Otplsr {
            Otplsr(0)
        }
    }
    impl core::fmt::Debug for Otplsr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Otplsr").field("otpl", &self.otpl()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Otplsr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Otplsr {{ otpl: {=u16:?} }}", self.otpl())
        }
    }
    #[doc = "FLASH OTP lock status register programming."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Otplsrp(pub u32);
    impl Otplsrp {
        #[doc = "OTP lock n programming Write to change corresponding option byte bit in FLASH_OTPLSR. OTPL bits can be only be set, not cleared."]
        #[inline(always)]
        pub const fn otpl(&self) -> u16 {
            let val = (self.0 >> 0usize) & 0xffff;
            val as u16
        }
        #[doc = "OTP lock n programming Write to change corresponding option byte bit in FLASH_OTPLSR. OTPL bits can be only be set, not cleared."]
        #[inline(always)]
        pub fn set_otpl(&mut self, val: u16) {
            self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
        }
    }
    impl Default for Otplsrp {
        #[inline(always)]
        fn default() -> Otplsrp {
            Otplsrp(0)
        }
    }
    impl core::fmt::Debug for Otplsrp {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Otplsrp").field("otpl", &self.otpl()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Otplsrp {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Otplsrp {{ otpl: {=u16:?} }}", self.otpl())
        }
    }
    #[doc = "FLASH RoT status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Rotsr(pub u32);
    impl Rotsr {
        #[doc = "OEM provisioned device Any other value: device is not provisioned by the OEM."]
        #[inline(always)]
        pub const fn oem_provd(&self) -> super::vals::OemProvd {
            let val = (self.0 >> 0usize) & 0xff;
            super::vals::OemProvd::from_bits(val as u8)
        }
        #[doc = "OEM provisioned device Any other value: device is not provisioned by the OEM."]
        #[inline(always)]
        pub fn set_oem_provd(&mut self, val: super::vals::OemProvd) {
            self.0 = (self.0 & !(0xff << 0usize)) | (((val.to_bits() as u32) & 0xff) << 0usize);
        }
        #[doc = "Debug authentication method Any other value: no authentication method selected (NotSet)."]
        #[inline(always)]
        pub const fn dbg_auth(&self) -> super::vals::DbgAuth {
            let val = (self.0 >> 8usize) & 0xff;
            super::vals::DbgAuth::from_bits(val as u8)
        }
        #[doc = "Debug authentication method Any other value: no authentication method selected (NotSet)."]
        #[inline(always)]
        pub fn set_dbg_auth(&mut self, val: super::vals::DbgAuth) {
            self.0 = (self.0 & !(0xff << 8usize)) | (((val.to_bits() as u32) & 0xff) << 8usize);
        }
        #[doc = "iRoT selection This option is ignored for STM32H7R devices (OEM iRoT is always selected). Any other value: OEM iRoT is selected at boot."]
        #[inline(always)]
        pub const fn irot_select(&self) -> super::vals::IrotSelect {
            let val = (self.0 >> 24usize) & 0xff;
            super::vals::IrotSelect::from_bits(val as u8)
        }
        #[doc = "iRoT selection This option is ignored for STM32H7R devices (OEM iRoT is always selected). Any other value: OEM iRoT is selected at boot."]
        #[inline(always)]
        pub fn set_irot_select(&mut self, val: super::vals::IrotSelect) {
            self.0 = (self.0 & !(0xff << 24usize)) | (((val.to_bits() as u32) & 0xff) << 24usize);
        }
    }
    impl Default for Rotsr {
        #[inline(always)]
        fn default() -> Rotsr {
            Rotsr(0)
        }
    }
    impl core::fmt::Debug for Rotsr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Rotsr")
                .field("oem_provd", &self.oem_provd())
                .field("dbg_auth", &self.dbg_auth())
                .field("irot_select", &self.irot_select())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Rotsr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "Rotsr {{ oem_provd: {:?}, dbg_auth: {:?}, irot_select: {:?} }}",
                self.oem_provd(),
                self.dbg_auth(),
                self.irot_select()
            )
        }
    }
    #[doc = "FLASH RoT status register programming."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Rotsrp(pub u32);
    impl Rotsrp {
        #[doc = "OEM provisioned device Write to change corresponding bits in FLASH_ROTSR register. Write are ignored if HDPL is greater than 1."]
        #[inline(always)]
        pub const fn oem_provd(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0xff;
            val as u8
        }
        #[doc = "OEM provisioned device Write to change corresponding bits in FLASH_ROTSR register. Write are ignored if HDPL is greater than 1."]
        #[inline(always)]
        pub fn set_oem_provd(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
        }
        #[doc = "Debug authentication method programming Write to change corresponding bits in FLASH_ROTSR register. Write are ignored if HDPL is greater than 0."]
        #[inline(always)]
        pub const fn dbg_auth(&self) -> u8 {
            let val = (self.0 >> 8usize) & 0xff;
            val as u8
        }
        #[doc = "Debug authentication method programming Write to change corresponding bits in FLASH_ROTSR register. Write are ignored if HDPL is greater than 0."]
        #[inline(always)]
        pub fn set_dbg_auth(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
        }
        #[doc = "iRoT selection This option is ignored for STM32H7R devices. Write to change corresponding bits in FLASH_ROTSR register. Write are ignored if HDPL is greater than 1 and if NVSTATE is not 0xB4 (OPEN)."]
        #[inline(always)]
        pub const fn irot_select(&self) -> u8 {
            let val = (self.0 >> 24usize) & 0xff;
            val as u8
        }
        #[doc = "iRoT selection This option is ignored for STM32H7R devices. Write to change corresponding bits in FLASH_ROTSR register. Write are ignored if HDPL is greater than 1 and if NVSTATE is not 0xB4 (OPEN)."]
        #[inline(always)]
        pub fn set_irot_select(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize);
        }
    }
    impl Default for Rotsrp {
        #[inline(always)]
        fn default() -> Rotsrp {
            Rotsrp(0)
        }
    }
    impl core::fmt::Debug for Rotsrp {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Rotsrp")
                .field("oem_provd", &self.oem_provd())
                .field("dbg_auth", &self.dbg_auth())
                .field("irot_select", &self.irot_select())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Rotsrp {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "Rotsrp {{ oem_provd: {=u8:?}, dbg_auth: {=u8:?}, irot_select: {=u8:?} }}",
                self.oem_provd(),
                self.dbg_auth(),
                self.irot_select()
            )
        }
    }
    #[doc = "FLASH status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Sr(pub u32);
    impl Sr {
        #[doc = "Busy flag This bit is set when an effective write, erase or option byte change operation is ongoing. It is possible to know what type of operation is being executed reading the flags IS_PROGRAM, IS_ERASE and IS_OPTCHANGE. BUSY cannot be cleared by application. It is automatically reset by hardware every time a step in a write, erase or option byte change operation completes. It is not recommended to do software polling on BUSY to know when one operation completed because, depending of operation, more pulses are possible for one only operation. For software polling it is therefore better to use QW flag or to check the EOPF flag."]
        #[inline(always)]
        pub const fn busy(&self) -> bool {
            let val = (self.0 >> 0usize) & 0x01;
            val != 0
        }
        #[doc = "Busy flag This bit is set when an effective write, erase or option byte change operation is ongoing. It is possible to know what type of operation is being executed reading the flags IS_PROGRAM, IS_ERASE and IS_OPTCHANGE. BUSY cannot be cleared by application. It is automatically reset by hardware every time a step in a write, erase or option byte change operation completes. It is not recommended to do software polling on BUSY to know when one operation completed because, depending of operation, more pulses are possible for one only operation. For software polling it is therefore better to use QW flag or to check the EOPF flag."]
        #[inline(always)]
        pub fn set_busy(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
        }
        #[doc = "Write buffer not empty flag This bit is set when the embedded Flash memory is waiting for new data to complete the write buffer. In this state, the write buffer is not empty. WBNE is reset by hardware each time the write buffer is complete or the write buffer is emptied following one of the event below: the application software forces the write operation using FW bit in FLASH_CR the embedded Flash memory detects an error that involves data loss the application software has disabled write operations This bit cannot be forced to 0. To reset it, clear the write buffer by performing any of the above listed actions, or send the missing data."]
        #[inline(always)]
        pub const fn wbne(&self) -> bool {
            let val = (self.0 >> 1usize) & 0x01;
            val != 0
        }
        #[doc = "Write buffer not empty flag This bit is set when the embedded Flash memory is waiting for new data to complete the write buffer. In this state, the write buffer is not empty. WBNE is reset by hardware each time the write buffer is complete or the write buffer is emptied following one of the event below: the application software forces the write operation using FW bit in FLASH_CR the embedded Flash memory detects an error that involves data loss the application software has disabled write operations This bit cannot be forced to 0. To reset it, clear the write buffer by performing any of the above listed actions, or send the missing data."]
        #[inline(always)]
        pub fn set_wbne(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
        }
        #[doc = "Wait queue flag This bit is set when a write, erase or option byte change operation is pending in the command queue buffer. It is not possible to know what type of programming operation is present in the queue. This flag is reset by hardware when all write, erase or option byte change operations have been executed and thus removed from the waiting queue(s). This bit cannot be forced to 0. It is reset after a deterministic time if no other operations are requested."]
        #[inline(always)]
        pub const fn qw(&self) -> bool {
            let val = (self.0 >> 2usize) & 0x01;
            val != 0
        }
        #[doc = "Wait queue flag This bit is set when a write, erase or option byte change operation is pending in the command queue buffer. It is not possible to know what type of programming operation is present in the queue. This flag is reset by hardware when all write, erase or option byte change operations have been executed and thus removed from the waiting queue(s). This bit cannot be forced to 0. It is reset after a deterministic time if no other operations are requested."]
        #[inline(always)]
        pub fn set_qw(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
        }
        #[doc = "CRC busy flag This bit is set when a CRC calculation is ongoing. This bit cannot be forced to 0. The user must wait until the CRC calculation has completed or disable CRC computation using CRC_EN bit in FLASH_CR register."]
        #[inline(always)]
        pub const fn crc_busy(&self) -> bool {
            let val = (self.0 >> 3usize) & 0x01;
            val != 0
        }
        #[doc = "CRC busy flag This bit is set when a CRC calculation is ongoing. This bit cannot be forced to 0. The user must wait until the CRC calculation has completed or disable CRC computation using CRC_EN bit in FLASH_CR register."]
        #[inline(always)]
        pub fn set_crc_busy(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
        }
        #[doc = "Is a program This bit is set together with BUSY when a program operation is ongoing. It is cleared when BUSY is cleared. This flag can also raise with IS_OPTCHANGE, because an program operation can happen during an option change."]
        #[inline(always)]
        pub const fn is_program(&self) -> bool {
            let val = (self.0 >> 4usize) & 0x01;
            val != 0
        }
        #[doc = "Is a program This bit is set together with BUSY when a program operation is ongoing. It is cleared when BUSY is cleared. This flag can also raise with IS_OPTCHANGE, because an program operation can happen during an option change."]
        #[inline(always)]
        pub fn set_is_program(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
        }
        #[doc = "Is an erase This bit is set together with BUSY when an erase operation is ongoing. It is cleared when BUSY is cleared. This flag can also raise with IS_OPTCHANGE, because an erase operation can happen during an option change."]
        #[inline(always)]
        pub const fn is_erase(&self) -> bool {
            let val = (self.0 >> 5usize) & 0x01;
            val != 0
        }
        #[doc = "Is an erase This bit is set together with BUSY when an erase operation is ongoing. It is cleared when BUSY is cleared. This flag can also raise with IS_OPTCHANGE, because an erase operation can happen during an option change."]
        #[inline(always)]
        pub fn set_is_erase(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
        }
        #[doc = "Is an option change This bit is set together with BUSY when an option change operation is ongoing. It is cleared when BUSY is cleared. This flag can also raise with IS_PROGRAM or IS_ERASE, because a program or erase step is ongoing during option change."]
        #[inline(always)]
        pub const fn is_optchange(&self) -> bool {
            let val = (self.0 >> 6usize) & 0x01;
            val != 0
        }
        #[doc = "Is an option change This bit is set together with BUSY when an option change operation is ongoing. It is cleared when BUSY is cleared. This flag can also raise with IS_PROGRAM or IS_ERASE, because a program or erase step is ongoing during option change."]
        #[inline(always)]
        pub fn set_is_optchange(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
        }
        #[doc = "Root code check flag This bit returns the status of the root code check performed following the first access to the Flash. This bit is cleared with RCHECKF bit in FLASH_FCR (optional)."]
        #[inline(always)]
        pub const fn rcheckf(&self) -> bool {
            let val = (self.0 >> 25usize) & 0x01;
            val != 0
        }
        #[doc = "Root code check flag This bit returns the status of the root code check performed following the first access to the Flash. This bit is cleared with RCHECKF bit in FLASH_FCR (optional)."]
        #[inline(always)]
        pub fn set_rcheckf(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
        }
    }
    impl Default for Sr {
        #[inline(always)]
        fn default() -> Sr {
            Sr(0)
        }
    }
    impl core::fmt::Debug for Sr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Sr")
                .field("busy", &self.busy())
                .field("wbne", &self.wbne())
                .field("qw", &self.qw())
                .field("crc_busy", &self.crc_busy())
                .field("is_program", &self.is_program())
                .field("is_erase", &self.is_erase())
                .field("is_optchange", &self.is_optchange())
                .field("rcheckf", &self.rcheckf())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Sr {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Sr {{ busy: {=bool:?}, wbne: {=bool:?}, qw: {=bool:?}, crc_busy: {=bool:?}, is_program: {=bool:?}, is_erase: {=bool:?}, is_optchange: {=bool:?}, rcheckf: {=bool:?} }}" , self . busy () , self . wbne () , self . qw () , self . crc_busy () , self . is_program () , self . is_erase () , self . is_optchange () , self . rcheckf ())
        }
    }
    #[doc = "FLASH write protection status register."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Wrpsr(pub u32);
    impl Wrpsr {
        #[doc = "Write protection for sector n This bit reflects the write protection status of user Flash sector n."]
        #[inline(always)]
        pub const fn wrps(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0xff;
            val as u8
        }
        #[doc = "Write protection for sector n This bit reflects the write protection status of user Flash sector n."]
        #[inline(always)]
        pub fn set_wrps(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
        }
    }
    impl Default for Wrpsr {
        #[inline(always)]
        fn default() -> Wrpsr {
            Wrpsr(0)
        }
    }
    impl core::fmt::Debug for Wrpsr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Wrpsr").field("wrps", &self.wrps()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Wrpsr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Wrpsr {{ wrps: {=u8:?} }}", self.wrps())
        }
    }
    #[doc = "FLASH write protection status register programming."]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Wrpsrp(pub u32);
    impl Wrpsrp {
        #[doc = "Write protection for sector n programming Write to change corresponding bit in FLASH_WRPSR."]
        #[inline(always)]
        pub const fn wrps(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0xff;
            val as u8
        }
        #[doc = "Write protection for sector n programming Write to change corresponding bit in FLASH_WRPSR."]
        #[inline(always)]
        pub fn set_wrps(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
        }
    }
    impl Default for Wrpsrp {
        #[inline(always)]
        fn default() -> Wrpsrp {
            Wrpsrp(0)
        }
    }
    impl core::fmt::Debug for Wrpsrp {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Wrpsrp").field("wrps", &self.wrps()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Wrpsrp {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Wrpsrp {{ wrps: {=u8:?} }}", self.wrps())
        }
    }
}
pub mod vals {
    #[repr(u8)]
    #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
    #[cfg_attr(feature = "defmt", derive(defmt::Format))]
    pub enum BorLev {
        #[doc = "BOR OFF, POR/PDR reset threshold level is applied."]
        DISABLED = 0x0,
        #[doc = "BOR Level 1, the threshold level is low (around 2.1 V)."]
        LEVEL1 = 0x01,
        #[doc = "BOR Level 2, the threshold level is medium (around 2.4 V)."]
        LEVEL2 = 0x02,
        #[doc = "BOR Level 3, the threshold level is high (around 2.7 V)."]
        LEVEL3 = 0x03,
    }
    impl BorLev {
        #[inline(always)]
        pub const fn from_bits(val: u8) -> BorLev {
            unsafe { core::mem::transmute(val & 0x03) }
        }
        #[inline(always)]
        pub const fn to_bits(self) -> u8 {
            unsafe { core::mem::transmute(self) }
        }
    }
    impl From<u8> for BorLev {
        #[inline(always)]
        fn from(val: u8) -> BorLev {
            BorLev::from_bits(val)
        }
    }
    impl From<BorLev> for u8 {
        #[inline(always)]
        fn from(val: BorLev) -> u8 {
            BorLev::to_bits(val)
        }
    }
    #[repr(u8)]
    #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
    #[cfg_attr(feature = "defmt", derive(defmt::Format))]
    pub enum CrcBurst {
        #[doc = "every burst has a size of 4 Flash words (64 Bytes)."]
        WORD4 = 0x0,
        #[doc = "every burst has a size of 16 Flash words (256 Bytes)."]
        WORD16 = 0x01,
        #[doc = "every burst has a size of 64 Flash words (1 Kbytes)."]
        WORD64 = 0x02,
        #[doc = "every burst has a size of 256 Flash words (4 Kbytes)."]
        WORD256 = 0x03,
    }
    impl CrcBurst {
        #[inline(always)]
        pub const fn from_bits(val: u8) -> CrcBurst {
            unsafe { core::mem::transmute(val & 0x03) }
        }
        #[inline(always)]
        pub const fn to_bits(self) -> u8 {
            unsafe { core::mem::transmute(self) }
        }
    }
    impl From<u8> for CrcBurst {
        #[inline(always)]
        fn from(val: u8) -> CrcBurst {
            CrcBurst::from_bits(val)
        }
    }
    impl From<CrcBurst> for u8 {
        #[inline(always)]
        fn from(val: CrcBurst) -> u8 {
            CrcBurst::to_bits(val)
        }
    }
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
    pub struct DbgAuth(u8);
    impl DbgAuth {
        #[doc = "Authentication method using ECDSA signature (NIST P256)."]
        pub const ECDSA: Self = Self(0x51);
        #[doc = "Delegated debug (to OEM iRoT code in user Flash)."]
        pub const DELEGATED: Self = Self(0x6f);
        #[doc = "Authentication method using password."]
        pub const PASSWORD: Self = Self(0x8a);
        #[doc = "Locked device (no debug allowed)."]
        pub const LOCKED: Self = Self(0xb4);
    }
    impl DbgAuth {
        pub const fn from_bits(val: u8) -> DbgAuth {
            Self(val & 0xff)
        }
        pub const fn to_bits(self) -> u8 {
            self.0
        }
    }
    impl core::fmt::Debug for DbgAuth {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            match self.0 {
                0x51 => f.write_str("ECDSA"),
                0x6f => f.write_str("DELEGATED"),
                0x8a => f.write_str("PASSWORD"),
                0xb4 => f.write_str("LOCKED"),
                other => core::write!(f, "0x{:02X}", other),
            }
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for DbgAuth {
        fn format(&self, f: defmt::Formatter) {
            match self.0 {
                0x51 => defmt::write!(f, "ECDSA"),
                0x6f => defmt::write!(f, "DELEGATED"),
                0x8a => defmt::write!(f, "PASSWORD"),
                0xb4 => defmt::write!(f, "LOCKED"),
                other => defmt::write!(f, "0x{:02X}", other),
            }
        }
    }
    impl From<u8> for DbgAuth {
        #[inline(always)]
        fn from(val: u8) -> DbgAuth {
            DbgAuth::from_bits(val)
        }
    }
    impl From<DbgAuth> for u8 {
        #[inline(always)]
        fn from(val: DbgAuth) -> u8 {
            DbgAuth::to_bits(val)
        }
    }
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
    pub struct IrotSelect(u8);
    impl IrotSelect {
        #[doc = "ST iRoT is selected at boot."]
        pub const SELECTED: Self = Self(0xb4);
    }
    impl IrotSelect {
        pub const fn from_bits(val: u8) -> IrotSelect {
            Self(val & 0xff)
        }
        pub const fn to_bits(self) -> u8 {
            self.0
        }
    }
    impl core::fmt::Debug for IrotSelect {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            match self.0 {
                0xb4 => f.write_str("SELECTED"),
                other => core::write!(f, "0x{:02X}", other),
            }
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for IrotSelect {
        fn format(&self, f: defmt::Formatter) {
            match self.0 {
                0xb4 => defmt::write!(f, "SELECTED"),
                other => defmt::write!(f, "0x{:02X}", other),
            }
        }
    }
    impl From<u8> for IrotSelect {
        #[inline(always)]
        fn from(val: u8) -> IrotSelect {
            IrotSelect::from_bits(val)
        }
    }
    impl From<IrotSelect> for u8 {
        #[inline(always)]
        fn from(val: IrotSelect) -> u8 {
            IrotSelect::to_bits(val)
        }
    }
    #[repr(u8)]
    #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
    #[cfg_attr(feature = "defmt", derive(defmt::Format))]
    pub enum Nextkl {
        #[doc = "OBKINDEX represents the index of the option byte key stored for the hide protection level indicated in SBS_HDPLSR."]
        PLUS0 = 0x0,
        #[doc = "OBKINDEX represents the index of the option byte key stored for the hide protection level indicated in SBS_HDPLSR plus one (e.g. if HDPL=1 in SBS_HDPLR the key of level 2 is selected)."]
        PLUS1 = 0x01,
        _RESERVED_2 = 0x02,
        _RESERVED_3 = 0x03,
    }
    impl Nextkl {
        #[inline(always)]
        pub const fn from_bits(val: u8) -> Nextkl {
            unsafe { core::mem::transmute(val & 0x03) }
        }
        #[inline(always)]
        pub const fn to_bits(self) -> u8 {
            unsafe { core::mem::transmute(self) }
        }
    }
    impl From<u8> for Nextkl {
        #[inline(always)]
        fn from(val: u8) -> Nextkl {
            Nextkl::from_bits(val)
        }
    }
    impl From<Nextkl> for u8 {
        #[inline(always)]
        fn from(val: Nextkl) -> u8 {
            Nextkl::to_bits(val)
        }
    }
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
    pub struct NvsrNvstate(u8);
    impl NvsrNvstate {
        #[doc = "CLOSED device."]
        pub const CLOSED: Self = Self(0x51);
        #[doc = "OPEN device."]
        pub const OPEN: Self = Self(0xb4);
    }
    impl NvsrNvstate {
        pub const fn from_bits(val: u8) -> NvsrNvstate {
            Self(val & 0xff)
        }
        pub const fn to_bits(self) -> u8 {
            self.0
        }
    }
    impl core::fmt::Debug for NvsrNvstate {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            match self.0 {
                0x51 => f.write_str("CLOSED"),
                0xb4 => f.write_str("OPEN"),
                other => core::write!(f, "0x{:02X}", other),
            }
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for NvsrNvstate {
        fn format(&self, f: defmt::Formatter) {
            match self.0 {
                0x51 => defmt::write!(f, "CLOSED"),
                0xb4 => defmt::write!(f, "OPEN"),
                other => defmt::write!(f, "0x{:02X}", other),
            }
        }
    }
    impl From<u8> for NvsrNvstate {
        #[inline(always)]
        fn from(val: u8) -> NvsrNvstate {
            NvsrNvstate::from_bits(val)
        }
    }
    impl From<NvsrNvstate> for u8 {
        #[inline(always)]
        fn from(val: NvsrNvstate) -> u8 {
            NvsrNvstate::to_bits(val)
        }
    }
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
    pub struct NvsrpNvstate(u8);
    impl NvsrpNvstate {
        #[doc = "CLOSE."]
        pub const CLOSE: Self = Self(0x51);
        #[doc = "OPEN."]
        pub const OPEN: Self = Self(0xb4);
    }
    impl NvsrpNvstate {
        pub const fn from_bits(val: u8) -> NvsrpNvstate {
            Self(val & 0xff)
        }
        pub const fn to_bits(self) -> u8 {
            self.0
        }
    }
    impl core::fmt::Debug for NvsrpNvstate {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            match self.0 {
                0x51 => f.write_str("CLOSE"),
                0xb4 => f.write_str("OPEN"),
                other => core::write!(f, "0x{:02X}", other),
            }
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for NvsrpNvstate {
        fn format(&self, f: defmt::Formatter) {
            match self.0 {
                0x51 => defmt::write!(f, "CLOSE"),
                0xb4 => defmt::write!(f, "OPEN"),
                other => defmt::write!(f, "0x{:02X}", other),
            }
        }
    }
    impl From<u8> for NvsrpNvstate {
        #[inline(always)]
        fn from(val: u8) -> NvsrpNvstate {
            NvsrpNvstate::from_bits(val)
        }
    }
    impl From<NvsrpNvstate> for u8 {
        #[inline(always)]
        fn from(val: NvsrpNvstate) -> u8 {
            NvsrpNvstate::to_bits(val)
        }
    }
    #[repr(u8)]
    #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
    #[cfg_attr(feature = "defmt", derive(defmt::Format))]
    pub enum Obksize {
        #[doc = "Key size is 32 bits."]
        BITS32 = 0x0,
        #[doc = "Key size is 64 bits."]
        BITS64 = 0x01,
        #[doc = "Key size is 128 bits."]
        BITS128 = 0x02,
        #[doc = "Key size is 256 bits."]
        BITS256 = 0x03,
    }
    impl Obksize {
        #[inline(always)]
        pub const fn from_bits(val: u8) -> Obksize {
            unsafe { core::mem::transmute(val & 0x03) }
        }
        #[inline(always)]
        pub const fn to_bits(self) -> u8 {
            unsafe { core::mem::transmute(self) }
        }
    }
    impl From<u8> for Obksize {
        #[inline(always)]
        fn from(val: u8) -> Obksize {
            Obksize::from_bits(val)
        }
    }
    impl From<Obksize> for u8 {
        #[inline(always)]
        fn from(val: Obksize) -> u8 {
            Obksize::to_bits(val)
        }
    }
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
    pub struct OemProvd(u8);
    impl OemProvd {
        #[doc = "Device has been provisioned by the OEM."]
        pub const PROVISIONED: Self = Self(0xb4);
    }
    impl OemProvd {
        pub const fn from_bits(val: u8) -> OemProvd {
            Self(val & 0xff)
        }
        pub const fn to_bits(self) -> u8 {
            self.0
        }
    }
    impl core::fmt::Debug for OemProvd {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            match self.0 {
                0xb4 => f.write_str("PROVISIONED"),
                other => core::write!(f, "0x{:02X}", other),
            }
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for OemProvd {
        fn format(&self, f: defmt::Formatter) {
            match self.0 {
                0xb4 => defmt::write!(f, "PROVISIONED"),
                other => defmt::write!(f, "0x{:02X}", other),
            }
        }
    }
    impl From<u8> for OemProvd {
        #[inline(always)]
        fn from(val: u8) -> OemProvd {
            OemProvd::from_bits(val)
        }
    }
    impl From<OemProvd> for u8 {
        #[inline(always)]
        fn from(val: OemProvd) -> u8 {
            OemProvd::to_bits(val)
        }
    }
}