diff --git a/Usb.h b/Usb.h index c27796d2..d9e0763a 100644 --- a/Usb.h +++ b/Usb.h @@ -18,10 +18,8 @@ e-mail : support@circuitsathome.com #ifndef _usb_h_ #define _usb_h_ - //#define BOARD_BLACK_WIDDOW - #define USB_METHODS_INLINE #include @@ -39,12 +37,8 @@ e-mail : support@circuitsathome.com #else #include #endif - -#include "printhex.h" -#include "hexdump.h" #include "message.h" -extern int UsbDEBUGlvl; /* shield pins. First parameter - SS pin, second parameter - INT pin */ #ifdef BOARD_BLACK_WIDDOW diff --git a/confdescparser.h b/confdescparser.h index c446b05e..3ff89315 100644 --- a/confdescparser.h +++ b/confdescparser.h @@ -20,8 +20,6 @@ e-mail : support@circuitsathome.com #include #include -#include "printhex.h" -#include "hexdump.h" #include "message.h" #include "parsetools.h" diff --git a/hexdump.h b/hexdump.h index 7328d6e5..9f9dc339 100644 --- a/hexdump.h +++ b/hexdump.h @@ -19,7 +19,6 @@ e-mail : support@circuitsathome.com #include #include -#include "printhex.h" template class HexDumper : public BASE_CLASS { @@ -41,19 +40,23 @@ public: template void HexDumper::Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset) { - for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) { - if(!byteCount) { - SerialPrintHex (byteTotal); - Serial.print(": "); - } - SerialPrintHex (pbuf[j]); - Serial.print(" "); +#ifdef DEBUG + if(UsbDEBUGlvl >= 0x80) { // Fully bypass this block of code if we do not debug. + for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) { + if(!byteCount) { + PrintHex (byteTotal, 0x80); + Notify(PSTR(": "), 0x80); + } + PrintHex (pbuf[j], 0x80); + Notify(PSTR(" "), 0x80); - if(byteCount == 15) { - Serial.println(""); - byteCount = 0xFF; + if(byteCount == 15) { + Notify(PSTR("\r\n"), 0x80); + byteCount = 0xFF; + } } } +#endif } -#endif // __HEXDUMP_H__ \ No newline at end of file +#endif // __HEXDUMP_H__ diff --git a/masstorage.cpp b/masstorage.cpp index 82ac80c3..3e8050aa 100644 --- a/masstorage.cpp +++ b/masstorage.cpp @@ -1,5 +1,5 @@ -#include "message.h" #include "masstorage.h" + const uint8_t BulkOnly::epDataInIndex = 1; const uint8_t BulkOnly::epDataOutIndex = 2; const uint8_t BulkOnly::epInterruptInIndex = 3; diff --git a/masstorage.h b/masstorage.h index c30f4ae6..82a8abf0 100644 --- a/masstorage.h +++ b/masstorage.h @@ -1,6 +1,8 @@ #if !defined(__MASSTORAGE_H__) #define __MASSTORAGE_H__ +#define DEBUG + #include #include "avrpins.h" #include @@ -15,10 +17,6 @@ #include #endif -#include "printhex.h" -#include "hexdump.h" -#include "message.h" - #include #define SWAP(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b))) diff --git a/message.cpp b/message.cpp index 57cf4d10..9a5395ea 100644 --- a/message.cpp +++ b/message.cpp @@ -14,6 +14,8 @@ Circuits At Home, LTD Web : http://www.circuitsathome.com e-mail : support@circuitsathome.com */ + +#define DEBUG #include "message.h" // 0x80 is the default (i.e. trace) to turn off set this global to something lower. // this allows for 126 other debugging levels. @@ -46,7 +48,6 @@ void NotifyStr(char const * msg, int lvl) { while (c = *msg++) Notifyc(c, lvl); } -#ifdef DEBUG void NotifyFailGetDevDescr(void) { Notify(PSTR("\r\ngetDevDescr"), 0x80); } @@ -58,7 +59,7 @@ void NotifyFailGetConfDescr(void) { Notify(PSTR("\r\ngetConf"), 0x80); } -void NotifyFailSetConf(void) { +void NotifyFailSetConfDescr(void) { Notify(PSTR("\r\nsetConf"), 0x80); } @@ -73,4 +74,3 @@ void NotifyFail(uint8_t rcode) { PrintHex (rcode, 0x80); Notify(PSTR("\r\n"), 0x80); } -#endif diff --git a/message.h b/message.h index 53ac7eb9..02a503ac 100644 --- a/message.h +++ b/message.h @@ -20,6 +20,10 @@ e-mail : support@circuitsathome.com #include #include +extern int UsbDEBUGlvl; + +#include "printhex.h" + void Notify(char const * msg, int lvl); void NotifyStr(char const * msg, int lvl); #ifdef DEBUG @@ -37,9 +41,6 @@ void NotifyFail(uint8_t rcode); #define NotifyFailUnknownDevice(VID, PID) #define NotifyFail(rcode) #endif -extern int UsbDEBUGlvl; - -#include "printhex.h" template void ErrorMessage(char const * msg, ERROR_TYPE rcode = 0) { @@ -49,5 +50,6 @@ void ErrorMessage(char const * msg, ERROR_TYPE rcode = 0) { Notify(PSTR("\r\n"), 0x80); } +#include "hexdump.h" #endif // __MESSAGE_H__