#ifndef INCLUDED_DRV_SPI_H #define INCLUDED_DRV_SPI_H #ifndef INCLUDED_DRV_DEVICE_H #include #endif /*INCLUDED_DRV_DEVICE_H*/ /* ------------------------------------------------------------------------------------------------------------------ */ /* */ typedef struct { drv_device_t device; os_err_t (*cs_low)(void* handle); os_err_t (*cs_high)(void* handle); os_err_t (*put)(void* handle, uint8_t data); os_err_t (*get)(void* handle, uint8_t* data); os_err_t (*send_halfword)(void* handle, uint16_t data); os_err_t (*read_halfword)(void* handle, uint16_t* data); }drv_spi_t; #define drv_spi_cs_low(dev) ((drv_spi_t*)(dev->handle))->cs_low((dev)->handle) #define drv_spi_cs_high(dev) ((drv_spi_t*)(dev->handle))->cs_high((dev)->handle) #define drv_spi_put(dev, data) ((drv_spi_t*)(dev->handle))->put((dev)->handle, data) #define drv_spi_get(dev, data) ((drv_spi_t*)(dev->handle))->get((dev)->handle, data) #define drv_spi_send_halfword(dev, data) ((drv_spi_t*)(dev->handle))->send_halfword((dev)->handle, data) #define drv_spi_read_halfword(dev, data) ((drv_spi_t*)(dev->handle))->read_halfword((dev)->handle, data) #endif /*INCLUDED_DRV_SPI_H*/