调试技巧
调用代码: 每次函数都有一个返回值status拿到这个返回值去判断
status = phacDiscLoop_SetConfig(pDiscLoop, PHAC_DISCLOOP_CONFIG_TYPEA_DEVICE_LIMIT, 1);
CHECK_STATUS(status);
定义:
#define CHECK_STATUS(x) \
if ((x) != PH_ERR_SUCCESS) \
{ \
DEBUG_PRINTF("file: "__FILE__", function: %s,Line: %d, Error - (0x%04X) has occurred\r\n", __FUNCTION__,__LINE__, (x)); \
}
串口表现:
file: ../Src/main.c, function: Ex4_NfcRdLibInit,Line: 857, Error - (0x4020) has occurred