sam_usart_spi/usart_spi.h
Go to the documentation of this file.
1 
33 /*
34  * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
35  */
36 
37 #ifndef _USART_SPI_H_
38 #define _USART_SPI_H_
39 
40 #include "compiler.h"
41 #include "usart.h"
42 
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 
53 #include "conf_usart_spi.h"
55 
57 #ifndef CONFIG_USART_SPI_DUMMY
58  #define CONFIG_USART_SPI_DUMMY 0xFF
59 #endif
60 
62 #ifndef SPI_TYPE_DEFS
63 #define SPI_TYPE_DEFS
64 typedef uint8_t spi_flags_t;
66 
68 typedef uint32_t board_spi_select_id_t;
69 #endif
70 
71 typedef uint8_t port_pin_t;
72 
75  /* Board specific select id. */
76  port_pin_t id;
77 };
78 
79 void usart_spi_init(Usart *p_usart);
80 void usart_spi_setup_device(Usart *p_usart, struct usart_spi_device *device,
81  spi_flags_t flags, unsigned long baud_rate, board_spi_select_id_t sel_id);
82 void usart_spi_write_single(Usart *p_usart, uint8_t data);
83 uint32_t usart_spi_write_packet(Usart *p_usart, const uint8_t *data, size_t len);
84 void usart_spi_read_single(Usart *p_usart, uint8_t *data);
85 uint32_t usart_spi_read_packet(Usart *p_usart, uint8_t *data, size_t len);
86 void usart_spi_select_device(Usart *p_usart, struct usart_spi_device *device);
87 void usart_spi_deselect_device(Usart *p_usart, struct usart_spi_device *device);
88 uint32_t usart_spi_is_tx_empty(Usart *p_usart);
89 uint32_t usart_spi_is_rx_ready(Usart *p_usart);
90 uint32_t usart_spi_is_tx_ready(Usart *p_usart);
91 uint32_t usart_spi_is_rx_full(Usart *p_usart);
92 void usart_spi_enable(Usart *p_usart);
93 void usart_spi_disable(Usart *p_usart);
94 
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 
103 #endif /* _USART_SPI_H_ */
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.
Definition: usart_spi.c:164
void usart_spi_enable(Usart *p_usart)
Enable the USART for the specified USART in SPI mode.
Definition: usart_spi.c:311
Usart hardware registers.
USART SPI Configuration.
uint32_t usart_spi_is_rx_ready(Usart *p_usart)
Check whether the USART in SPI master mode contains a received character.
Definition: usart_spi.c:274
uint8_t port_pin_t
uint32_t usart_spi_is_tx_ready(Usart *p_usart)
Check if the USART Transmit Holding Register is empty or not in SPI mode.
Definition: usart_spi.c:286
void usart_spi_init(Usart *p_usart)
Enable the USART system clock in SPI master mode.
Definition: usart_spi.c:57
uint8_t spi_flags_t
SPI Flags Definition.
Commonly used includes, types and macros.
void usart_spi_write_single(Usart *p_usart, uint8_t data)
Write one byte to an SPI device using USART in SPI mode.
Definition: usart_spi.c:146
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.
Definition: usart_spi.c:113
uint32_t board_spi_select_id_t
Board SPI Select Id Definition.
void usart_spi_disable(Usart *p_usart)
Disable the USART for the specified USART in SPI mode.
Definition: usart_spi.c:324
void usart_spi_select_device(Usart *p_usart, struct usart_spi_device *device)
Select the given device on the SPI bus.
Definition: usart_spi.c:232
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.
Definition: usart_spi.c:207
USBInterfaceDescriptor data
Polled SPI device definition.
uint32_t usart_spi_is_rx_full(Usart *p_usart)
Check if both receive buffers are full.
Definition: usart_spi.c:298
void usart_spi_read_single(Usart *p_usart, uint8_t *data)
Receive one byte from an SPI device using USART in SPI mode.
Definition: usart_spi.c:184
void usart_spi_deselect_device(Usart *p_usart, struct usart_spi_device *device)
De-select the given device on the SPI bus.
Definition: usart_spi.c:246
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...
Definition: usart_spi.c:262


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:58