File tree Expand file tree Collapse file tree 2 files changed +36
-5
lines changed Expand file tree Collapse file tree 2 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -40,16 +40,25 @@ fn main() -> ! {
4040
4141 let clocks = rcc
4242 . cfgr
43- // needed for RNG
43+ // Needed for RNG.
4444 . clk48_source ( {
45- if cfg ! ( any(
45+ # [ cfg( any(
4646 feature = "stm32l476" ,
4747 feature = "stm32l486" ,
4848 feature = "stm32l496" ,
4949 feature = "stm32l4a6"
50- ) ) {
50+ ) ) ]
51+ {
5152 Clk48Source :: Hsi48
52- } else {
53+ }
54+
55+ #[ cfg( not( any(
56+ feature = "stm32l476" ,
57+ feature = "stm32l486" ,
58+ feature = "stm32l496" ,
59+ feature = "stm32l4a6"
60+ ) ) ) ]
61+ {
5362 Clk48Source :: Msi
5463 }
5564 } )
Original file line number Diff line number Diff line change 66extern crate panic_semihosting;
77
88use cortex_m_rt:: entry;
9+ use stm32l4xx_hal:: rcc:: Clk48Source ;
910use stm32l4xx_hal:: usb:: { Peripheral , UsbBus } ;
1011use stm32l4xx_hal:: { prelude:: * , stm32} ;
1112use usb_device:: prelude:: * ;
@@ -43,7 +44,28 @@ fn main() -> ! {
4344
4445 let _clocks = rcc
4546 . cfgr
46- . hsi48 ( true )
47+ // Needed for USB.
48+ . clk48_source ( {
49+ #[ cfg( any(
50+ feature = "stm32l476" ,
51+ feature = "stm32l486" ,
52+ feature = "stm32l496" ,
53+ feature = "stm32l4a6"
54+ ) ) ]
55+ {
56+ Clk48Source :: Hsi48
57+ }
58+
59+ #[ cfg( not( any(
60+ feature = "stm32l476" ,
61+ feature = "stm32l486" ,
62+ feature = "stm32l496" ,
63+ feature = "stm32l4a6"
64+ ) ) ) ]
65+ {
66+ Clk48Source :: Msi
67+ }
68+ } )
4769 . sysclk ( 80 . MHz ( ) )
4870 . freeze ( & mut flash. acr , & mut pwr) ;
4971
You can’t perform that action at this time.
0 commit comments