File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,11 @@ uint32_t spi_getClkFreqInst(SPI_TypeDef * spi_inst)
118118 if (spi_inst != NP ) {
119119 /* Get source clock depending on SPI instance */
120120 switch ((uint32_t )spi_inst ) {
121+ #if defined(SPI1_BASE ) || defined(SPI4_BASE ) || defined(SPI5_BASE ) || defined(SPI16_BASE )
122+ /* Some STM32's (eg. STM32F302x8) have no SPI1, but do have SPI2/3. */
123+ #if defined SPI1_BASE
121124 case (uint32_t )SPI1 :
125+ #endif
122126#if defined SPI4_BASE
123127 case (uint32_t )SPI4 :
124128#endif
@@ -131,6 +135,8 @@ uint32_t spi_getClkFreqInst(SPI_TypeDef * spi_inst)
131135 /* SPI1, SPI4, SPI5 and SPI6. Source CLK is PCKL2 */
132136 spi_freq = HAL_RCC_GetPCLK2Freq ();
133137 break ;
138+ #endif /* SPI[1456]_BASE */
139+
134140#if defined(SPI2_BASE ) || defined (SPI3_BASE )
135141#if defined SPI2_BASE
136142 case (uint32_t )SPI2 :
You can’t perform that action at this time.
0 commit comments