console.h

来自「无线单片机cc2430简化协议的无线收发程序」· C头文件 代码 · 共 89 行

H
89
字号


#ifndef CONSOLE_H
#define CONSOLE_H

#include "compiler.h"



void ConsolePutInitData(int highval,int lowval);
void ConsolePutInitDataWithoutRtn(int highval,int lowval);

void conPrintROMString_func(ROMCHAR *s);
void conPrintUINT8 (UINT8 x);
void conPrintUINT16 (UINT16 x);
void conPrintUINT32 (UINT32 x);
void conPrintLADDR(LADDR *laddr); //print long address
void conPrintLADDR_bytes(BYTE *ptr); //print long address
void conPrintConfig(void);
void conPCRLF(void);
void conPrintString (char *s);

//strings passed into this macro must be ROM constants
#define conPrintROMString(s) \
  {\
    static  ROMCHAR xxxxromstr[] = s;\
    conPrintROMString_func(xxxxromstr);\
  }

#define ConsolePutROMString(s) \
  {\
    static  ROMCHAR xxxxromstr[] = s;\
    conPrintROMString_func(xxxxromstr);\
  }

//verbosity increases as the debug level increases
#define DBG_MAX_LEVEL 10
#define DBG_FSM    5
#define DBG_ITRACE 4    //any interrupts
#define DBG_INFO   3    //general information
#define DBG_TX     2    //send a character
#define DBG_ERR    1    //serious error


//single char debug
#define DBG_CHAR_TXSTART     '!'
#define DBG_CHAR_TXBUSY      '@'
#define DBG_CHAR_RXOFLOW     '+'
#define DBG_CHAR_RXRCV       '$'
#define DBG_CHAR_ACKPKT      '%'
#define DBG_CHAR_MEMFULL     '^'
#define DBG_CHAR_TXFIN       '&'
#define DBG_CHAR_OURACK      '*'
#define DBG_CHAR_MACFULL     '~'   // MAC RX is full

#define LRWPAN_DEBUG

#ifdef LRWPAN_DEBUG

#define DEBUG_STRING(level,s) if (debug_level >= level) conPrintROMString(s)
#define DEBUG_CHAR(level,c) if (debug_level >= level) halPutch(c)
#define DEBUG_UINT8(level,x) if (debug_level >= level) conPrintUINT8(x)
#define DEBUG_UINT16(level,x) if (debug_level >= level) conPrintUINT16(x)
#define DEBUG_UINT32(level,x) if (debug_level >= level) conPrintUINT32(x)
#define DEBUG_PRINTNEIGHBORS(level) if (debug_level >= level) dbgPrintNeighborTable()
#define DEBUG_PRINTPACKET(level, ptr, plen) if (debug_level >= level)dbgPrintPacket(ptr, plen)



#define DEBUG_SET_LEVEL(x) debug_level=x

#else

#define DEBUG_STRING(level,s)
#define DEBUG_CHAR(level,c)
#define DEBUG_UINT8(level,x)
#define DEBUG_UINT16(level,x)
#define DEBUG_UINT32(level,x)
#define DEBUG_PRINTNEIGHBORS(level, x)
#define DEBUG_PRINTPACKET(level, ptr, plen)


#endif

extern BYTE debug_level;

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?