//1、声明串口句柄
struct sp_port* port_handle;
enum sp_return ret;
ret = sp_get_port_by_name("com80", &port_handle);
//2、打开串口
ret = sp_open(port_handle, SP_MODE_READ_WRITE);
//3、串口设置
ret = sp_set_baudrate(port_handle, 115200);
ret = sp_set_bits(port_handle, 8);
ret = sp_set_parity(port_handle, SP_PARITY_NONE);
ret = sp_set_stopbits(port_handle, 1);
ret = sp_set_flowcontrol(port_handle, SP_FLOWCONTROL_NONE);
//4、有数据就返回
ret = sp_blocking_read_next(port_handle, buf, 1024, timeout);
//5、等10个字节读满或者达到超时时间就返回
ret = sp_blocking_read(port_handle, buf, 10, timeout);
问题:
sp_blocking_read_next有个问,一串数据发过来,它会先读1个字节,然后再读取剩下的