1 /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- 2 * 3 * Copyright (c) 2014-2015 Datalight, Inc. 4 * All Rights Reserved Worldwide. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; use version 2 of the License. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty 12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 /* Businesses and individuals that for commercial or other reasons cannot 21 * comply with the terms of the GPLv2 license may obtain a commercial license 22 * before incorporating Reliance Edge into proprietary software for 23 * distribution in any form. Visit http://www.datalight.com/reliance-edge for 24 * more information. 25 */ 26 27 /** @file 28 * @brief Implements outputting a character string. 29 */ 30 #include <redfs.h> 31 32 #if REDCONF_OUTPUT == 1 33 34 #include <redosdeviations.h> 35 36 37 /** @brief Write a string to a user-visible output location. 38 * 39 * Write a null-terminated string to the serial port, console, terminal, or 40 * other display device, such that the text is visible to the user. 41 * 42 * @param pszString A null-terminated string. 43 */ RedOsOutputString(const char * pszString)44 void RedOsOutputString( const char * pszString ) 45 { 46 if( pszString == NULL ) 47 { 48 REDERROR(); 49 } 50 else 51 { 52 uint32_t ulIdx = 0U; 53 54 while( pszString[ ulIdx ] != '\0' ) 55 { 56 OUTPUT_CHARACTER( pszString[ ulIdx ] ); 57 58 /* Serial output often requires a \r to print newlines correctly. 59 */ 60 if( pszString[ ulIdx ] == '\n' ) 61 { 62 OUTPUT_CHARACTER( '\r' ); 63 } 64 65 ulIdx++; 66 } 67 } 68 } 69 70 #endif /* if REDCONF_OUTPUT == 1 */ 71