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.
kempt-kinkajou-2023/cybergarden-aggregator/lib/ReedSolomonModule/ReedSolomonModule.h

28 lines
552 B

//
// Created by o.likhogub on 10/7/2023.
//
#ifndef KEMPT_KINKAJOU_REEDSOLOMONMODULE_H
#define KEMPT_KINKAJOU_REEDSOLOMONMODULE_H
#include <Arduino.h>
#include <RS-FEC.h>
#define MSG_LENGTH 5
#define ECC_LENGTH 4
class ReedSolomonModule {
private:
RS::ReedSolomon<MSG_LENGTH, ECC_LENGTH> rs;
public:
void encode(uint8_t * msg, uint8_t * encoded) {
rs.Encode(msg, encoded);
}
bool decode(uint8_t * encoded, uint8_t * msg) {
return rs.Decode(encoded, msg) == 0;
}
};
#endif //KEMPT_KINKAJOU_REEDSOLOMONMODULE_H