Ok. I hava a message template, described as:
uint8 id
void5
UvrValue value
where UveValue is:
@union # Tag is 3 bit long, so outer structure has 5-bit prefix to ensure proper alignment
uint8 bool_value
int8 byte_value # 8-bit value is used for alignment reasons
int16 short_value
int32 integer_value
int64 long_value
And function, where I try to send int64 value (tag=4 from union above)
uint8_t n = 0;
uint8_t tag=4;
int offset = 0;
uint8_t buffer[32];
static uint8_t transferId = 0;
uint8_t id=1;
int64_t abs= 0x0000FF55;
memset(buffer,0x00,32);
canardEncodeScalar(buffer, offset, 8, &id); //id
offset += 8;
canardEncodeScalar(buffer, offset, 5, &n); //void5 offset
offset += 5;
canardEncodeScalar(buffer, offset, 3, &tag); //tag to union member
offset += 3;
canardEncodeScalar(buffer, offset, 64, &abs); //int64 value
canardBroadcast(&g_canard,
UVR_ARRAY_SIGNATURE,
UVR_ARRAY_ID,
&transferId,
CANARD_TRANSFER_PRIORITY_HIGH,
buffer,
10);
I have doubts for last argument of canardBroadcast (length of packet), but I see - 8+5(void)+3+64=80 (10 bytes). But CRC is calculated with fail.
If i try send for example int32 value (tag=3), length=6 (<7) than the transmission is OK