UART interface from which external peripherals inherit.
More...
|
UART_t | UART_init (USART_TypeDef *interface, uint32_t baud, UART_Config *config) |
| Initialiser for a UART device interface.
|
|
void | UART_updateConfig (UART_t *, UART_Config *) |
| Update UART peripheral configuration.
|
|
void | UART_send (UART_t *, uint8_t data) |
| Sends a single byte of data over the UART interface.
|
|
void | UART_sendBytes (UART_t *, uint8_t *data, int length) |
| Sends an array of bytes over the UART interface.
|
|
void | UART_print (UART_t *, char *data) |
| Sends a null terminated string over the UART interface.
|
|
void | UART_println (UART_t *, char *data) |
| Sends a null terminated string over the UART interface. Terminates with a line feed control character \n .
|
|
uint8_t | UART_receive (UART_t *) |
| Receives a single byte of data from the UART interface.
|
|
UART interface from which external peripherals inherit.
◆ UART_Config
Definition at line 110 of file uart.h.
Data Fields |
bool |
SBK: 1 |
| (default ) |
UART_ReceiverWake |
RWU: 1 |
| (default ) |
bool |
RE: 1 |
| (default ) |
bool |
TE: 1 |
| (default ) |
bool |
IDLEIE: 1 |
| (default ) |
bool |
RXNEIE: 1 |
| (default ) |
bool |
TCIE: 1 |
| (default ) |
bool |
TXEIE: 1 |
| (default ) |
bool |
PEIE: 1 |
| (default ) |
UART_ParitySelect |
PS: 1 |
| (default ) |
bool |
PCE: 1 |
| (default ) |
UART_Wake |
WAKE: 1 |
| (default ) |
UART_WordLength |
M: 1 |
| (default ) |
bool |
UE: 1 |
| (default ) |
unsigned |
int: 1 |
RESERVED. |
UART_OversampleMode |
OVER8: 1 |
| (default ) |
◆ UART_t
Struct definition for UART interface.
Definition at line 132 of file uart.h.
Data Fields |
USART_TypeDef * |
interface |
|
UART_Config |
config |
|
uint32_t |
baud |
|
UART_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
|
void(*)(struct UART *, char *) |
println |
UART print line method. - See also
- UART_print
|
uint8_t(*)(struct UART *) |
receive |
UART receive method. - See also
- UART_receive
|
◆ UART_OversampleMode
UART oversampling mode enum.
Describes the number of bits to use in oversampling
Definition at line 69 of file uart.h.
◆ UART_WordLength
UART word length enum.
Describes the number of bits to use in data word
Definition at line 78 of file uart.h.
◆ UART_Wake
UART wake up method enum.
Describes
Definition at line 87 of file uart.h.
◆ UART_ParitySelect
UART parity selection enum.
Describes odd/even parity type when parity is enabled
Definition at line 96 of file uart.h.
◆ UART_ReceiverWake
UART receiver wake up enum.
Describes if the UART is in mute mode or not
Definition at line 105 of file uart.h.
◆ UART_init()
Initialiser for a UART device interface.
- Parameters
-
*interface | Pointer to UART interface struct. |
baud | UART baud rate. |
*config | Pointer to UART configuration struct. |
- Returns
- Initialised
UART_t
driver struct.
Definition at line 27 of file uart.c.
◆ UART_updateConfig()
Update UART peripheral configuration.
Uses the provided configuration to update the UART registers and resets the associated peripheral. As with initialisation, passing NULL
will set the default config.
- Parameters
-
- Returns
NULL
.
Definition at line 207 of file uart.c.
◆ UART_send()
void UART_send |
( |
UART_t * | 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 127 of file uart.c.
◆ UART_sendBytes()
void UART_sendBytes |
( |
UART_t * | 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 144 of file uart.c.
◆ UART_print()
void UART_print |
( |
UART_t * | uart, |
|
|
char * | data ) |
Sends a null terminated string 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 159 of file uart.c.
◆ UART_println()
void UART_println |
( |
UART_t * | uart, |
|
|
char * | data ) |
Sends a null terminated string over the UART interface. Terminates with a line feed control character \n
.
- Parameters
-
*uart | Pointer to UART struct. |
*data | Pointer to the string of characters to be sent. |
- Returns
NULL
.
Definition at line 176 of file uart.c.
◆ UART_receive()
uint8_t UART_receive |
( |
UART_t * | 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 189 of file uart.c.