Functions | |
void | spi_deselect_device (SPI_t *spi, struct spi_device *device) |
Deselect given device on the SPI bus. More... | |
void | spi_master_init (SPI_t *spi) |
Initializes the SPI in master mode. More... | |
void | spi_master_setup_device (SPI_t *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 (SPI_t *spi, uint8_t *data, size_t len) |
Receive a sequence of bytes from a SPI device. More... | |
void | spi_select_device (SPI_t *spi, struct spi_device *device) |
Select given device on the SPI bus. More... | |
status_code_t | spi_write_packet (SPI_t *spi, const uint8_t *data, size_t len) |
Send a sequence of bytes to a SPI device. More... | |
void spi_master_setup_device | ( | SPI_t * | 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 | Baud rate for communication with slave device in Hz. |
sel_id | Board specific select id |
References Assert, spi_xmega_set_baud_div(), and sysclk_get_cpu_hz().
Referenced by at25dfx_spi_init(), hx8347a_interface_init(), ili9341_interface_init(), main(), ssd1306_interface_init(), and st7565r_interface_init().