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.
w5200debug.cpp
00001 // w5200debug.cpp 2013/3/24 00002 #include "mbed.h" 00003 #include <ctype.h> 00004 00005 void print_bytes(FILE* stream, char* s, uint8_t* buf, int len) 00006 { 00007 fprintf(stream, "%s %d:", s, len); 00008 for(int i = 0; i < len; i++) { 00009 fprintf(stream, " %02X", buf[i]); 00010 } 00011 fprintf(stream, "\n"); 00012 } 00013 00014 void print_str(FILE* stream, uint8_t* buf, int len) 00015 { 00016 fprintf(stream, "%p %d:", buf, len); 00017 for(int i = 0; i < len; i++) { 00018 fprintf(stream, " %02X", buf[i]); 00019 } 00020 fprintf(stream, " : "); 00021 for(int i = 0; i < len; i++) { 00022 char c = buf[i]; 00023 if (!isprint(c)) { 00024 c = '.'; 00025 } 00026 fprintf(stream, "%c", c); 00027 } 00028 fprintf(stream, "\n"); 00029 } 00030 00031 void print_hex(FILE* stream, uint8_t* p, int len) 00032 { 00033 for(int i = 0; i < len; i++) { 00034 if (i%16 == 0) { 00035 fprintf(stream, "%p:", p); 00036 } 00037 fprintf(stream, " %02X", *p); 00038 p++; 00039 if (i%16 == 15) { 00040 fprintf(stream, "\n"); 00041 } 00042 } 00043 fprintf(stream, "\n"); 00044 }
Generated on Tue Jul 12 2022 13:04:15 by
1.7.2