SAM USART in SPI mode driver functions. More...


Go to the source code of this file.
| Classes | |
| struct | usart_spi_device | 
| Polled SPI device definition.  More... | |
| Macros | |
| #define | SPI_TYPE_DEFS | 
| USART in SPI mode Management Configuration. | |
| #define | CONFIG_USART_SPI_DUMMY 0xFF | 
| Default Configuration of SPI Master Dummy Field.  More... | |
| Typedefs | |
| typedef uint32_t | board_spi_select_id_t | 
| Board SPI Select Id Definition.  More... | |
| typedef uint8_t | port_pin_t | 
| typedef uint8_t | spi_flags_t | 
| SPI Flags Definition.  More... | |
| Functions | |
| void | usart_spi_deselect_device (Usart *p_usart, struct usart_spi_device *device) | 
| De-select the given device on the SPI bus.  More... | |
| void | usart_spi_disable (Usart *p_usart) | 
| Disable the USART for the specified USART in SPI mode.  More... | |
| void | usart_spi_enable (Usart *p_usart) | 
| Enable the USART for the specified USART in SPI mode.  More... | |
| void | usart_spi_init (Usart *p_usart) | 
| Enable the USART system clock in SPI master mode.  More... | |
| uint32_t | usart_spi_is_rx_full (Usart *p_usart) | 
| Check if both receive buffers are full.  More... | |
| uint32_t | usart_spi_is_rx_ready (Usart *p_usart) | 
| Check whether the USART in SPI master mode contains a received character.  More... | |
| 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 mode.  More... | |
| uint32_t | usart_spi_is_tx_ready (Usart *p_usart) | 
| Check if the USART Transmit Holding Register is empty or not in SPI mode.  More... | |
| 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.  More... | |
| void | usart_spi_read_single (Usart *p_usart, uint8_t *data) | 
| Receive one byte from an SPI device using USART in SPI mode.  More... | |
| void | usart_spi_select_device (Usart *p_usart, struct usart_spi_device *device) | 
| Select the given device on the SPI bus.  More... | |
| 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.  More... | |
| 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.  More... | |
| void | usart_spi_write_single (Usart *p_usart, uint8_t data) | 
| Write one byte to an SPI device using USART in SPI mode.  More... | |
SAM USART in SPI mode driver functions.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Definition in file sam_usart_spi/usart_spi.h.
| #define CONFIG_USART_SPI_DUMMY 0xFF | 
Default Configuration of SPI Master Dummy Field.
Definition at line 58 of file sam_usart_spi/usart_spi.h.
| #define SPI_TYPE_DEFS | 
Definition at line 63 of file sam_usart_spi/usart_spi.h.
| typedef uint32_t board_spi_select_id_t | 
Board SPI Select Id Definition.
Definition at line 68 of file sam_usart_spi/usart_spi.h.
| typedef uint8_t port_pin_t | 
Definition at line 71 of file sam_usart_spi/usart_spi.h.
| typedef uint8_t spi_flags_t | 
SPI Flags Definition.
Definition at line 65 of file sam_usart_spi/usart_spi.h.
| void usart_spi_deselect_device | ( | Usart * | p_usart, | 
| struct usart_spi_device * | device | ||
| ) | 
De-select the given device on the SPI bus.
| p_usart | Base address of the USART instance. | 
| device | SPI device. | 
Definition at line 246 of file usart_spi.c.
| void usart_spi_disable | ( | Usart * | p_usart | ) | 
Disable the USART for the specified USART in SPI mode.
Ensure that nothing is transferred while setting up buffers.
| p_usart | Base address of the USART instance. | 
Definition at line 324 of file usart_spi.c.
| void usart_spi_enable | ( | Usart * | p_usart | ) | 
Enable the USART for the specified USART in SPI mode.
| p_usart | Base address of the USART instance. | 
Definition at line 311 of file usart_spi.c.
| void usart_spi_init | ( | Usart * | p_usart | ) | 
Enable the USART system clock in SPI master mode.
| p_usart | Pointer to Base address of the USART instance. | 
Definition at line 57 of file usart_spi.c.
| uint32_t usart_spi_is_rx_full | ( | Usart * | p_usart | ) | 
Check if both receive buffers are full.
| p_usart | Base address of the USART instance. | 
| 1 | Receive buffers are full. | 
| 0 | Receive buffers are not full. | 
Definition at line 298 of file usart_spi.c.
| uint32_t usart_spi_is_rx_ready | ( | Usart * | p_usart | ) | 
Check whether the USART in SPI master mode contains a received character.
| p_usart | Base address of the USART instance. | 
| 1 | Some data have been received. | 
| 0 | No data has been received. | 
Definition at line 274 of file usart_spi.c.
| 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 mode.
| p_usart | Base address of the USART instance. | 
| 1 | The two registers are empty. | 
| 0 | One of the two registers contains data. | 
Definition at line 262 of file usart_spi.c.
| uint32_t usart_spi_is_tx_ready | ( | Usart * | p_usart | ) | 
Check if the USART Transmit Holding Register is empty or not in SPI mode.
| p_usart | Base address of the USART instance. | 
| 1 | There is no data in the Transmit Holding Register. | 
| 0 | There are data in the Transmit Holding Register. | 
Definition at line 286 of file usart_spi.c.
| 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.
All bytes sent out on usart bus are sent as value 0.
| p_usart | Base address of the usart instance. | 
| data | Data buffer to put read data. | 
| len | Length of data. | 
Definition at line 207 of file usart_spi.c.
| void usart_spi_read_single | ( | Usart * | p_usart, | 
| uint8_t * | data | ||
| ) | 
Receive one byte from an SPI device using USART in SPI mode.
| p_usart | Base address of the USART instance. | 
| data | Pointer to the data byte where to store the received data. | 
Definition at line 184 of file usart_spi.c.
| void usart_spi_select_device | ( | Usart * | p_usart, | 
| struct usart_spi_device * | device | ||
| ) | 
Select the given device on the SPI bus.
| p_usart | Base address of the USART instance. | 
| device | SPI device. | 
Definition at line 232 of file usart_spi.c.
| 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.
The returned device descriptor structure must be passed to the driver whenever that device should be used as current slave device.
| p_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, which should be SPI_MODE_0, SPI_MODE_1, SPI_MODE_2, SPI_MODE_3. | 
| baud_rate | Baud rate for communication with slave device in Hz. | 
| sel_id | Board specific select id. | 
Definition at line 113 of file usart_spi.c.
| 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.
Received bytes on the USART in SPI mode are discarded.
| p_usart | Base address of the USART instance. | 
| data | Data buffer to write. | 
| len | Length of data. | 
Definition at line 164 of file usart_spi.c.
| void usart_spi_write_single | ( | Usart * | p_usart, | 
| uint8_t | data | ||
| ) | 
Write one byte to an SPI device using USART in SPI mode.
| p_usart | Base address of the USART instance. | 
| data | The data to be sent out. | 
Definition at line 146 of file usart_spi.c.