Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: WncControllerK64F
Fork of WNC14A2AInterface by
WNCDebug.h
00001 00002 #ifndef __WNCDEBUG__ 00003 #define __WNCDEBUG__ 00004 #include <stdio.h> 00005 #include "BufferedSerial.h" 00006 00007 00008 class WNCDebug 00009 { 00010 public: 00011 WNCDebug( FILE * fd = stderr ): m_puart(NULL) {m_stdiofp=fd;}; 00012 WNCDebug( BufferedSerial * uart): m_stdiofp(NULL) {m_puart=uart;}; 00013 ~WNCDebug() {}; 00014 00015 int printf( char * fmt, ...) { 00016 char buffer[256]; 00017 int ret=0; 00018 va_list args; 00019 va_start (args, fmt); 00020 vsnprintf(buffer, sizeof(buffer), fmt, args); 00021 if( m_stdiofp ) 00022 ret=fputs(buffer,m_stdiofp); 00023 else 00024 ret=m_puart->puts(buffer); 00025 va_end (args); 00026 return ret; 00027 } 00028 00029 int putc( int c ) { 00030 int ret=0; 00031 if( m_stdiofp ) 00032 ret=fputc(c, m_stdiofp); 00033 else 00034 ret=m_puart->putc(c); 00035 return ret; 00036 } 00037 00038 int puts( const char * str ) { 00039 int ret=0; 00040 if( m_stdiofp ) 00041 ret=fputs(str,m_stdiofp); 00042 else 00043 ret=m_puart->puts(str); 00044 return ret; 00045 } 00046 00047 private: 00048 std::FILE *m_stdiofp; 00049 BufferedSerial *m_puart; 00050 }; 00051 #endif
Generated on Mon Jul 18 2022 19:16:45 by
1.7.2
