diff --git a/TinyFrame.c b/TinyFrame.c index 42c05d1..4ad41e7 100644 --- a/TinyFrame.c +++ b/TinyFrame.c @@ -169,6 +169,13 @@ TinyFrame * _TF_FN TF_Init(TF_Peer peer_bit) return tf; } +/** Release the struct */ +void TF_DeInit(TinyFrame *tf) +{ + if (tf == NULL) return; + free(tf); +} + //region Listeners /** Reset ID listener's timeout to the original value */ @@ -696,7 +703,7 @@ static size_t _TF_FN TF_ComposeBody(uint8_t *outbuff, * @param cksum - checksum variable used for the body * @return nr of bytes in outbuff used */ -static size_t _TF_FN TF_ComposeTail(uint8_t *outbuff, const TF_CKSUM *cksum) +static size_t _TF_FN TF_ComposeTail(uint8_t *outbuff, TF_CKSUM *cksum) { int8_t si = 0; // signed small int uint8_t b = 0; diff --git a/TinyFrame.h b/TinyFrame.h index 43eb016..a4d92df 100644 --- a/TinyFrame.h +++ b/TinyFrame.h @@ -10,7 +10,7 @@ * Upstream URL: https://github.com/MightyPork/TinyFrame */ -#define TF_VERSION "2.0.0" +#define TF_VERSION "2.0.1" //--------------------------------------------------------------------------- #include // for uint8_t etc @@ -235,6 +235,13 @@ TinyFrame *TF_Init(TF_Peer peer_bit); */ void TF_InitStatic(TinyFrame *tf, TF_Peer peer_bit); +/** + * De-init the dynamically allocated TF instance + * + * @param tf + */ +void TF_DeInit(TinyFrame *tf); + /** * Reset the frame parser state machine. * This does not affect registered listeners.