| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #ifndef __USER_DEBUG_H__
- #define __USER_DEBUG_H__
- #include "ets_sys.h"
- #include "osapi.h"
- #include "user_interface.h"
- #include "espconn.h"
- enum {
- EPIT_DEBUGMSG_LEVEL_ERROR = 0,
- EPIT_DEBUGMSG_LEVEL_WARNING,
- EPIT_DEBUGMSG_LEVEL_INFO,
- EPIT_DEBUGMSG_LEVEL_DEBUG
- };
- extern uint8 EpitDebugLevel;
- #define espl_print_dbgmsg(lv, ...) do{ \
- if(lv <= EpitDebugLevel) \
- { \
- os_printf(__VA_ARGS__); \
- } \
- }while(0)
- #define EPIT_DBG(...) espl_print_dbgmsg(EPIT_DEBUGMSG_LEVEL_DEBUG, __VA_ARGS__)
- #define EPIT_INFO(...) espl_print_dbgmsg(EPIT_DEBUGMSG_LEVEL_INFO, __VA_ARGS__)
- #define EPIT_WARN(...) espl_print_dbgmsg(EPIT_DEBUGMSG_LEVEL_WARNING, __VA_ARGS__)
- #define EPIT_ERR(...) espl_print_dbgmsg(EPIT_DEBUGMSG_LEVEL_ERROR, __VA_ARGS__)
- #define USER_DEBUG_PRINTBUF
- #ifdef USER_DEBUG_PRINTBUF
- #if defined(DEFINE_USER_PRINT_BUF) /* added macro DEFINE_USER_PRINT_BUF */
- #define user_printbuf(data, len, str) do { \
- uint8 *pDBGBuf = (uint8 *)(data); \
- uint8 DBGIndex=0; \
- int DBGLength=((len)<220)?(len):220; \
- os_printf("%s len %d\n", (str), (len)); \
- for(DBGIndex=0; DBGIndex< (DBGLength); DBGIndex++) \
- os_printf("%02x ", *(pDBGBuf + DBGIndex)); \
- os_printf("\n"); \
- } while (0)
- #endif /* DEFINE_USER_PRINT_BUF */
-
- static __inline void user_printbuf(uint8 *data, int len, const char *str)
- {
- uint8 *pDBGBuf = (uint8 *)(data);
- uint8 DBGIndex=0;
- int DBGLength=((len)<220)?(len):220;
- os_printf("%s len %d\n", (str), (len));
- for(DBGIndex=0; DBGIndex< (DBGLength); DBGIndex++)
- os_printf("%02x ", *(pDBGBuf + DBGIndex));
- os_printf("\n");
- }
- #else
- #define user_printbuf
- #endif
- void printEspconnItem(struct espconn *pespconn);
- #endif
|