microRTPS: transport: make seq_number non-atomic

This commit is contained in:
TSC21 2020-07-28 11:24:40 +01:00 committed by Nuno Marques
parent 08e72b29b3
commit 3db9307dfb
2 changed files with 3 additions and 2 deletions

View File

@ -232,13 +232,12 @@ ssize_t Transport_node::write(const uint8_t topic_ID, char buffer[], size_t leng
}
static struct Header header = {{'>', '>', '>'}, 0u, 0u, 0u, 0u, 0u, 0u};
static uint8_t seq = 0;
// [>,>,>,topic_ID,seq,payload_length,CRCHigh,CRCLow,payload_start, ... ,payload_end]
uint16_t crc = crc16((uint8_t *)&buffer[sizeof(header)], length);
header.topic_ID = topic_ID;
header.seq = seq++;
header.seq = _seq_number++;
header.payload_len_h = (length >> 8) & 0xff;
header.payload_len_l = length & 0xff;
header.crc_h = (crc >> 8) & 0xff;

View File

@ -78,6 +78,8 @@ protected:
protected:
uint32_t rx_buff_pos;
char rx_buffer[BUFFER_SIZE] = {};
bool debug = false;
uint8_t _seq_number{0};
private:
struct __attribute__((packed)) Header {