Macros | |
#define | CY_RETARGET_IO_RSLT_NULL_UART_PTR (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_LIB_RETARGET_IO, 0)) |
A null pointer was passed as a function parameter. | |
#define | CY_RETARGET_IO_BAUDRATE (115200) |
UART baud rate. | |
#define | CY_RETARGET_IO_CONVERT_LF_TO_CRLF |
Defining this macro enables conversion of line feed (LF) into carriage return followed by line feed (CR & LF) on the output direction (STDOUT). More... | |
Functions | |
cy_rslt_t | cy_retarget_io_init (CySCB_Type *uart) |
UART HAL object used by this library. More... | |
bool | cy_retarget_io_is_tx_active (void) |
Checks whether there is data waiting to be written to the serial console. More... | |
void | cy_retarget_io_deinit (void) |
Releases the UART interface allowing it to be used for other purposes. More... | |
#define CY_RETARGET_IO_CONVERT_LF_TO_CRLF |
Defining this macro enables conversion of line feed (LF) into carriage return followed by line feed (CR & LF) on the output direction (STDOUT).
You can define this macro through the DEFINES variable in the application Makefile.
cy_rslt_t cy_retarget_io_init | ( | CySCB_Type * | uart | ) |
UART HAL object used by this library.
defined(COMPONENT_MTB_HAL)
Initialization function for redirecting low level IO commands to allow sending messages over a UART interface with a configurator generated configuration struct. This will setup the communication interface to allow using printf and related functions.
This function assumes that you've already 1) initialized, and 2) enabled the UART instance using PDL function calls.
When not using the HAL, retarget-io is not thread safe. Consider using printf from a single thread or using a mutex to protect the printf calls.
uart | Pointer to UART object, usually named and defined in device-configurator. |
bool cy_retarget_io_is_tx_active | ( | void | ) |
Checks whether there is data waiting to be written to the serial console.
void cy_retarget_io_deinit | ( | void | ) |
Releases the UART interface allowing it to be used for other purposes.
After calling this, printf and related functions will no longer work.