add tlv8_encode_n

This commit is contained in:
hathach committed 2018-01-15 15:13:04 +07:00
1 parent a0dc1eced5
commit 83ad264e35
3 files changed
+14 -5

No files matched your search

+12
View File
@@ -131,3 +131,15 @@ bool tlv8_encode_next(uint8_t** pp_buf, uint16_t* p_buflen, TLV8_t tlv)
return true;
}
uint16_t tlv8_encode_n(uint8_t* buf, uint16_t bufsize, TLV8_t tlv[], uint8_t count)
{
uint16_t len = bufsize;
for(uint8_t i=0; i < count; i++)
{
if( !tlv8_encode_next(&buf, &bufsize, tlv[i]) ) break;
}
return len - bufsize;
}