14#include "stm32f439xx.h"
16#define UART_PARITY_DISABLE 0x400
17#define UART_SYNC_DISABLE 0xE00
18#define UART_FLOW_DISABLE 0x300
19#define UART_ENABLE 0x2000
20#define UART_RX_ENABLE 0x0004
21#define UART_TX_ENABLE 0x0008
25#define UART_CR1_RESERVED (0x01 << 14)
31#define CARRIAGE_RETURN 0x0D
32#define SUBSTITUTE 0x1A
40#define UART_CONFIG_DEFAULT \
42 .OVER8 = UART_OVER8, \
44 .WAKE = UART_WAKEUP_IDLE, \
46 .PS = UART_PARITY_EVEN, \
54 .RWU = UART_RECEIVER_ACTIVE \
106 UART_RECEIVER_ACTIVE,
133 USART_TypeDef *interface;
137 void (*setBaud)(
struct UART *, uint32_t);
138 void (*
send)(
struct UART *, uint8_t);
140 void (*
print)(
struct UART *,
char *);
148void UART_setBaud(
UART_t *, uint32_t);
void(* print)(struct UART *, char *)
UART print string method.
void(* sendBytes)(struct UART *, uint8_t *, int)
UART send multiple bytes method.
void(* send)(struct UART *, uint8_t)
UART send method.
UART_WordLength M
| (default )
UART_OversampleMode OVER8
| (default )
uint8_t(* receive)(struct UART *)
UART receive method.
void(* println)(struct UART *, char *)
UART print line method.
UART_ReceiverWake RWU
| (default )
UART_Wake WAKE
| (default )
UART_ParitySelect PS
| (default )
void UART_send(UART_t *, uint8_t data)
Sends a single byte of data over the UART interface.
UART_ReceiverWake
UART receiver wake up enum.
void UART_updateConfig(UART_t *, UART_Config *)
Update UART peripheral configuration.
UART_ParitySelect
UART parity selection enum.
UART_OversampleMode
UART oversampling mode enum.
void UART_sendBytes(UART_t *, uint8_t *data, int length)
Sends an array of bytes over the UART interface.
UART_WordLength
UART word length enum.
uint8_t UART_receive(UART_t *)
Receives a single byte of data from the UART interface.
UART_t UART_init(USART_TypeDef *interface, uint32_t baud, UART_Config *config)
Initialiser for a UART device 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...
UART_Wake
UART wake up method enum.
Struct definition for UART interface.