cc3000 driver with expanded buffers.
Fork of cc3000_hostdriver_mbedsocket by
Revision 22:d23c59fec0dc, committed 2013-10-03
- Comitter:
- SolderSplashLabs
- Date:
- Thu Oct 03 20:56:45 2013 +0000
- Parent:
- 20:30b6ed7bf8fd
- Child:
- 26:456f73ed2a75
- Commit message:
- Separate Debug defines and VT100 colour
Changed in this revision
--- 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 {
--- a/cc3000_event.cpp Thu Oct 03 17:15:45 2013 +0200
+++ b/cc3000_event.cpp Thu Oct 03 20:56:45 2013 +0000
@@ -44,7 +44,7 @@
namespace mbed_cc3000 {
-#if CC3000_DEBUG == 1
+#ifdef CC3000_DEBUG_HCI_RX
const char *HCI_EVENT_STR[] =
{
"Socket",
@@ -178,7 +178,7 @@
static void hci_event_debug_print(uint16_t hciEventNo)
{
-#if CC3000_DEBUG == 1
+#ifdef CC3000_DEBUG_HCI_RX
if ((hciEventNo > HCI_CMND_SOCKET_BASE) && ( hciEventNo <= HCI_CMND_MDNS_ADVERTISE))
{
DBG_HCI("Event Received : 0x%04X - %s", hciEventNo, HCI_EVENT_STR[hciEventNo-HCI_CMND_SOCKET]);
--- a/cc3000_hci.cpp Thu Oct 03 17:15:45 2013 +0200
+++ b/cc3000_hci.cpp Thu Oct 03 20:56:45 2013 +0000
@@ -52,6 +52,8 @@
uint16_t cc3000_hci::command_send(uint16_t op_code, uint8_t *buffer, uint8_t length) {
unsigned char *stream;
+
+ DBG_HCI_CMD("Command Sent : 0x%04X", op_code);
stream = (buffer + SPI_HEADER_SIZE);
