UART interface from which external peripherals inherit.
More...
|
DeviceHandle_t | UART_init (UART *, char[DEVICE_NAME_LENGTH], USART_TypeDef *, GPIO_TypeDef *, UART_Pins, uint32_t, OversampleMode) |
| Initialiser for a UART device interface.
|
|
void | _UART_setup (UART *, UART_Pins) |
| Configures the UART interface for communication.
|
|
void | UART_send (UART *, uint8_t data) |
| Sends a single byte of data over the UART interface.
|
|
void | UART_sendBytes (UART *, uint8_t *data, int length) |
| Sends an array of bytes over the UART interface.
|
|
void | UART_print (UART *, char *data) |
| Sends a string of characters over the UART interface.
|
|
uint8_t | UART_receive (UART *) |
| Receives a single byte of data from the UART interface.
|
|
UART interface from which external peripherals inherit.
◆ UART_Pins
◆ UART
Struct definition for UART interface.
Definition at line 53 of file uart.h.
Data Fields |
USART_TypeDef * |
interface |
|
GPIO_TypeDef * |
port |
|
UART_Pins |
pins |
|
uint32_t |
baud |
|
OversampleMode |
over8 |
|
void(*)(struct UART *, uint32_t) |
setBaud |
|
void(*)(struct UART *, uint8_t) |
send |
UART send method. - See also
- UART_send
|
void(*)(struct UART *, uint8_t *, int) |
sendBytes |
UART send multiple bytes method. - See also
- UART_sendBytes
|
void(*)(struct UART *, char *) |
print |
UART print string method. - See also
- UART_print
|
uint8_t(*)(struct UART *) |
receive |
UART receive method. - See also
- UART_receive
|
◆ UART_init()
DeviceHandle_t UART_init |
( |
UART * | uart, |
|
|
char | name[DEVICE_NAME_LENGTH], |
|
|
USART_TypeDef * | interface, |
|
|
GPIO_TypeDef * | port, |
|
|
UART_Pins | pins, |
|
|
uint32_t | baud, |
|
|
OversampleMode | over8 ) |
Initialiser for a UART device interface.
- Parameters
-
*uart | Pointer to UART struct to be initialised. |
*interface | Pointer to UART interface struct. |
*port | Pointer to GPIO port struct. |
baud | UART baud rate. |
over8 | Oversampling mode. |
- Returns
NULL
.
Definition at line 26 of file uart.c.
◆ _UART_setup()
Configures the UART interface for communication.
- Parameters
-
*uart | Pointer to UART struct containing configuration parameters. |
- Returns
NULL
.
Definition at line 66 of file uart.c.
◆ UART_send()
void UART_send |
( |
UART * | uart, |
|
|
uint8_t | data ) |
Sends a single byte of data over the UART interface.
- Parameters
-
*uart | Pointer to UART struct. |
data | Byte of data to be sent. |
- Returns
NULL
.
Definition at line 128 of file uart.c.
◆ UART_sendBytes()
void UART_sendBytes |
( |
UART * | uart, |
|
|
uint8_t * | data, |
|
|
int | length ) |
Sends an array of bytes over the UART interface.
- Parameters
-
*uart | Pointer to UART struct. |
*data | Pointer to the array of bytes to be sent. |
length | Number of bytes to send. |
- Returns
NULL
.
Definition at line 145 of file uart.c.
◆ UART_print()
void UART_print |
( |
UART * | uart, |
|
|
char * | data ) |
Sends a string of characters over the UART interface.
- Parameters
-
*uart | Pointer to UART struct. |
*data | Pointer to the string of characters to be sent. |
- Returns
NULL
.
Definition at line 160 of file uart.c.
◆ UART_receive()
uint8_t UART_receive |
( |
UART * | uart | ) |
|
Receives a single byte of data from the UART interface.
- Parameters
-
*uart | Pointer to UART struct. |
- Returns
- The received byte of data.
Definition at line 174 of file uart.c.