1 /* 2 * Copyright (c) 2021 HPMicro 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef DRV_SPI_H 8 #define DRV_SPI_H 9 10 #include <rtthread.h> 11 #include <rtdevice.h> 12 #include <rthw.h> 13 #include <stdint.h> 14 15 16 #define SPI_CS_TAKE (0) 17 #define SPI_CS_RELEASE (1) 18 19 typedef void (*cs_ctrl_callback_t)(uint32_t value); 20 21 rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, cs_ctrl_callback_t callback); 22 23 int rt_hw_spi_init(void); 24 25 26 27 #endif /* DRV_SPI_H */ 28