drv_spi.h 748 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-01-09 shelton first version
  9. */
  10. #ifndef __DRV_SPI__
  11. #define __DRV_SPI__
  12. #include <rtthread.h>
  13. #include <drivers/spi.h>
  14. #include "n32g45x.h"
  15. struct n32_spi_config
  16. {
  17. SPI_Module *spix;
  18. const char *spi_name;
  19. };
  20. struct n32_spi
  21. {
  22. struct n32_spi_config *config;
  23. struct rt_spi_bus spi_bus;
  24. };
  25. struct n32_spi_cs
  26. {
  27. GPIO_Module *GPIOx;
  28. uint32_t GPIO_Pin;
  29. };
  30. /* public function */
  31. int rt_hw_spi_init(void);
  32. rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, GPIO_Module *cs_gpiox, uint16_t cs_gpio_pin);
  33. #endif // __DRV_SPI__