drv_spi.h 660 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-03-04 stevetong459 first version
  9. */
  10. #ifndef __DRV_SPI_H__
  11. #define __DRV_SPI_H__
  12. #include "board.h"
  13. struct apm32_spi_config
  14. {
  15. SPI_T *spi_x;
  16. char *spi_bus_name;
  17. };
  18. struct apm32_spi
  19. {
  20. struct apm32_spi_config *config;
  21. struct rt_spi_bus spi_bus;
  22. };
  23. struct apm32_spi_cs
  24. {
  25. GPIO_T *GPIOx;
  26. uint16_t GPIO_Pin;
  27. };
  28. rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, GPIO_T *cs_gpiox, uint16_t cs_gpio_pin);
  29. #endif /*__DRV_SPI_H__ */