Loading...
Searching...
No Matches
Interface

UART interface from which external peripherals inherit. More...

Data Structures

struct  UART_Pins
 
struct  UART
 Struct definition for UART interface. More...
 

Functions

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.
 

Detailed Description

UART interface from which external peripherals inherit.


Data Structure Documentation

◆ UART_Pins

struct UART_Pins

Definition at line 45 of file uart.h.

◆ UART

struct 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

Function Documentation

◆ 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
*uartPointer to UART struct to be initialised.
*interfacePointer to UART interface struct.
*portPointer to GPIO port struct.
baudUART baud rate.
over8Oversampling mode.
Returns
NULL.

Definition at line 26 of file uart.c.

◆ _UART_setup()

void _UART_setup ( UART * uart,
UART_Pins pins )

Configures the UART interface for communication.

Parameters
*uartPointer 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
*uartPointer to UART struct.
dataByte 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
*uartPointer to UART struct.
*dataPointer to the array of bytes to be sent.
lengthNumber 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
*uartPointer to UART struct.
*dataPointer 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
*uartPointer to UART struct.
Returns
The received byte of data.

Definition at line 174 of file uart.c.