Retarget IO API Reference

group group_board_libs

Defines

CY_RETARGET_IO_BAUDRATE

UART baud rate.

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.

Functions

cy_rslt_t cy_retarget_io_init(cyhal_gpio_t tx, cyhal_gpio_t rx, uint32_t baudrate)

Initialization function for redirecting low level IO commands to allow sending messages over a UART interface.

This will setup the communication interface to allow using printf and related functions.

In an RTOS environment, this function must be called after the RTOS has been initialized.

Return

CY_RSLT_SUCCESS if successfully initialized, else an error about what went wrong

Parameters
  • tx: UART TX pin

  • rx: UART RX pin

  • baudrate: UART baudrate

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.

Variables

cyhal_uart_t cy_retarget_io_uart_obj

UART HAL object used by this library.