mirror of
https://github.com/espressif/openthread.git
synced 2026-08-01 00:27:47 +00:00
Re-enable termio settings. (#25)
This commit is contained in:
+6
-22
@@ -80,34 +80,19 @@ void Serial::ReceiveTask(void)
|
||||
{
|
||||
uint16_t bufLength;
|
||||
const uint8_t *buf;
|
||||
const uint8_t *cur;
|
||||
const uint8_t *end;
|
||||
|
||||
buf = otPlatSerialGetReceivedBytes(&bufLength);
|
||||
|
||||
end = buf + bufLength;
|
||||
|
||||
for (cur = buf; cur < end; cur++)
|
||||
{
|
||||
switch (*cur)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
otPlatSerialSend(CRNL, sizeof(CRNL));
|
||||
break;
|
||||
|
||||
default:
|
||||
otPlatSerialSend(cur, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (bufLength > 0 && mRxLength < kRxBufferSize)
|
||||
for (; buf < end; buf++)
|
||||
{
|
||||
switch (*buf)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
otPlatSerialSend(CRNL, sizeof(CRNL));
|
||||
|
||||
if (mRxLength > 0)
|
||||
{
|
||||
mRxBuffer[mRxLength] = '\0';
|
||||
@@ -118,21 +103,20 @@ void Serial::ReceiveTask(void)
|
||||
|
||||
case '\b':
|
||||
case 127:
|
||||
otPlatSerialSend(sEraseString, sizeof(sEraseString));
|
||||
|
||||
if (mRxLength > 0)
|
||||
{
|
||||
mRxBuffer[--mRxLength] = '\0';
|
||||
otPlatSerialSend(sEraseString, sizeof(sEraseString));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
otPlatSerialSend(buf, 1);
|
||||
mRxBuffer[mRxLength++] = *buf;
|
||||
break;
|
||||
}
|
||||
|
||||
buf++;
|
||||
bufLength--;
|
||||
}
|
||||
|
||||
otPlatSerialHandleReceiveDone();
|
||||
|
||||
Reference in New Issue
Block a user