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:
- 2:20ea1be14e4b
- Parent:
- 0:70a6082c1bf7
- Child:
- 3:8ed85d940c4c
--- a/STMClient.cpp Thu Jul 28 02:46:43 2016 +0000 +++ b/STMClient.cpp Thu Aug 04 19:44:11 2016 +0000 @@ -112,15 +112,18 @@ // Write some bytes to the output stream void STMClient::write(void* data, uint16_t len) { uint8_t *d = (uint8_t*)data; + _debug->printf("Writing: 0x%x\n\r", (const char*)data); while (len--) + { write(*d++); + } } // Start a request. cmd=command, value=address of callback pointer or first arg, // argc=additional argument count void STMClient::Request(uint16_t cmd, uint32_t value, uint16_t argc) { - //_debug->printf("Starting a request...\n\r"); - //wait(0.5); + _debug->printf("Starting a request...\n\r"); + wait(0.5); crc = 0; _serial->putc(SLIP_END); @@ -157,10 +160,9 @@ crc = crc16Add(temp, crc); } } - -/* Commented this out for now... +/* // Append a block of data located in flash as an argument to the request -void STMClient::Request(const __FlashStringHSTMper* data, uint16_t len) { +void STMClient::Request(const __FlashStringHelper* data, uint16_t len) { // write the length write(&len, 2); crc = crc16Data((unsigned const char*)&len, 2, crc); @@ -186,6 +188,7 @@ // Append the final CRC to the request and finish the request void STMClient::Request(void) { write((uint8_t*)&crc, 2); + _serial->putc(SLIP_END); } @@ -260,7 +263,7 @@ if (packet->value == (uint32_t)&wifiCb) { // _debug->printf("SYNC!"); - // wait(0.5); + wait(0.5); return true; } _debug->printf("BAD: %s /n/r", packet->value);