|
GPS Device
|
Public functions to interact with the USART peripheral. More...

Functions | |
| void | usart_init (USART_CFG_ts *usart_cfg) |
| Initializes the USART peripheral with the given configuration. | |
| void | usart_deinit (USART_REGDEF_ts const *usart_instance) |
| Deinitializes the USART peripheral, disables its NVIC interrupt, and disables its clock. | |
| 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_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_set_transmission (USART_REGDEF_ts *usart_instance, EN_STATUS_te en_status) |
| Enables or disables the USART transmitter (TE bit). | |
| void | usart_set_reception (USART_REGDEF_ts *usart_instance, EN_STATUS_te en_status) |
| Enables or disables the USART receiver (RE bit). | |
| 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 | usart1_irq_data_recv_callback (uint8_t data) |
| RXNE callback for USART1. Called by USART1_IRQHandler on each received byte. | |
| void | usart6_irq_data_recv_callback (uint8_t data) |
| RXNE callback for USART6. Called by USART6_IRQHandler on each received byte. | |
Public functions to interact with the USART peripheral.
| void usart_init | ( | USART_CFG_ts * | usart_cfg | ) |
Initializes the USART peripheral with the given configuration.
Enables the peripheral clock, configures the frame format, baud rate, oversampling, parity, hardware flow control, sample method, and (if requested) the RXNE interrupt and NVIC line. Enables the peripheral (UE = 1) at the end. TX and RX must be enabled separately via usart_set_transmission and usart_set_reception.
| [in] | usart_cfg | Pointer to the USART configuration structure. |
Definition at line 28 of file stm32f401re_usart.c.


| void usart_deinit | ( | USART_REGDEF_ts const * | instance | ) |
Deinitializes the USART peripheral, disables its NVIC interrupt, and disables its clock.
| [in] | usart_instance | Pointer to the USART instance to deinitialize. |
Definition at line 93 of file stm32f401re_usart.c.


| void usart_send | ( | USART_REGDEF_ts * | instance, |
| uint8_t * | tx_buffer, | ||
| uint32_t | len ) |
Blocking USART transmit. Sends len bytes from tx_buffer.
Polls TXE before writing each byte, then waits for TC (transmission complete) after the last byte before returning.
| [in] | usart_instance | Pointer to the USART peripheral instance. |
| [in] | tx_buffer | Pointer to the transmit data buffer. |
| [in] | len | Number of bytes to transmit. |
Blocking USART transmit. Sends len bytes from tx_buffer.
Definition at line 111 of file stm32f401re_usart.c.

| void usart_receive | ( | USART_REGDEF_ts const * | instance, |
| uint8_t * | rx_buffer, | ||
| uint32_t | len ) |
Blocking USART receive. Reads len bytes into rx_buffer.
Polls RXNE before reading each byte from the data register. Do not use alongside interrupt-driven reception on the same instance, as both compete to read USART_DR.
| [in] | usart_instance | Pointer to the USART peripheral instance. |
| [out] | rx_buffer | Pointer to the receive data buffer. |
| [in] | len | Number of bytes to receive. |
Blocking USART receive. Reads len bytes into rx_buffer.
Definition at line 123 of file stm32f401re_usart.c.
| void usart_set_transmission | ( | USART_REGDEF_ts * | instance, |
| EN_STATUS_te | en_status ) |
Enables or disables the USART transmitter (TE bit).
| [in] | usart_instance | Pointer to the USART peripheral instance. |
| [in] | en_status | ENABLE to enable TX, DISABLE to disable it. |
Enables or disables the USART transmitter (TE bit).
Definition at line 133 of file stm32f401re_usart.c.

| void usart_set_reception | ( | USART_REGDEF_ts * | instance, |
| EN_STATUS_te | en_status ) |
Enables or disables the USART receiver (RE bit).
| [in] | usart_instance | Pointer to the USART peripheral instance. |
| [in] | en_status | ENABLE to enable RX, DISABLE to disable it. |
Enables or disables the USART receiver (RE bit).
Definition at line 139 of file stm32f401re_usart.c.

| void usart_get_name | ( | USART_REGDEF_ts const * | instance, |
| char * | name ) |
Returns the name string of a USART peripheral instance (e.g. "USART1").
The caller must ensure name points to a buffer of at least USART_NAME_LEN + 1 bytes.
| [in] | usart_instance | Pointer to the USART peripheral instance. |
| [out] | name | Pointer to the destination buffer. |
Returns the name string of a USART peripheral instance (e.g. "USART1").
Definition at line 145 of file stm32f401re_usart.c.

| void usart1_irq_data_recv_callback | ( | uint8_t | data | ) |
RXNE callback for USART1. Called by USART1_IRQHandler on each received byte.
Defined as a weak alias. Override in application code to handle received bytes (e.g. write to a circular buffer as done in console.c). The default implementation spins in an infinite loop.
| [in] | data | The byte received from USART1_DR. |
RXNE callback for USART1. Called by USART1_IRQHandler on each received byte.
Spins in an infinite loop if no application-level override is provided. Override this function in application code to handle received bytes.
RXNE callback for USART1. Called by USART1_IRQHandler on each received byte.
Called automatically by the USART1 interrupt handler on each received byte. Writes data directly into the internal USART circular buffer for later processing by console_run.
| [in] | data | The byte received from the USART RX register. |
Definition at line 226 of file console.c.


| void usart6_irq_data_recv_callback | ( | uint8_t | data | ) |
RXNE callback for USART6. Called by USART6_IRQHandler on each received byte.
Defined as a weak alias. Override in application code to handle received bytes (e.g. write to a circular buffer as done in neo6.c). The default implementation spins in an infinite loop.
| [in] | data | The byte received from USART6_DR. |
RXNE callback for USART6. Called by USART6_IRQHandler on each received byte.
Spins in an infinite loop if no application-level override is provided. Override this function in application code to handle received bytes.
RXNE callback for USART6. Called by USART6_IRQHandler on each received byte.
Called automatically by the USART6 interrupt handler on each received byte. Writes data directly into the internal USART circular buffer for later processing by neo6_run.
| [in] | data | The byte received from the USART RX register. |
Definition at line 908 of file neo6.c.

