File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -57,14 +57,18 @@ pub enum SdCardFreq {
5757 Custom ( Hertz )
5858}
5959
60+ impl From < SdCardFreq > for Hertz {
61+ fn from ( value : SdCardFreq ) -> Hertz {
62+ match value {
63+ SdCardFreq :: Safe => 200 . khz ( ) . into ( ) , // using 300 kHz here because the sdcard init needs 100 to 400 kHz (see SdMmcSpi.init)
64+ SdCardFreq :: Fast => 27 . mhz ( ) . into ( ) , // this is the max SPI frequency according to datasheet
65+ SdCardFreq :: Custom ( val) => val,
66+ }
67+ }
68+ }
69+
6070/// Constructs SD Card driver from the required components.
6171pub fn configure ( spi : SPI1 , pins : SdCardPins , freq : SdCardFreq , rcu : & mut Rcu ) -> SdCard {
62- let freq = match freq {
63- SdCardFreq :: Safe => 200 . khz ( ) . into ( ) , // using 300 kHz here because the sdcard init needs 100 to 400 kHz (see SdMmcSpi.init)
64- SdCardFreq :: Fast => 27 . mhz ( ) . into ( ) , // this is the max SPI frequency according to datasheet
65- SdCardFreq :: Custom ( val) => val,
66- } ;
67-
6872 let spi1 = Spi :: spi1 (
6973 spi,
7074 ( pins. sck , pins. miso , pins. mosi ) ,
You can’t perform that action at this time.
0 commit comments