@@ -319,29 +319,9 @@ impl RccExt for RCC {
319
319
feature = "stm32f446" ,
320
320
) ) ]
321
321
i2s_apb2_clk : None ,
322
- #[ cfg( any(
323
- feature = "stm32f413" ,
324
- feature = "stm32f423" ,
325
- feature = "stm32f427" ,
326
- feature = "stm32f429" ,
327
- feature = "stm32f437" ,
328
- feature = "stm32f439" ,
329
- feature = "stm32f446" ,
330
- feature = "stm32f469" ,
331
- feature = "stm32f479" ,
332
- ) ) ]
322
+ #[ cfg( feature = "sai" ) ]
333
323
sai1_clk : None ,
334
- #[ cfg( any(
335
- feature = "stm32f413" ,
336
- feature = "stm32f423" ,
337
- feature = "stm32f427" ,
338
- feature = "stm32f429" ,
339
- feature = "stm32f437" ,
340
- feature = "stm32f439" ,
341
- feature = "stm32f446" ,
342
- feature = "stm32f469" ,
343
- feature = "stm32f479" ,
344
- ) ) ]
324
+ #[ cfg( feature = "sai" ) ]
345
325
sai2_clk : None ,
346
326
} ,
347
327
}
@@ -377,7 +357,7 @@ pub const HSI: u32 = 16_000_000; // Hz
377
357
/// Minimum system clock frequency
378
358
pub const SYSCLK_MIN : u32 = 24_000_000 ;
379
359
380
- #[ cfg( any ( feature = "stm32f446" ) ) ]
360
+ #[ cfg( feature = "stm32f446" ) ]
381
361
/// Minimum system clock frequency
382
362
pub const SYSCLK_MIN : u32 = 12_500_000 ;
383
363
@@ -481,29 +461,9 @@ pub struct CFGR {
481
461
feature = "stm32f446" ,
482
462
) ) ]
483
463
i2s_apb2_clk : Option < u32 > ,
484
- #[ cfg( any(
485
- feature = "stm32f413" ,
486
- feature = "stm32f423" ,
487
- feature = "stm32f427" ,
488
- feature = "stm32f429" ,
489
- feature = "stm32f437" ,
490
- feature = "stm32f439" ,
491
- feature = "stm32f446" ,
492
- feature = "stm32f469" ,
493
- feature = "stm32f479" ,
494
- ) ) ]
464
+ #[ cfg( feature = "sai" ) ]
495
465
sai1_clk : Option < u32 > ,
496
- #[ cfg( any(
497
- feature = "stm32f413" ,
498
- feature = "stm32f423" ,
499
- feature = "stm32f427" ,
500
- feature = "stm32f429" ,
501
- feature = "stm32f437" ,
502
- feature = "stm32f439" ,
503
- feature = "stm32f446" ,
504
- feature = "stm32f469" ,
505
- feature = "stm32f479" ,
506
- ) ) ]
466
+ #[ cfg( feature = "sai" ) ]
507
467
sai2_clk : Option < u32 > ,
508
468
}
509
469
@@ -641,14 +601,14 @@ impl CFGR {
641
601
}
642
602
643
603
/// Selects a SAI1 clock frequency and enables the SAI1 clock.
644
- #[ cfg( any ( feature = "stm32f446" , ) ) ]
604
+ #[ cfg( feature = "stm32f446" ) ]
645
605
pub fn sai1_clk ( mut self , freq : Hertz ) -> Self {
646
606
self . sai1_clk = Some ( freq. raw ( ) ) ;
647
607
self
648
608
}
649
609
650
610
/// Selects a SAI2 clock frequency and enables the SAI2 clock.
651
- #[ cfg( any ( feature = "stm32f446" , ) ) ]
611
+ #[ cfg( feature = "stm32f446" ) ]
652
612
pub fn sai2_clk ( mut self , freq : Hertz ) -> Self {
653
613
self . sai2_clk = Some ( freq. raw ( ) ) ;
654
614
self
@@ -828,17 +788,7 @@ impl CFGR {
828
788
}
829
789
}
830
790
831
- #[ cfg( any(
832
- feature = "stm32f413" ,
833
- feature = "stm32f423" ,
834
- feature = "stm32f427" ,
835
- feature = "stm32f429" ,
836
- feature = "stm32f437" ,
837
- feature = "stm32f439" ,
838
- feature = "stm32f446" ,
839
- feature = "stm32f469" ,
840
- feature = "stm32f479" ,
841
- ) ) ]
791
+ #[ cfg( feature = "sai" ) ]
842
792
fn sai_clocks ( & self ) -> SaiClocks {
843
793
let sai1_ext = self . sai1_clk . is_some ( ) && self . sai1_clk == self . i2s_ckin ;
844
794
#[ cfg( not( feature = "stm32f446" ) ) ]
@@ -1100,17 +1050,7 @@ impl CFGR {
1100
1050
1101
1051
// Select I2S and SAI clocks
1102
1052
plls. i2s . config_clocksel ( ) ;
1103
- #[ cfg( any(
1104
- feature = "stm32f413" ,
1105
- feature = "stm32f423" ,
1106
- feature = "stm32f427" ,
1107
- feature = "stm32f429" ,
1108
- feature = "stm32f437" ,
1109
- feature = "stm32f439" ,
1110
- feature = "stm32f446" ,
1111
- feature = "stm32f469" ,
1112
- feature = "stm32f479" ,
1113
- ) ) ]
1053
+ #[ cfg( feature = "sai" ) ]
1114
1054
plls. sai . config_clocksel ( ) ;
1115
1055
1116
1056
// Set scaling factors
@@ -1227,17 +1167,7 @@ struct PllSetup {
1227
1167
1228
1168
i2s : RealI2sClocks ,
1229
1169
1230
- #[ cfg( any(
1231
- feature = "stm32f413" ,
1232
- feature = "stm32f423" ,
1233
- feature = "stm32f427" ,
1234
- feature = "stm32f429" ,
1235
- feature = "stm32f437" ,
1236
- feature = "stm32f439" ,
1237
- feature = "stm32f446" ,
1238
- feature = "stm32f469" ,
1239
- feature = "stm32f479" ,
1240
- ) ) ]
1170
+ #[ cfg( feature = "sai" ) ]
1241
1171
sai : RealSaiClocks ,
1242
1172
}
1243
1173
@@ -1386,17 +1316,7 @@ impl RealI2sClocks {
1386
1316
}
1387
1317
}
1388
1318
1389
- #[ cfg( any(
1390
- feature = "stm32f413" ,
1391
- feature = "stm32f423" ,
1392
- feature = "stm32f427" ,
1393
- feature = "stm32f429" ,
1394
- feature = "stm32f437" ,
1395
- feature = "stm32f439" ,
1396
- feature = "stm32f446" ,
1397
- feature = "stm32f469" ,
1398
- feature = "stm32f479" ,
1399
- ) ) ]
1319
+ #[ cfg( feature = "sai" ) ]
1400
1320
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
1401
1321
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
1402
1322
struct SaiClocks {
@@ -1409,17 +1329,7 @@ struct SaiClocks {
1409
1329
pll_sai_clk : Option < u32 > ,
1410
1330
}
1411
1331
1412
- #[ cfg( any(
1413
- feature = "stm32f413" ,
1414
- feature = "stm32f423" ,
1415
- feature = "stm32f427" ,
1416
- feature = "stm32f429" ,
1417
- feature = "stm32f437" ,
1418
- feature = "stm32f439" ,
1419
- feature = "stm32f446" ,
1420
- feature = "stm32f469" ,
1421
- feature = "stm32f479" ,
1422
- ) ) ]
1332
+ #[ cfg( feature = "sai" ) ]
1423
1333
impl SaiClocks {
1424
1334
fn real ( & self , pll_sai_clk : Option < u32 > , i2s_ckin : Option < u32 > ) -> RealSaiClocks {
1425
1335
RealSaiClocks {
@@ -1435,17 +1345,7 @@ impl SaiClocks {
1435
1345
}
1436
1346
}
1437
1347
1438
- #[ cfg( any(
1439
- feature = "stm32f413" ,
1440
- feature = "stm32f423" ,
1441
- feature = "stm32f427" ,
1442
- feature = "stm32f429" ,
1443
- feature = "stm32f437" ,
1444
- feature = "stm32f439" ,
1445
- feature = "stm32f446" ,
1446
- feature = "stm32f469" ,
1447
- feature = "stm32f479" ,
1448
- ) ) ]
1348
+ #[ cfg( feature = "sai" ) ]
1449
1349
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
1450
1350
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
1451
1351
struct RealSaiClocks {
@@ -1456,29 +1356,19 @@ struct RealSaiClocks {
1456
1356
sai2_clk : Option < u32 > ,
1457
1357
}
1458
1358
1459
- #[ cfg( any(
1460
- feature = "stm32f413" ,
1461
- feature = "stm32f423" ,
1462
- feature = "stm32f427" ,
1463
- feature = "stm32f429" ,
1464
- feature = "stm32f437" ,
1465
- feature = "stm32f439" ,
1466
- feature = "stm32f446" ,
1467
- feature = "stm32f469" ,
1468
- feature = "stm32f479" ,
1469
- ) ) ]
1359
+ #[ cfg( feature = "sai" ) ]
1470
1360
impl RealSaiClocks {
1471
1361
fn config_clocksel ( & self ) {
1472
1362
let rcc = unsafe { & * RCC :: ptr ( ) } ;
1473
1363
1474
1364
// Configure SAI clocks.
1475
- #[ cfg( not( feature = "stm32f446" , ) ) ]
1365
+ #[ cfg( not( feature = "stm32f446" ) ) ]
1476
1366
if self . sai1_ext {
1477
1367
rcc. dckcfgr . modify ( |_, w| w. sai1asrc ( ) . i2s_ckin ( ) ) ;
1478
1368
} else {
1479
1369
rcc. dckcfgr . modify ( |_, w| w. sai1asrc ( ) . pllsai ( ) ) ;
1480
1370
}
1481
- #[ cfg( not( feature = "stm32f446" , ) ) ]
1371
+ #[ cfg( not( feature = "stm32f446" ) ) ]
1482
1372
if self . sai2_ext {
1483
1373
rcc. dckcfgr . modify ( |_, w| w. sai1bsrc ( ) . i2s_ckin ( ) ) ;
1484
1374
} else {
0 commit comments