37 #ifndef _SPI_MASTER_H_ 38 #define _SPI_MASTER_H_ 58 #ifndef CONFIG_SPI_MASTER_DELAY_BCS 59 #define CONFIG_SPI_MASTER_DELAY_BCS 0 63 #ifndef CONFIG_SPI_MASTER_BITS_PER_TRANSFER 64 #define CONFIG_SPI_MASTER_BITS_PER_TRANSFER SPI_CSR_BITS_8_BIT 68 #ifndef CONFIG_SPI_MASTER_DELAY_BCT 69 #define CONFIG_SPI_MASTER_DELAY_BCT 0 73 #ifndef CONFIG_SPI_MASTER_DELAY_BS 74 #define CONFIG_SPI_MASTER_DELAY_BS 0 78 #ifndef CONFIG_SPI_MASTER_DUMMY 79 #define CONFIG_SPI_MASTER_DUMMY 0xFF 86 #define SPI_CPHA (1 << 0) 91 #define SPI_CPOL (1 << 1) 100 #define SPI_MODE_1 (SPI_CPHA) 104 #define SPI_MODE_2 (SPI_CPOL) 108 #define SPI_MODE_3 (SPI_CPOL | SPI_CPHA) 110 #ifndef SPI_TYPE_DEFS 111 #define SPI_TYPE_DEFS 122 board_spi_select_id_t
id;
147 spi_flags_t flags, uint32_t baud_rate, board_spi_select_id_t sel_id);
181 spi_put(p_spi, (uint16_t)data);
196 const uint8_t *
data,
size_t len);
206 *data = (uint8_t)
spi_get(p_spi);
242 #endif // _SPI_MASTER_H_ static void spi_read_single(Spi *p_spi, uint8_t *data)
Receive one byte from an SPI device.
status_code_t spi_transceive_packet(Spi *p_spi, uint8_t *tx_data, uint8_t *rx_data, size_t len)
Send and receive a sequence of bytes from an SPI device.
void spi_select_device(Spi *p_spi, struct spi_device *device)
Select the given device on the SPI bus.
Spi Master configuration.
board_spi_select_id_t id
Board specific select id.
void spi_deselect_device(Spi *p_spi, struct spi_device *device)
Deselect the given device on the SPI bus.
status_code_t spi_read_packet(Spi *p_spi, uint8_t *data, size_t len)
Receive a sequence of bytes from an SPI device.
Commonly used includes, types and macros.
USBInterfaceDescriptor data
void spi_master_init(Spi *p_spi)
Initialize the SPI in master mode.
static void spi_write_single(Spi *p_spi, uint8_t data)
Write one byte to an SPI device.
static void spi_put(Spi *p_spi, uint16_t data)
Put one data to a SPI peripheral.
enum status_code status_code_t
status_code_t spi_write_packet(Spi *p_spi, const uint8_t *data, size_t len)
Send a sequence of bytes to an SPI device.
uint8_t spi_flags_t
SPI Flags Definition.
Polled SPI device definition.
static uint16_t spi_get(Spi *p_spi)
Get one data to a SPI peripheral.
void spi_master_setup_device(Spi *p_spi, struct spi_device *device, spi_flags_t flags, uint32_t baud_rate, board_spi_select_id_t sel_id)
Set up an SPI device.
uint32_t board_spi_select_id_t
Board SPI Select Id Definition.