GAP based TOF Demo
Dependencies: BLE_API X_NUCLEO_6180XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
Diff: bricks/trace.cpp
- Revision:
- 27:32267cee7cb8
- Parent:
- 23:677689000369
--- a/bricks/trace.cpp Sat Jan 07 15:38:15 2017 +0000 +++ b/bricks/trace.cpp Sat Jan 14 08:43:14 2017 +0000 @@ -5,15 +5,22 @@ Serial pc(USBTX, USBRX); // serial port to PC terminal +//============================================================================== +// Managing the Verbose Lewvel +//============================================================================== + static int threshold = 0; // verbose threshold, no verbose messages - void verbose(int level) // setup verbose level + void verbose(O&o, int level) // setup verbose level { threshold = level; // update verbose threshold } - - void trace(int level, const char *msg) // trace a message +//============================================================================== +// Printing Trace Messages +//============================================================================== + + void trace(O&o, int level, const char *msg) // trace a message { if (level <= threshold) // update verbose threshold { char buf[2] = " "; // must be terminated @@ -29,4 +36,18 @@ } } - \ No newline at end of file + void trace(O&o, int level, const char*format, int value) + { + char buf[80]; + if (strlen(format) > 70) + trace(o,level," *** buffer overflow *** "); + else + { sprintf(buf,format,value); + trace(o,level,buf); + } + } + + void traceln(O&o, int level, const char*msg) // trace with CR & LF + { + trace(o,level,msg); trace(o,level,"\r\n"); + }