到这里都很完美,单链表数据存储也没有出错,内存这么数据也不可能爆表。
但就是发送超过31后的数据,只能输出打印31个,不知道问题出在哪里,查过串口接受部分的确接受了41个,但在串口回调函数处却表明有接受过一次null值,输出表明第31个后有null值,实在不知道怎么解决。复位重启后直接输出41个也是这样,求大佬帮忙解答下。
串口回调函数部分:
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
/* Prevent unused argument(s) compilation warning */
if(huart->Instance == USART1){
numss++;
creatPointer(BuffPtr);//创建单链表,添加数据
if(BuffPtr == 0x0a){
overFalg = 1;
BuffPtr = 0;
}
if(BuffPtr == NULL){
HAL_UART_Transmit(&huart1,(uint8_t*)"\r\n====\r\n",8,100);
}
HAL_UART_Receive_IT(&huart1, &BuffPtr, 1);
}
/* NOTE: This function should not be modified, when the callback is needed,
the HAL_UART_RxCpltCallback could be implemented in the user file
*/
}