336 uint32_t usart_spi_read_packet(Usart *p_usart, uint8_t *data, size_t len)
Receive a sequence of bytes from a USART in SPI mode device.
void usart_enable_rx(Usart *p_usart)
Enable USART receiver.
uint32_t usart_spi_is_rx_ready(Usart *p_usart)
Check whether the USART in SPI master mode contains a received character.
#define ID_USART1
USART 1 (USART1)
#define UNUSED(v)
Marking v as a unused parameter or value.
uint32_t usart_spi_is_tx_ready(Usart *p_usart)
Check if the USART Transmit Holding Register is empty or not in SPI mode.
uint32_t usart_is_rx_buf_full(Usart *p_usart)
Check if both receive buffers are full.
Usart hardware registers.
uint32_t usart_spi_write_packet(Usart *p_usart, const uint8_t *data, size_t len)
Send a sequence of bytes to an SPI device using USART in SPI mode.
void usart_spi_read_single(Usart *p_usart, uint8_t *data)
Receive one byte from an SPI device using USART in SPI mode.
#define US_MR_CHMODE_NORMAL
(US_MR) Normal mode
void usart_spi_write_single(Usart *p_usart, uint8_t data)
Write one byte to an SPI device using USART in SPI mode.
#define USART0
(USART0) Base Address
#define USART1
(USART1) Base Address
void usart_spi_select_device(Usart *p_usart, struct usart_spi_device *device)
Select the given device on the SPI bus.
void usart_spi_release_chip_select(Usart *p_usart)
Drive the slave select line NSS (RTS pin) to 1 in SPI master mode.
uint32_t usart_is_tx_ready(Usart *p_usart)
Check if Transmit is Ready. Check if data have been loaded in USART_THR and are waiting to be loaded ...
void usart_spi_disable(Usart *p_usart)
Disable the USART for the specified USART in SPI mode.
static uint32_t sysclk_get_peripheral_hz(void)
Retrieves the current rate in Hz of the peripheral clocks.
uint32_t usart_is_rx_ready(Usart *p_usart)
Check if the received data are ready. Check if Data have been received and loaded into USART_RHR...
void usart_spi_setup_device(Usart *p_usart, struct usart_spi_device *device, spi_flags_t flags, unsigned long baud_rate, board_spi_select_id_t sel_id)
Set up a USART in SPI master mode device.
uint32_t usart_spi_is_tx_empty(Usart *p_usart)
Check whether there are data in Transmit Holding Register or Transmit Shift Register in SPI master mo...
void usart_spi_init(Usart *p_usart)
Enable the USART system clock in SPI master mode.
uint32_t usart_init_spi_master(Usart *p_usart, const usart_spi_opt_t *p_usart_opt, uint32_t ul_mck)
Configure USART to work in SPI mode and act as a master.
#define US_MR_CHRL_8_BIT
(US_MR) Character length is 8 bits
uint32_t usart_getchar(Usart *p_usart, uint32_t *c)
Read from USART Receive Holding Register. Before reading user should check if rx is ready...
void usart_disable_rx(Usart *p_usart)
Disable USART receiver.
void usart_spi_enable(Usart *p_usart)
Enable the USART for the specified USART in SPI mode.
USBInterfaceDescriptor data
Polled SPI device definition.
uint32_t usart_putchar(Usart *p_usart, uint32_t c)
Write to USART Transmit Holding Register.
#define ID_USART0
USART 0 (USART0)
uint8_t spi_flags_t
SPI Flags Definition.
uint32_t usart_spi_is_rx_full(Usart *p_usart)
Check if both receive buffers are full.
void usart_disable_tx(Usart *p_usart)
Disable USART transmitter.
void usart_spi_force_chip_select(Usart *p_usart)
Drive the slave select line NSS (RTS pin) to 0 in SPI master mode.
void usart_enable_tx(Usart *p_usart)
Enable USART transmitter.
#define CONFIG_USART_SPI_DUMMY
Default Configuration of SPI Master Dummy Field.
static void sysclk_enable_peripheral_clock(uint32_t ul_id)
Enable a peripheral's clock.
#define USART2
(USART2) Base Address
SAM USART in SPI mode driver functions.
uint32_t board_spi_select_id_t
Board SPI Select Id Definition.
uint32_t usart_is_tx_empty(Usart *p_usart)
Check if Transmit Holding Register is empty. Check if the last data written in USART_THR have been lo...
#define ID_USART2
USART 2 (USART2)
void usart_spi_deselect_device(Usart *p_usart, struct usart_spi_device *device)
De-select the given device on the SPI bus.