GPS Device
Loading...
Searching...
No Matches
stm32f401re_usart.h
Go to the documentation of this file.
1
32
38
39#ifndef STM32F401RE_USART_H__
40#define STM32F401RE_USART_H__
41
42#include "stm32f401re.h"
43#include "common.h"
44
51
53#define USART_NAME_LEN 6
54
64
72typedef enum {
73 USART_BAUD_RATE_1200 = 1200,
74 USART_BAUD_RATE_2400 = 2400,
75 USART_BAUD_RATE_9600 = 9600,
76 USART_BAUD_RATE_19200 = 19200,
77 USART_BAUD_RATE_38400 = 38400,
78 USART_BAUD_RATE_57600 = 57600,
79 USART_BAUD_RATE_115200 = 115200,
80 USART_BAUD_RATE_230400 = 230400,
81 USART_BAUD_RATE_460800 = 460800,
82 USART_BAUD_RATE_921600 = 921600,
83 USART_BAUD_RATE_2000000 = 2000000,
84 USART_BAUD_RATE_3000000 = 3000000
86
95
103
115
125
133
141
149
191
193
200
213void usart_init(USART_CFG_ts *usart_cfg);
214
220void usart_deinit(USART_REGDEF_ts const *usart_instance);
221
236void usart_send(USART_REGDEF_ts *usart_instance, uint8_t *tx_buffer, uint32_t len);
237
250void usart_receive(USART_REGDEF_ts const *usart_instance, uint8_t *rx_buffer, uint32_t len);
251
258void usart_set_transmission(USART_REGDEF_ts *usart_instance, EN_STATUS_te en_status);
259
266void usart_set_reception(USART_REGDEF_ts *usart_instance, EN_STATUS_te en_status);
267
278void usart_get_name(USART_REGDEF_ts const *usart_instance, char *name);
279
292void usart1_irq_data_recv_callback(uint8_t data);
293
306void usart6_irq_data_recv_callback(uint8_t data);
307
309
310#endif
311
Common utility module public API.
EN_STATUS_te
Represents an enabled or disabled state.
Definition common.h:95
void usart_deinit(USART_REGDEF_ts const *usart_instance)
Deinitializes the USART peripheral, disables its NVIC interrupt, and disables its clock.
void usart6_irq_data_recv_callback(uint8_t data)
RXNE callback for USART6. Called by USART6_IRQHandler on each received byte.
Definition neo6.c:908
void usart_receive(USART_REGDEF_ts const *usart_instance, uint8_t *rx_buffer, uint32_t len)
Blocking USART receive. Reads len bytes into rx_buffer.
void usart_init(USART_CFG_ts *usart_cfg)
Initializes the USART peripheral with the given configuration.
void usart_set_reception(USART_REGDEF_ts *usart_instance, EN_STATUS_te en_status)
Enables or disables the USART receiver (RE bit).
void usart1_irq_data_recv_callback(uint8_t data)
RXNE callback for USART1. Called by USART1_IRQHandler on each received byte.
Definition console.c:226
void usart_get_name(USART_REGDEF_ts const *usart_instance, char *name)
Returns the name string of a USART peripheral instance (e.g. "USART1").
void usart_send(USART_REGDEF_ts *usart_instance, uint8_t *tx_buffer, uint32_t len)
Blocking USART transmit. Sends len bytes from tx_buffer.
void usart_set_transmission(USART_REGDEF_ts *usart_instance, EN_STATUS_te en_status)
Enables or disables the USART transmitter (TE bit).
USART_MODE_te
USART operating mode.
USART_FRAME_STOP_BITS_te
USART number of stop bits.
USART_BAUD_RATE_te
USART baud rate in bits per second.
USART_SAMPLE_BIT_te
USART receiver sample bit method.
USART_OVERSAMPLING_te
USART oversampling ratio.
USART_HW_FLOW_CONTROL_te
USART hardware flow control (RTS/CTS).
USART_FRAME_DATA_BITS_te
USART data word length.
USART_PARITY_te
USART parity bit configuration.
USART_INTERRUPT_EN_te
USART RXNE interrupt enable configuration.
@ USART_MODE_ASYNC
@ USART_MODE_SYNC
@ USART_FRAME_STOP_BITS_1_5
@ USART_FRAME_STOP_BITS_1
@ USART_FRAME_STOP_BITS_0_5
@ USART_FRAME_STOP_BITS_2
@ USART_SAMPLE_BIT_3
@ USART_SAMPLE_BIT_1
@ USART_OVERSAMPLING_16
@ USART_OVERSAMPLING_8
@ USART_HW_FLOW_CONTROL_ENABLED
@ USART_HW_FLOW_CONTROL_DISABLED
@ USART_FRAME_DATA_BITS_8
@ USART_FRAME_DATA_BITS_9
@ USART_PARITY_ODD
@ USART_PARITY_DISABLED
@ USART_PARITY_EVEN
@ USART_INTERRUPT_EN_TRUE
@ USART_INTERRUPT_EN_FALSE
STM32F401RE MCU-specific peripheral register definitions and bit position enumerations.
Configuration structure for initializing a USART peripheral.
USART_OVERSAMPLING_te oversampling
USART_BAUD_RATE_te baud_rate
USART_SAMPLE_BIT_te sample_bit
USART_REGDEF_ts * instance
USART_FRAME_STOP_BITS_te frame_stop_bits
USART_HW_FLOW_CONTROL_te hw_flow_control
USART_FRAME_DATA_BITS_te frame_data_bits
USART_INTERRUPT_EN_te interrupt_en
USART_MODE_te mode
USART_PARITY_te parity
USART peripheral register map.