when flag is RT_DEVICE_FLAG_STREAM, paser '\n' break!

This commit is contained in:
bigmagic 2020-12-02 10:11:38 +08:00
parent 091089f16d
commit 7a1f0e0f67
1 changed files with 4 additions and 1 deletions

View File

@ -221,8 +221,11 @@ rt_inline int _serial_poll_rx(struct rt_serial_device *serial, rt_uint8_t *data,
*data = ch;
data ++; length --;
if(serial->parent.open_flag & RT_DEVICE_FLAG_STREAM)
{
if (ch == '\n') break;
}
}
return size - length;
}