You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
484 B
21 lines
484 B
1 year ago
|
//
|
||
|
// Created by o.likhogub on 10/7/2023.
|
||
|
//
|
||
|
|
||
|
#include "TransmissionModule.h"
|
||
|
|
||
|
#define MSG_LENGTH 5
|
||
|
#define ECC_LENGTH 4
|
||
|
#define TOTAL_LENGTH (MSG_LENGTH + ECC_LENGTH)
|
||
|
|
||
|
void TransmissionModule::transmit(MeasureData &data) {
|
||
|
uint8_t msg[MSG_LENGTH];
|
||
|
msg[0] = data.sensor_id;
|
||
|
memcpy(msg + 1, (void *) &data, 4);
|
||
|
|
||
|
|
||
|
uint8_t encoded[MSG_LENGTH + ECC_LENGTH];
|
||
|
reedSolomonModule->encode(msg, encoded);
|
||
|
transmitterModule->send(encoded, MSG_LENGTH + ECC_LENGTH);
|
||
|
}
|