关于assert_failed

[复制链接]
 楼主| tom_2_2 发表于 2011-8-25 12:49 | 显示全部楼层 |阅读模式
AI, LED, se, ui, AN
我看到固件库中的main.c文件中
void assert_failed(uint8_t* file, uint32_t line)
{
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  while (1)
  {
  }
}
只是写了一下,并没有谈到如何使用
请问这个参数查错函数怎么使用,最好有个实例程序参考,还有要进行哪些头文件设置?
上官金虹 发表于 2011-8-25 16:25 | 显示全部楼层
调试的时候,跳到while(1),自然知道出错了。
 楼主| tom_2_2 发表于 2011-8-25 16:57 | 显示全部楼层
请问是不是在函数里面,在执行正常的程序之前,先用assert_failed对参数进行判断?
是不是像这样调用assert_failed(“I2C.c”,56)//I2C.c表示在哪个文件,56表示在哪一行出错吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

40

主题

319

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部