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.
Fork of CNManager by
CNUtil.cpp
00001 #include "CNUtil.h" 00002 #include <stdarg.h> 00003 00004 static int _debugLevel = 1; 00005 00006 int getUtilDebugLevel(){ 00007 return _debugLevel; 00008 } 00009 bool setUtilDebugLevel(int level){ 00010 #ifdef CN_DEBUG 00011 if ((_debugLevel >= -1) && (level >= -1) && 00012 (_debugLevel <= 3) && (level <= 3)) { 00013 _debugLevel = level; 00014 return true; 00015 } 00016 #endif 00017 return false; 00018 } 00019 00020 void debugPrint(int level, const char* color, const char* format, ...) 00021 { 00022 #ifdef CN_DEBUG 00023 if (_debugLevel >= level) 00024 { 00025 va_list args; 00026 va_start (args, format); 00027 if (color) ::printf(color); 00028 ::vprintf(format, args); 00029 if (color) ::printf(DEF); 00030 va_end (args); 00031 } 00032 #endif 00033 } 00034 00035 void CNTimer::start() { 00036 if (_counter++ == 0) Timer::start(); 00037 else Timer::reset(); 00038 } 00039 bool CNTimer::isExpired(){ 00040 if (Timer::read_ms() > _timeout) { 00041 Timer::reset(); 00042 return true; 00043 } 00044 else return false; 00045 }
Generated on Fri Jul 15 2022 21:42:35 by
1.7.2
