AVR XMEGA USART in SPI mode driver functions.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Functions | |
void | usart_spi_deselect_device (USART_t *usart, struct usart_spi_device *device) |
Deselect given device on the SPI bus. More... | |
void | usart_spi_init (USART_t *usart) |
Initializes the USART in SPI master mode. More... | |
status_code_t | usart_spi_read_packet (USART_t *usart, uint8_t *data, size_t len) |
Receive a sequence of bytes from a USART in SPI mode device. More... | |
void | usart_spi_select_device (USART_t *usart, struct usart_spi_device *device) |
Select given device on the SPI bus. More... | |
void | usart_spi_setup_device (USART_t *usart, struct usart_spi_device *device, spi_flags_t flags, unsigned long baud_rate, board_spi_select_id_t sel_id) |
Setup a USART in SPI mode device. More... | |
status_code_t | usart_spi_write_packet (USART_t *usart, const uint8_t *data, size_t len) |
Send a sequence of bytes to a SPI device using USART in SPI mode. More... | |
void usart_spi_deselect_device | ( | USART_t * | usart, |
struct usart_spi_device * | device | ||
) |
Deselect given device on the SPI bus.
Calls board chip deselect.
usart | Base address of the USART instance. |
device | SPI device |
References usart_spi_device::id, and ioport_set_pin_high().
Referenced by at25dfx_spi_deselect_device(), ssd1306_write_command(), ssd1306_write_data(), st7565r_write_command(), and st7565r_write_data().
void usart_spi_init | ( | USART_t * | usart | ) |
Initializes the USART in SPI master mode.
usart | Base address of the USART instance. |
References sysclk_enable_module(), SYSCLK_PORT_C, SYSCLK_PORT_D, SYSCLK_PORT_E, and SYSCLK_PORT_F.
Referenced by at25dfx_spi_init(), at45dbx_spi_init(), hx8347a_interface_init(), ili9341_interface_init(), ssd1306_interface_init(), and st7565r_interface_init().
status_code_t usart_spi_read_packet | ( | USART_t * | usart, |
uint8_t * | data, | ||
size_t | len | ||
) |
Receive a sequence of bytes from a USART in SPI mode device.
All bytes sent out on usart bus are sent as value 0.
usart | Base address of the usart instance. |
data | data buffer to read |
len | Length of data |
References CONFIG_USART_SPI_DUMMY, STATUS_OK, and usart_spi_transmit().
Referenced by at25dfx_spi_read_byte(), at25dfx_spi_read_packet(), and hx8347a_read_byte().
void usart_spi_select_device | ( | USART_t * | usart, |
struct usart_spi_device * | device | ||
) |
Select given device on the SPI bus.
Set device specific setting and calls board chip select.
usart | Base address of the USART instance. |
device | SPI device |
References usart_spi_device::id, and ioport_set_pin_low().
Referenced by at25dfx_spi_select_device(), ssd1306_write_command(), ssd1306_write_data(), st7565r_write_command(), and st7565r_write_data().
void usart_spi_setup_device | ( | USART_t * | usart, |
struct usart_spi_device * | device, | ||
spi_flags_t | flags, | ||
unsigned long | baud_rate, | ||
board_spi_select_id_t | sel_id | ||
) |
Setup a USART in SPI mode device.
The returned device descriptor structure must be passed to the driver whenever that device should be used as current slave device.
usart | Base address of the USART instance. |
device | Pointer to usart device struct that should be initialized. |
flags | USART configuration flags. Common flags for all implementations are the usart 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 usart_spi_options::baudrate, usart_spi_options::data_order, usart_spi_options::spimode, and usart_init_spi().
Referenced by at25dfx_spi_init(), hx8347a_interface_init(), ili9341_interface_init(), ssd1306_interface_init(), and st7565r_interface_init().
status_code_t usart_spi_write_packet | ( | USART_t * | usart, |
const uint8_t * | data, | ||
size_t | len | ||
) |
Send a sequence of bytes to a SPI device using USART in SPI mode.
Received bytes on the USART in SPI mode are discarded.
usart | Base address of the USART instance. |
data | Data buffer to write |
len | Length of data |
References STATUS_OK, and usart_spi_transmit().
Referenced by at25dfx_spi_write_byte(), at25dfx_spi_write_packet(), hx8347a_send_byte(), and hx8347a_write_packet().