drv_spi.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * File : stm32f20x_40x_spi.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009 RT-Thread Develop Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 20012-01-01 aozima first implementation.
  13. */
  14. #ifndef STM32F20X_40X_SPI_H_INCLUDED
  15. #define STM32F20X_40X_SPI_H_INCLUDED
  16. #include <rtthread.h>
  17. #include <drivers/spi.h>
  18. #include "stm32f4xx_hal.h"
  19. //#define SPI_USE_DMA
  20. struct stm32f4_spi
  21. {
  22. SPI_HandleTypeDef spi_handle;
  23. #ifdef SPI_USE_DMA
  24. DMA_HandleTypeDef hdma_rx;
  25. IRQn_Type hdma_rx_irq;
  26. DMA_HandleTypeDef hdma_tx;
  27. IRQn_Type hdma_tx_irq;
  28. #endif /* #ifdef SPI_USE_DMA */
  29. };
  30. struct stm32_spi_cs
  31. {
  32. GPIO_TypeDef * GPIOx;
  33. uint16_t GPIO_Pin;
  34. };
  35. /* public function */
  36. rt_err_t stm32_spi_bus_register(SPI_TypeDef * SPI,
  37. //struct stm32_spi_bus * stm32_spi,
  38. const char * spi_bus_name);
  39. #endif // STM32F20X_40X_SPI_H_INCLUDED