From 8e09d58e7e6259c9c9448abacba41ae34a69f9b2 Mon Sep 17 00:00:00 2001 From: tanek liang Date: Sat, 5 Aug 2017 21:13:37 +0800 Subject: [PATCH 1/2] [Bsp] stm32f107 delete c99 mode code --- bsp/stm32f107/drivers/rt_stm32f10x_spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bsp/stm32f107/drivers/rt_stm32f10x_spi.c b/bsp/stm32f107/drivers/rt_stm32f10x_spi.c index 124c41945b..08d24c75eb 100644 --- a/bsp/stm32f107/drivers/rt_stm32f10x_spi.c +++ b/bsp/stm32f107/drivers/rt_stm32f10x_spi.c @@ -419,8 +419,9 @@ rt_err_t stm32_spi_register(SPI_TypeDef * SPI, { rt_err_t res = RT_EOK; NVIC_InitTypeDef NVIC_InitStructure; - RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); rt_uint32_t flags = 0; + RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); + if(SPI == SPI1) { stm32_spi->SPI = SPI1; From 6eac07ca15da9a918919f8ab5800545386ad5bac Mon Sep 17 00:00:00 2001 From: tanek liang Date: Sat, 5 Aug 2017 21:41:20 +0800 Subject: [PATCH 2/2] [Bsp] updated spi device: fixed error when enable "SPI2_USING_DMA" fixed warnning when using spi without DMA --- bsp/stm32f107/drivers/rt_stm32f10x_spi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bsp/stm32f107/drivers/rt_stm32f10x_spi.c b/bsp/stm32f107/drivers/rt_stm32f10x_spi.c index 08d24c75eb..82a8c2cab3 100644 --- a/bsp/stm32f107/drivers/rt_stm32f10x_spi.c +++ b/bsp/stm32f107/drivers/rt_stm32f10x_spi.c @@ -144,7 +144,7 @@ void DMA1_Channel4_IRQHandler(void) { /* enter interrupt */ rt_interrupt_enter(); rt_event_send(&dma2.event, SPI_DMA_TX_DONE); - DMA_ClearFlag(dma2.tx_gl_flag); + DMA_ClearFlag(dma2.priv_data->tx_gl_flag); /* leave interrupt */ rt_interrupt_leave(); } @@ -418,7 +418,9 @@ rt_err_t stm32_spi_register(SPI_TypeDef * SPI, const char * spi_bus_name) { rt_err_t res = RT_EOK; +#ifdef SPI_USE_DMA NVIC_InitTypeDef NVIC_InitStructure; +#endif rt_uint32_t flags = 0; RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);