1.启用assert_param
启用assert_param需要在Options for Target 里面C/C++ 里面define USE_FULL_ASSERT 然后在main.c文件里加入assert_failed函数即可。
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and linenumber,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file,line) */
/* Infinite loop */
printf("Wrong parameters value: file %s on line %d\r\n", file,line);
while(1){}
}
2.LCD格式化输出字符串
勘误:此处建议用snprintf,函数sprintf可能会越界(debug发现的,搞了半天,蛋疼!)
sprintf( text,"%-20s",USART2_DATA.RX_BUF);//左对齐补空格
LCD_DisplayStringLine(Line9, (u8*)text);
3.TIM 时钟 分频
CK_CNT(定时器时钟)等于fCK_P