1 /***************************************************************************//** 2 * \file cy_retarget_io.h 3 * 4 * \brief 5 * Provides APIs for transmitting messages to or from the board via standard 6 * printf/scanf functions. Messages are transmitted over a UART connection which 7 * is generally connected to a host machine. Transmission is done at 115200 baud 8 * using the tx and rx pins provided by the user of this library. The UART 9 * instance is made available via cy_retarget_io_uart_obj in case any changes 10 * to the default configuration are desired. 11 * NOTE: If the application is built using newlib-nano, by default, floating 12 * point format strings (%f) are not supported. To enable this support you must 13 * add '-u _printf_float' to the linker command line. 14 * 15 ******************************************************************************** 16 * \copyright 17 * Copyright 2018-2019 Cypress Semiconductor Corporation 18 * SPDX-License-Identifier: Apache-2.0 19 * 20 * Licensed under the Apache License, Version 2.0 (the "License"); 21 * you may not use this file except in compliance with the License. 22 * You may obtain a copy of the License at 23 * 24 * http://www.apache.org/licenses/LICENSE-2.0 25 * 26 * Unless required by applicable law or agreed to in writing, software 27 * distributed under the License is distributed on an "AS IS" BASIS, 28 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 * See the License for the specific language governing permissions and 30 * limitations under the License. 31 *******************************************************************************/ 32 33 #pragma once 34 35 #include <stdio.h> 36 #include "cy_result.h" 37 #include "cy_pdl.h" 38 39 #if defined(__cplusplus) 40 extern "C" { 41 #endif 42 43 /** UART baud rate */ 44 #define CY_RETARGET_IO_BAUDRATE (115200) 45 46 /** Defining this macro enables conversion of line feed (LF) into carriage 47 * return followed by line feed (CR & LF) on the output direction (STDOUT). You 48 * can define this macro through the DEFINES variable in the application 49 * Makefile. 50 */ 51 #define CY_RETARGET_IO_CONVERT_LF_TO_CRLF 52 53 cy_rslt_t cy_retarget_io_pdl_init(uint32_t baudrate); 54 55 void cy_retarget_io_wait_tx_complete(CySCB_Type *base, uint32_t tries_count); 56 57 void cy_retarget_io_pdl_deinit(void); 58 59 #if defined(__cplusplus) 60 } 61 #endif 62 63