SPI master driver functions.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Functions | |
void | spi_deselect_device (volatile void *spi, struct spi_device *device) |
Deselect given device on the SPI bus. More... | |
void | spi_master_init (volatile void *spi) |
Initializes the SPI in master mode. More... | |
void | spi_master_setup_device (volatile void *spi, struct spi_device *device, spi_flags_t flags, uint32_t baud_rate, board_spi_select_id_t sel_id) |
Setup a SPI device. More... | |
status_code_t | spi_read_packet (volatile void *spi, uint8_t *data, size_t len) |
Receive a sequence of bytes from a SPI device. More... | |
void | spi_select_device (volatile void *spi, struct spi_device *device) |
Select given device on the SPI bus. More... | |
status_code_t | spi_write_packet (volatile void *spi, const uint8_t *data, size_t len) |
Send a sequence of bytes to a SPI device. More... | |
void spi_master_setup_device | ( | volatile void * | spi, |
struct spi_device * | device, | ||
spi_flags_t | flags, | ||
uint32_t | baud_rate, | ||
board_spi_select_id_t | sel_id | ||
) |
Setup a SPI device.
The returned device descriptor structure must be passed to the driver whenever that device should be used as current slave device.
spi | Base address of the SPI instance. |
device | Pointer to SPI device struct that should be initialized. |
flags | SPI configuration flags. Common flags for all implementations are the SPI modes SPI_MODE_0 ... SPI_MODE_3. |
baud_rate | Divider for Baud rate setting. |
sel_id | Board specific select id |
References Assert, SPI_MODE_gm, SPI_MODE_gp, spi_set_baud_div(), and sysclk_get_cpu_hz().
Referenced by epd_spi_init(), and main().