HARMcksL: ARM HAL toolbox (yet STM32 oriented) 1.6
SMFSW collection of HAL hacks for STM32
Loading...
Searching...
No Matches
UART_term.c File Reference

UART terminal. More...

#include <stdio.h>
#include "sarmfsw.h"
#include "stdream_rdir.h"
#include "UART_term.h"
Include dependency graph for UART_term.c:

Functions

FctERR UART_Term_Init (UART_HandleTypeDef *const huart, const size_t len)
 Initialize UART terminal.
 
FctERR UART_Term_Launch_It_Rx (UART_HandleTypeDef *const huart)
 Start UART SERIAL DEBUG Rx interruptions.
 
FctERR UART_Term_Wait_Ready (UART_HandleTypeDef *const huart)
 Waiting for UART global state to be ready for next transmission.
 
FctERR UART_Term_Flush_RxBuf (UART_HandleTypeDef *const huart)
 Clear buffer in used for SERIAL DEBUG.
 
FctERR UART_Term_Send (UART_HandleTypeDef *const huart, const char *str, const size_t len)
 Sends string to UART.
 
FctERR UART_Term_Message_Handler (const char *msg, const size_t len)
 Treat fully received message.
 
void UART_Term_RxCpltCallback (UART_HandleTypeDef *const huart)
 UART Term Rx Transfer completed callback.
 
void HAL_UART_RxCpltCallback (UART_HandleTypeDef *huart)
 Rx Transfer completed callback.
 

Variables

char breakout_char = '!'
 breakout char (message complete)
 
UART_HandleTypeDef * dbg_uart
 Instance of UART debug terminal.
 

Detailed Description

UART terminal.

Author
SMFSW
Note
UART redirection is enabled when UART_REDIRECT symbol is defined at project level
define DBG_SERIAL at project level with an UART instance to send printf likes strings to UART
It is recommended to have interrupts enabled for UART instance (and is required when reception is needed)

Function Documentation

◆ HAL_UART_RxCpltCallback()

void HAL_UART_RxCpltCallback ( UART_HandleTypeDef * huart)

Rx Transfer completed callback.

Weak Functions
Weak implementation of HAL_UART_RxCpltCallback in the library (will get precedence over HAL function)
Warning
You should probably implement your own callback, especially with multiple UART busses
Parameters
[in,out]huart- UART handle
Here is the call graph for this function:

◆ UART_Term_Flush_RxBuf()

FctERR UART_Term_Flush_RxBuf ( UART_HandleTypeDef *const huart)

Clear buffer in used for SERIAL DEBUG.

Parameters
[in]huart- UART handle
Returns
FctERR - Error code
Here is the caller graph for this function:

◆ UART_Term_Init()

FctERR UART_Term_Init ( UART_HandleTypeDef *const huart,
const size_t len )

Initialize UART terminal.

Parameters
[in]huart- UART handle
[in]len- buffer length
Returns
FctERR - Error code
Here is the call graph for this function:

◆ UART_Term_Launch_It_Rx()

FctERR UART_Term_Launch_It_Rx ( UART_HandleTypeDef *const huart)

Start UART SERIAL DEBUG Rx interruptions.

Parameters
[in]huart- UART handle
Returns
FctERR - Error code
Here is the caller graph for this function:

◆ UART_Term_Message_Handler()

FctERR UART_Term_Message_Handler ( const char * msg,
const size_t len )

Treat fully received message.

Weak Functions
This function is implemented as weak to be implemented in projects (weak one only prints & flushes the buffer)
Parameters
[in]msg- pointer to received message
[in]len- received message length
Returns
FctERR - Error code

◆ UART_Term_RxCpltCallback()

void UART_Term_RxCpltCallback ( UART_HandleTypeDef *const huart)

UART Term Rx Transfer completed callback.

Note
Can be used with callback registering CubeMX functionality
Warning
When not using callback registering CubeMX functionality, you may need to implement your own custom HAL_UART_RxCpltCallback weak HAL_UART_RxCpltCallback is defined in the library (handle for debug UART only), you may have to define your own when multiple UARTs are in use.
Parameters
[in,out]huart- UART handle
Note
Shall be called from HAL_UART_RxCpltCallback with proper UART instance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UART_Term_Send()

FctERR UART_Term_Send ( UART_HandleTypeDef *const huart,
const char * str,
const size_t len )

Sends string to UART.

Parameters
[in]huart- UART handle
[in]str- pointer to string to send
[in]len- length of string
Returns
FctERR - Error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UART_Term_Wait_Ready()

FctERR UART_Term_Wait_Ready ( UART_HandleTypeDef *const huart)

Waiting for UART global state to be ready for next transmission.

Parameters
[in]huart- UART handle
Returns
FctERR - Error code
Here is the caller graph for this function:

Variable Documentation

◆ breakout_char

char breakout_char = '!'

breakout char (message complete)

Note
Default user breakout char set to '!' and '\r' is built-in default breakout char

◆ dbg_uart

UART_HandleTypeDef* dbg_uart

Instance of UART debug terminal.

UART debug terminal instance.