问题遇到的现象
使用正点原子FREERTOS例程,创建任务遇到清屏函数只清除几行,但是程序正常运行。
清屏函数运行一会就退了。
神奇现象
在清屏函数for循环中加入了三个if语句清屏函数就能正常运行了
/**
* @brief 清屏函数
* @param color: 要清屏的颜色
* @retval 无
*/
void lcd_clear(uint16_t color)
{
uint32_t index = 0;
uint32_t totalpoint = lcddev.width;
totalpoint *= lcddev.height; /* 得到总点数 */
lcd_set_cursor(0x00, 0x0000); /* 设置光标位置 */
lcd_write_ram_prepare(); /* 开始写入GRAM */
for (index = 0; index < totalpoint; index++)
{
LCD->LCD_RAM = color;
if(index == 540)
index = 540;
if(index == 540+240)
index = 540+240;
if(index == 540+480)
index = 540+480;
}
}
各位知道这是因为什么吗?

