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.
Dependencies: WncControllerK64F
Fork of WNCInterface by
Diff: WNCInterface.h
- Revision:
- 3:1d7e6ed11269
- Parent:
- 0:55ec71dc0347
- Child:
- 5:759dceff95b9
--- a/WNCInterface.h Tue Sep 27 16:29:16 2016 +0000
+++ b/WNCInterface.h Tue Sep 27 19:16:22 2016 +0000
@@ -35,6 +35,8 @@
//0=simply return failed response for all socket calls
#define DISPLAY_FE 1 //1 to display the fatal error when it occurs
//0 to NOT display the fatal error
+#define RESETON_FE 1 //1 to cause the MCU to reset on fatal error
+ //0 to NOT reset the MCU
#define APN_DEFAULT "m2m.com.attz"
//
@@ -46,25 +48,34 @@
#define RETfail return -1
#define RETvoid return
#define RETnull return NULL
+#define RETresume
+
#define DORET(x) RET##x
#define TOSTR(x) #x
#define INTSTR(x) TOSTR(x)
#define FATAL_STR __FILE__ ":" INTSTR(__LINE__)
+#if RESETON_FE == 1
+#define MCURESET ((*((volatile unsigned long *)0xE000ED0CU))=(unsigned long)((0x5fa<<16) | 0x04L))
+#define RSTMSG "RESET MCU! "
+#else
+#define MCURESET
+#define RSTMSG ""
+#endif
+
#if DISPLAY_FE == 1
-#define PFE printf("WNC FAILED @ %s\r\n", FATAL_STR)
+#define PFE printf(RSTMSG "WNC FAILED @ %s\r\n", FATAL_STR)
#else
#define PFE
#endif
#if STOP_ON_FE == 1
-#define FATAL_WNC_ERROR(v) {extern char *_fatal_err_loc;_fatal_err_loc=FATAL_STR;PFE;while(1);}
+#define FATAL_WNC_ERROR(v) {extern char *_fatal_err_loc;_fatal_err_loc=FATAL_STR;PFE;MCURESET;while(1);}
#else
#define FATAL_WNC_ERROR(v) {extern char *_fatal_err_loc;_fatal_err_loc=FATAL_STR;PFE;DORET(v);}
#endif
-
// Because the WncController has intermixed socket & interface functionallity
// will need to make the Socket class a friend of the Interface class. This
// will allow the Socket class to get to the WNC functions needed for the
@@ -90,7 +101,7 @@
/** Initialize the interface (no connection at this point).
* \return 0 on success, a negative number on failure
*/
- static int init(const char* apn=NULL, int debug=0);
+ static int init(const char* apn=NULL, MODSERIAL * debug=NULL);
/** Open an LTE internet data connection
@return 0 on success, error code on failure
