updated tf
This commit is contained in:
@@ -23,6 +23,13 @@ void TF_WriteImpl(TinyFrame *tf, const uint8_t *buff, size_t len)
|
|||||||
assert_param(osOK == osSemaphoreWait(semVcomTxReadyHandle, 5000));
|
assert_param(osOK == osSemaphoreWait(semVcomTxReadyHandle, 5000));
|
||||||
uint16_t chunksize = (uint16_t) MIN(total, CHUNK);
|
uint16_t chunksize = (uint16_t) MIN(total, CHUNK);
|
||||||
assert_param(USBD_OK == CDC_Transmit_FS((uint8_t *) buff, chunksize));
|
assert_param(USBD_OK == CDC_Transmit_FS((uint8_t *) buff, chunksize));
|
||||||
|
|
||||||
|
PUTS("Tx: ");
|
||||||
|
for(int i=0;i<chunksize; i++) {
|
||||||
|
PRINTF("%02X ", buff[i]);
|
||||||
|
}
|
||||||
|
PUTS("\r\n");
|
||||||
|
|
||||||
buff += chunksize;
|
buff += chunksize;
|
||||||
total -= chunksize;
|
total -= chunksize;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -537,6 +537,7 @@ void _TF_FN TF_AcceptChar(TinyFrame *tf, unsigned char c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tf->len == 0) {
|
if (tf->len == 0) {
|
||||||
|
// if the message has no body, we're done.
|
||||||
TF_HandleReceivedMessage(tf);
|
TF_HandleReceivedMessage(tf);
|
||||||
TF_ResetParser(tf);
|
TF_ResetParser(tf);
|
||||||
break;
|
break;
|
||||||
@@ -773,6 +774,8 @@ static bool _TF_FN TF_SendFrame(TinyFrame *tf, TF_Msg *msg, TF_Listener listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checksum only if message had a body
|
||||||
|
if (msg->len > 0) {
|
||||||
// Flush if checksum wouldn't fit in the buffer
|
// Flush if checksum wouldn't fit in the buffer
|
||||||
if (TF_SENDBUF_LEN - len < sizeof(TF_CKSUM)) {
|
if (TF_SENDBUF_LEN - len < sizeof(TF_CKSUM)) {
|
||||||
TF_WriteImpl(tf, (const uint8_t *) tf->sendbuf, len);
|
TF_WriteImpl(tf, (const uint8_t *) tf->sendbuf, len);
|
||||||
@@ -780,9 +783,10 @@ static bool _TF_FN TF_SendFrame(TinyFrame *tf, TF_Msg *msg, TF_Listener listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add checksum, flush what remains to be sent
|
// Add checksum, flush what remains to be sent
|
||||||
len += TF_ComposeTail(tf->sendbuf+len, &cksum);
|
len += TF_ComposeTail(tf->sendbuf + len, &cksum);
|
||||||
TF_WriteImpl(tf, (const uint8_t *) tf->sendbuf, len);
|
}
|
||||||
|
|
||||||
|
TF_WriteImpl(tf, (const uint8_t *) tf->sendbuf, len);
|
||||||
TF_ReleaseTx(tf);
|
TF_ReleaseTx(tf);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
* Upstream URL: https://github.com/MightyPork/TinyFrame
|
* Upstream URL: https://github.com/MightyPork/TinyFrame
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define TF_VERSION "2.0.1"
|
#define TF_VERSION "2.0.3"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
#include <stdint.h> // for uint8_t etc
|
#include <stdint.h> // for uint8_t etc
|
||||||
|
|||||||
Reference in New Issue
Block a user