@@ -869,9 +869,9 @@ impl CFGR {
869
869
#[ cfg( not( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
870
870
i2s_clk : plls. i2s . i2s_clk . map ( Hertz :: from_raw) ,
871
871
#[ cfg( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
872
- i2s_apb1_clk : plls. i2s . i2s_apb1_clk . map ( Hertz :: from_raw) ,
872
+ i2s_apb1_clk : plls. i2s . apb1 . i2s_clk . map ( Hertz :: from_raw) ,
873
873
#[ cfg( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
874
- i2s_apb2_clk : plls. i2s . i2s_apb2_clk . map ( Hertz :: from_raw) ,
874
+ i2s_apb2_clk : plls. i2s . apb2 . i2s_clk . map ( Hertz :: from_raw) ,
875
875
876
876
#[ cfg( feature = "sai" ) ]
877
877
#[ cfg( not( feature = "sai2" ) ) ]
@@ -929,51 +929,53 @@ struct I2sClocks {
929
929
}
930
930
931
931
impl I2sClocks {
932
- #[ cfg( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
933
932
fn real ( & self , pll_i2s_clk : Option < u32 > , i2s_ckin : Option < u32 > ) -> RealI2sClocks {
934
- RealI2sClocks {
935
- i2s_apb1_ext : self . i2s_apb1_ext ,
936
- i2s_apb2_ext : self . i2s_apb2_ext ,
937
- i2s_apb1_clk : if self . i2s_apb1_ext {
938
- i2s_ckin
939
- } else {
940
- pll_i2s_clk
933
+ #[ cfg( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
934
+ let clk = RealI2sClocks {
935
+ apb1 : RealI2sClock {
936
+ i2s_ext : self . i2s_apb1_ext ,
937
+ i2s_clk : if self . i2s_apb1_ext {
938
+ i2s_ckin
939
+ } else {
940
+ pll_i2s_clk
941
+ } ,
941
942
} ,
942
- i2s_apb2_clk : if self . i2s_apb2_ext {
943
- i2s_ckin
944
- } else {
945
- pll_i2s_clk
943
+ apb2 : RealI2sClock {
944
+ i2s_ext : self . i2s_apb2_ext ,
945
+ i2s_clk : if self . i2s_apb2_ext {
946
+ i2s_ckin
947
+ } else {
948
+ pll_i2s_clk
949
+ } ,
946
950
} ,
947
- }
948
- }
949
-
950
- #[ cfg( not( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
951
- fn real ( & self , pll_i2s_clk : Option < u32 > , i2s_ckin : Option < u32 > ) -> RealI2sClocks {
952
- RealI2sClocks {
951
+ } ;
952
+ #[ cfg( not( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
953
+ let clk = RealI2sClocks {
953
954
i2s_ext : self . i2s_ext ,
954
955
i2s_clk : if self . i2s_ext { i2s_ckin } else { pll_i2s_clk } ,
955
- }
956
+ } ;
957
+ clk
956
958
}
957
959
}
958
960
959
- #[ cfg( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
960
961
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
961
962
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
962
- struct RealI2sClocks {
963
- i2s_apb1_ext : bool ,
964
- i2s_apb2_ext : bool ,
965
- i2s_apb1_clk : Option < u32 > ,
966
- i2s_apb2_clk : Option < u32 > ,
963
+ struct RealI2sClock {
964
+ i2s_ext : bool ,
965
+ i2s_clk : Option < u32 > ,
967
966
}
968
967
969
- #[ cfg( not ( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
968
+ #[ cfg( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
970
969
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
971
970
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
972
971
struct RealI2sClocks {
973
- i2s_ext : bool ,
974
- i2s_clk : Option < u32 > ,
972
+ apb1 : RealI2sClock ,
973
+ apb2 : RealI2sClock ,
975
974
}
976
975
976
+ #[ cfg( not( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ) ]
977
+ use RealI2sClock as RealI2sClocks ;
978
+
977
979
impl RealI2sClocks {
978
980
fn config_clocksel ( & self ) {
979
981
let rcc = unsafe { & * RCC :: ptr ( ) } ;
@@ -1001,12 +1003,12 @@ impl RealI2sClocks {
1001
1003
} ) ;
1002
1004
#[ cfg( any( feature = "gpio-f412" , feature = "gpio-f413" , feature = "gpio-f446" ) ) ]
1003
1005
rcc. dckcfgr ( ) . modify ( |_, w| {
1004
- if self . i2s_apb1_ext {
1006
+ if self . apb1 . i2s_ext {
1005
1007
w. i2s1src ( ) . i2s_ckin ( )
1006
1008
} else {
1007
1009
w. i2s1src ( ) . plli2sr ( )
1008
1010
} ;
1009
- if self . i2s_apb2_ext {
1011
+ if self . apb2 . i2s_ext {
1010
1012
w. i2s2src ( ) . i2s_ckin ( )
1011
1013
} else {
1012
1014
w. i2s2src ( ) . plli2sr ( )
0 commit comments