cc3000 hostdriver with the mbed socket interface
Fork of cc3000_hostdriver_mbedsocket by
Diff: cc3000.h
- Revision:
- 22:d23c59fec0dc
- Parent:
- 20:30b6ed7bf8fd
- Child:
- 26:456f73ed2a75
diff -r 30b6ed7bf8fd -r d23c59fec0dc cc3000.h --- a/cc3000.h Thu Oct 03 17:15:45 2013 +0200 +++ b/cc3000.h Thu Oct 03 20:56:45 2013 +0000 @@ -51,24 +51,63 @@ #define MAX_SOCKETS 4 -/** Enable debug messages +/** Enable debug messages, comment out the ones you don't want */ -#define CC3000_DEBUG 1 - -#if CC3000_DEBUG == 1 +#define CC3000_DEBUG_SOCKET +#define CC3000_DEBUG_HCI_TX +#define CC3000_DEBUG_HCI_RX +#define CC3000_DEBUG - // DBG_SOCKET, mbed socket specific debug messages - #define DBG_SOCKET(x, ...) std::printf("[CC3000 : SOCKET] "x"\r\n", ##__VA_ARGS__); +// Add color too the debug messages, requires a VT100 terminal like putty, comment out to remove +#define VT100_COLOUR + +#ifdef CC3000_DEBUG_SOCKET - // DBG_HCI, prints a message for every recieved HCI event, quite a lot of debug - #define DBG_HCI(x, ...) std::printf("[CC3000 : HCI] "x"\r\n", ##__VA_ARGS__); - - // DBG_CC, General cc3000 debug messages - #define DBG_CC(x, ...) std::printf("[CC3000] "x"\r\n", ##__VA_ARGS__); + #ifdef VT100_COLOUR + #define DBG_SOCKET(x, ...) std::printf("\x1b[2;32;40m[CC3000 : SOCKET] "x"\x1b[0;37;40m\r\n", ##__VA_ARGS__); + #else + #define DBG_SOCKET(x, ...) std::printf("[CC3000 : SOCKET] "x"\r\n", ##__VA_ARGS__); + #endif + #else #define DBG_SOCKET(x, ...) +#endif + +#ifdef CC3000_DEBUG_HCI_TX + + #ifdef VT100_COLOUR + #define DBG_HCI(x, ...) std::printf("\x1b[2;35;40m[CC3000 : HCI RX] "x"\x1b[0;37;40m\r\n", ##__VA_ARGS__); + #else + #define DBG_HCI(x, ...) std::printf("[CC3000 : HCI RX] "x"\r\n", ##__VA_ARGS__); + #endif + +#else #define DBG_HCI(x, ...) - #define DBG_CC(x, ...) +#endif + +#ifdef CC3000_DEBUG_HCI_RX + + #ifdef VT100_COLOUR + #define DBG_HCI_CMD(x, ...) std::printf("\x1b[2;36;40m[CC3000 : HCI TX] "x"\x1b[0;37;40m\r\n", ##__VA_ARGS__); + #else + #define DBG_HCI_CMD(x, ...) std::printf("[CC3000 : HCI TX] "x"\r\n", ##__VA_ARGS__); + #endif + +#else + #define DBG_HCI_CMD(x, ...) +#endif + + +#ifdef CC3000_DEBUG + + #ifdef VT100_COLOUR + #define DBG_CC(x, ...) std::printf("\x1b[2;32;40m[CC3000] "x"\x1b[0;37;40m\r\n", ##__VA_ARGS__); + #else + #define DBG_CC(x, ...) std::printf("[CC3000] "x"\r\n", ##__VA_ARGS__); + #endif + +#else + #define DBG_HCI_CMD(x, ...) #endif namespace mbed_cc3000 {