@@ -217,15 +217,11 @@ impl RccExt for RCC {
217
217
pll48clk : false ,
218
218
i2s_ckin : None ,
219
219
220
- #[ cfg( not( any(
221
- feature = "gpio-f412" ,
222
- feature = "gpio-f413" ,
223
- feature = "gpio-f446"
224
- ) ) ) ]
220
+ #[ cfg( not( feature = "rcc_i2s_apb" ) ) ]
225
221
i2s_clk : None ,
226
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
222
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
227
223
i2s_apb1_clk : None ,
228
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
224
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
229
225
i2s_apb2_clk : None ,
230
226
231
227
#[ cfg( feature = "sai" ) ]
@@ -317,11 +313,11 @@ pub struct CFGR {
317
313
318
314
i2s_ckin : Option < u32 > ,
319
315
320
- #[ cfg( not( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
316
+ #[ cfg( not( feature = "rcc_i2s_apb" ) ) ]
321
317
i2s_clk : Option < u32 > ,
322
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
318
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
323
319
i2s_apb1_clk : Option < u32 > ,
324
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
320
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
325
321
i2s_apb2_clk : Option < u32 > ,
326
322
327
323
#[ cfg( feature = "sai" ) ]
@@ -387,7 +383,7 @@ impl CFGR {
387
383
}
388
384
}
389
385
390
- #[ cfg( not( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
386
+ #[ cfg( not( feature = "rcc_i2s_apb" ) ) ]
391
387
impl CFGR {
392
388
/// Selects an I2S clock frequency and enables the I2S clock.
393
389
pub fn i2s_clk ( mut self , freq : Hertz ) -> Self {
@@ -396,7 +392,7 @@ impl CFGR {
396
392
}
397
393
}
398
394
399
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
395
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
400
396
impl CFGR {
401
397
/// Selects an I2S clock frequency for the first set of I2S instancesand enables the I2S clock.
402
398
pub fn i2s_apb1_clk ( mut self , freq : Hertz ) -> Self {
@@ -468,7 +464,7 @@ impl CFGR {
468
464
}
469
465
470
466
impl CFGR {
471
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
467
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
472
468
fn i2s_clocks ( & self ) -> I2sClocks {
473
469
let i2s_apb1_ext = self . i2s_apb1_clk . is_some ( ) && self . i2s_apb1_clk == self . i2s_ckin ;
474
470
let i2s_apb2_ext = self . i2s_apb2_clk . is_some ( ) && self . i2s_apb2_clk == self . i2s_ckin ;
@@ -492,7 +488,7 @@ impl CFGR {
492
488
}
493
489
}
494
490
495
- #[ cfg( not( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
491
+ #[ cfg( not( feature = "rcc_i2s_apb" ) ) ]
496
492
fn i2s_clocks ( & self ) -> I2sClocks {
497
493
let i2s_ext = self . i2s_clk . is_some ( ) && self . i2s_clk == self . i2s_ckin ;
498
494
let pll_i2s_clk = if i2s_ext { None } else { self . i2s_clk } ;
@@ -716,11 +712,11 @@ impl CFGR {
716
712
sysclk : sysclk. Hz ( ) ,
717
713
pll48clk : plls. pll48clk . map ( Hertz :: from_raw) ,
718
714
719
- #[ cfg( not( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
715
+ #[ cfg( not( feature = "rcc_i2s_apb" ) ) ]
720
716
i2s_clk : plls. i2s . i2s_clk . map ( Hertz :: from_raw) ,
721
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
717
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
722
718
i2s_apb1_clk : plls. i2s . apb1 . i2s_clk . map ( Hertz :: from_raw) ,
723
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
719
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
724
720
i2s_apb2_clk : plls. i2s . apb2 . i2s_clk . map ( Hertz :: from_raw) ,
725
721
726
722
#[ cfg( feature = "sai" ) ]
@@ -747,21 +743,21 @@ impl CFGR {
747
743
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
748
744
struct I2sClocks {
749
745
/// True if the clock for the APB1 I2S instances is identical to I2S_CKIN.
750
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
746
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
751
747
i2s_apb1_ext : bool ,
752
748
/// True if the clock for the APB2 I2S instances is identical to I2S_CKIN.
753
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
749
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
754
750
i2s_apb2_ext : bool ,
755
751
/// True if the clock for I2S is identical to I2S_CKIN.
756
- #[ cfg( not( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
752
+ #[ cfg( not( feature = "rcc_i2s_apb" ) ) ]
757
753
i2s_ext : bool ,
758
754
/// Target for the I2S PLL output.
759
755
pll_i2s_clk : Option < u32 > ,
760
756
}
761
757
762
758
impl I2sClocks {
763
759
fn real ( & self , pll_i2s_clk : Option < u32 > , i2s_ckin : Option < u32 > ) -> RealI2sClocks {
764
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
760
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
765
761
let clk = RealI2sClocks {
766
762
apb1 : RealI2sClock {
767
763
i2s_ext : self . i2s_apb1_ext ,
@@ -780,7 +776,7 @@ impl I2sClocks {
780
776
} ,
781
777
} ,
782
778
} ;
783
- #[ cfg( not( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
779
+ #[ cfg( not( feature = "rcc_i2s_apb" ) ) ]
784
780
let clk = RealI2sClocks {
785
781
i2s_ext : self . i2s_ext ,
786
782
i2s_clk : if self . i2s_ext { i2s_ckin } else { pll_i2s_clk } ,
@@ -796,27 +792,23 @@ struct RealI2sClock {
796
792
i2s_clk : Option < u32 > ,
797
793
}
798
794
799
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
795
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
800
796
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
801
797
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
802
798
struct RealI2sClocks {
803
799
apb1 : RealI2sClock ,
804
800
apb2 : RealI2sClock ,
805
801
}
806
802
807
- #[ cfg( not( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
803
+ #[ cfg( not( feature = "rcc_i2s_apb" ) ) ]
808
804
use RealI2sClock as RealI2sClocks ;
809
805
810
806
impl RealI2sClocks {
811
807
fn config_clocksel ( & self ) {
812
808
let rcc = unsafe { & * RCC :: ptr ( ) } ;
813
809
814
- #[ cfg( not( any(
815
- feature = "gpio-f410" ,
816
- feature = "gpio-f412" ,
817
- feature = "gpio-f413" ,
818
- feature = "gpio-f446" ,
819
- ) ) ) ]
810
+ #[ cfg( not( feature = "gpio-f410" ) ) ]
811
+ #[ cfg( not( feature = "rcc_i2s_apb" ) ) ]
820
812
rcc. cfgr ( ) . modify ( |_, w| {
821
813
if self . i2s_ext {
822
814
w. i2ssrc ( ) . ckin ( )
@@ -832,7 +824,7 @@ impl RealI2sClocks {
832
824
w. i2ssrc ( ) . pllclkr ( )
833
825
}
834
826
} ) ;
835
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
827
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
836
828
rcc. dckcfgr ( ) . modify ( |_, w| {
837
829
if self . apb1 . i2s_ext {
838
830
w. i2s1src ( ) . i2s_ckin ( )
@@ -933,11 +925,11 @@ pub struct Clocks {
933
925
sysclk : Hertz ,
934
926
pll48clk : Option < Hertz > ,
935
927
936
- #[ cfg( not( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
928
+ #[ cfg( not( feature = "rcc_i2s_apb" ) ) ]
937
929
i2s_clk : Option < Hertz > ,
938
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
930
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
939
931
i2s_apb1_clk : Option < Hertz > ,
940
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
932
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
941
933
i2s_apb2_clk : Option < Hertz > ,
942
934
943
935
#[ cfg( feature = "sai" ) ]
@@ -998,17 +990,17 @@ impl Clocks {
998
990
}
999
991
1000
992
/// Returns the frequency of the I2S clock.
1001
- #[ cfg( not( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
993
+ #[ cfg( not( feature = "rcc_i2s_apb" ) ) ]
1002
994
pub fn i2s_clk ( & self ) -> Option < Hertz > {
1003
995
self . i2s_clk
1004
996
}
1005
997
/// Returns the frequency of the first I2S clock (for the I2S peripherals on APB1).
1006
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
998
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
1007
999
pub fn i2s_apb1_clk ( & self ) -> Option < Hertz > {
1008
1000
self . i2s_apb1_clk
1009
1001
}
1010
1002
/// Returns the frequency of the second I2S clock (for the I2S peripherals on APB2).
1011
- #[ cfg( any ( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
1003
+ #[ cfg( feature = "rcc_i2s_apb" ) ]
1012
1004
pub fn i2s_apb2_clk ( & self ) -> Option < Hertz > {
1013
1005
self . i2s_apb2_clk
1014
1006
}
0 commit comments