This is a SLIP interface for the STM32F446RE Nucleo Board. It is designed to work specifically with the esp-link software for the ESP8266. The program is an example of a rest command.
Diff: STMClient.cpp
- Revision:
- 4:31bed73a0d08
- Parent:
- 3:8ed85d940c4c
- Child:
- 8:6a3b7c5d9ba7
--- a/STMClient.cpp Fri Aug 05 16:04:04 2016 +0000 +++ b/STMClient.cpp Tue Aug 09 22:42:31 2016 +0000 @@ -65,26 +65,24 @@ // Read all characters available on the serial input and process any messages that arrive, but // stop if a non-callback response comes in STMClientPacket *STMClient::Process() { + int value; while (_serial->readable()) { - //value =_serial->getc(rxBuffer, 5, eSerialCb, SERIAL_EVENT_RX_ALL, '$'); - char character=_serial->getc(); - //value = _serial->read(); - - if ((int)character == SLIP_ESC) { + value = _serial->getc(); + if (value == SLIP_ESC) { _proto.isEsc = 1; - } else if ((int)character == SLIP_END) { + } else if (value == SLIP_END) { STMClientPacket *packet = _proto.dataLen >= 8 ? protoCompletedCb() : 0; _proto.dataLen = 0; _proto.isEsc = 0; if (packet != NULL) return packet; } else { if (_proto.isEsc) { - if ((int)character == SLIP_ESC_END) character = SLIP_END; - if ((int)character == SLIP_ESC_ESC) character = SLIP_ESC; + if (value == SLIP_ESC_END) value = SLIP_END; + if (value == SLIP_ESC_ESC) value = SLIP_ESC; _proto.isEsc = 0; } if (_proto.dataLen < _proto.bufSize) { - _proto.buf[_proto.dataLen++] = (int)character; + _proto.buf[_proto.dataLen++] = value; } } }