From 20c5e56234167e53abbeb77624b351e350f1e3b5 Mon Sep 17 00:00:00 2001 From: Piotr Esden-Tempski Date: Wed, 29 Feb 2012 12:02:36 -0800 Subject: Fixed spi convenience reset function to compile properly. --- lib/stm32/spi.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/stm32/spi.c b/lib/stm32/spi.c index c97837c..175b182 100644 --- a/lib/stm32/spi.c +++ b/lib/stm32/spi.c @@ -18,6 +18,15 @@ */ #include +#if defined(STM32F1) +# include +#elif defined(STM32F2) +# include +#elif defined(STM32F4) +# include +#else +# error "stm32 family not defined." +#endif /* * SPI and I2S code. @@ -40,12 +49,12 @@ void spi_reset(u32 spi_peripheral) rcc_peripheral_clear_reset(&RCC_APB2RSTR, RCC_APB2RSTR_SPI1RST); break; case SPI2: - rcc_peripheral_reset(&RCC_APB1RSTR, RCC_APB2RSTR_SPI2RST); - rcc_peripheral_clear_reset(&RCC_APB1RSTR, RCC_APB2RSTR_SPI2RST); + rcc_peripheral_reset(&RCC_APB1RSTR, RCC_APB1RSTR_SPI2RST); + rcc_peripheral_clear_reset(&RCC_APB1RSTR, RCC_APB1RSTR_SPI2RST); break; case SPI3: - rcc_peripheral_reset(&RCC_APB1RSTR, RCC_APB2RSTR_SPI3RST); - rcc_peripheral_clear_reset(&RCC_APB1RSTR, RCC_APB2RSTR_SPI3RST); + rcc_peripheral_reset(&RCC_APB1RSTR, RCC_APB1RSTR_SPI3RST); + rcc_peripheral_clear_reset(&RCC_APB1RSTR, RCC_APB1RSTR_SPI3RST); break; } } -- cgit v1.2.3