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.
Dependents: IoT_Ex BatteryModelTester BatteryModelTester
Fork of WiflyInterface by
Revision 25:36b2d76ca8d9, committed 2016-03-31
- Comitter:
- defrost
- Date:
- Thu Mar 31 16:22:37 2016 +0000
- Parent:
- 24:705480e2e482
- Child:
- 26:eaaedb036df1
- Commit message:
- - Removed all printfs; - changed printing of messages to pc.printf, from std::printf
Changed in this revision
| Wifly/Wifly.cpp | Show annotated file Show diff for this revision Revisions of this file |
| WiflyInterface.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Wifly/Wifly.cpp Thu Mar 31 14:13:07 2016 +0000
+++ b/Wifly/Wifly.cpp Thu Mar 31 16:22:37 2016 +0000
@@ -24,9 +24,9 @@
#define DEBUG
//Debug is disabled by default
#ifdef DEBUG
-#define DBG(x, ...) std::printf("[Wifly : DBG]"x"\r\n", ##__VA_ARGS__);
-#define WARN(x, ...) std::printf("[Wifly : WARN]"x"\r\n", ##__VA_ARGS__);
-#define ERR(x, ...) std::printf("[Wifly : ERR]"x"\r\n", ##__VA_ARGS__);
+#define DBG(x, ...) pc.printf("[Wifly : DBG]"x"\r\n", ##__VA_ARGS__);
+#define WARN(x, ...) pc.printf("[Wifly : WARN]"x"\r\n", ##__VA_ARGS__);
+#define ERR(x, ...) pc.printf("[Wifly : ERR]"x"\r\n", ##__VA_ARGS__);
#else
#define DBG(x, ...)
#define WARN(x, ...)
@@ -34,7 +34,7 @@
#endif
#ifdef DEBUG
-#define INFO(x, ...) std::printf("[Wifly : INFO]"x"\r\n", ##__VA_ARGS__);
+#define INFO(x, ...) pc.printf("[Wifly : INFO]"x"\r\n", ##__VA_ARGS__);
#else
#define INFO(x, ...)
#endif
@@ -44,7 +44,7 @@
Wifly * Wifly::inst;
Wifly::Wifly( PinName tx, PinName rx, PinName _reset, PinName tcp_status, const char * ssid, const char * phrase, Security sec):
- wifi(tx, rx), reset_pin(_reset), tcp_status(tcp_status), buf_wifly(256)
+ wifi(tx, rx), reset_pin(_reset), tcp_status(tcp_status), buf_wifly(1024)
{
memset(&state, 0, sizeof(state));
state.sec = sec;
@@ -295,7 +295,6 @@
string sub = h.substr(0, h.find("."));
nb_digits = atoi(sub.c_str());
}
- //printf("substrL %s\r\n", sub.c_str());
if (count(h.begin(), h.end(), '.') == 3 && nb_digits > 0) {
strcpy(ip, host);
}
--- a/WiflyInterface.cpp Thu Mar 31 14:13:07 2016 +0000
+++ b/WiflyInterface.cpp Thu Mar 31 16:22:37 2016 +0000
@@ -1,5 +1,23 @@
#include "WiflyInterface.h"
+#define DEBUG
+//Debug is disabled by default
+#ifdef DEBUG
+#define DBG(x, ...) pc.printf("[WiflyInterface : DBG] "x"\r\n", ##__VA_ARGS__);
+#define WARN(x, ...) pc.printf("[WiflyInterface : WARN] "x"\r\n", ##__VA_ARGS__);
+#define ERR(x, ...) pc.printf("[WiflyInterface : ERR] "x"\r\n", ##__VA_ARGS__);
+#else
+#define DBG(x, ...)
+#define WARN(x, ...)
+#define ERR(x, ...)
+#endif
+
+#ifdef DEBUG
+#define INFO(x, ...) pc.printf("[WiflyInterface : INFO] "x"\r\n", ##__VA_ARGS__);
+#else
+#define INFO(x, ...)
+#endif
+
WiflyInterface::WiflyInterface( PinName tx, PinName rx, PinName reset, PinName tcp_status,
const char * ssid, const char * phrase, Security sec) :
Wifly(tx, rx, reset, tcp_status, ssid, phrase, sec)
@@ -11,6 +29,7 @@
{
state.dhcp = true;
reset();
+ INFO("WiflyInterface Initialized.");
return 0;
}
@@ -31,7 +50,7 @@
{
// join() returns a boolean, it does not like it all the time, thus casting it as int
int ii = (int) join();
- pc.printf(">>> join() complete. %d\n\r",ii);
+ INFO("join() complete, return value: %d",ii);
return ii;
}
