drv_spi.h 707 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2006-2023, 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. #include <rtthread.h>
  14. #include <drivers/spi.h>
  15. struct apm32_spi_config
  16. {
  17. SPI_T *spi_x;
  18. char *spi_bus_name;
  19. };
  20. struct apm32_spi
  21. {
  22. struct apm32_spi_config *config;
  23. struct rt_spi_bus spi_bus;
  24. };
  25. struct apm32_spi_cs
  26. {
  27. GPIO_T *GPIOx;
  28. uint16_t GPIO_Pin;
  29. };
  30. 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);
  31. #endif /*__DRV_SPI_H__ */