1 #if !defined(_RADIOLIB_FEC_H)
2 #define _RADIOLIB_FEC_H
4 #include "../TypeDef.h"
6 #if defined(RADIOLIB_BUILD_ARDUINO)
7 #include "../ArduinoHal.h"
11 #define RADIOLIB_PAGER_BCH_N (31)
12 #define RADIOLIB_PAGER_BCH_K (21)
13 #define RADIOLIB_PAGER_BCH_PRIMITIVE_POLY (0x25)
15 #if RADIOLIB_STATIC_ONLY
16 #define RADIOLIB_BCH_MAX_N (63)
17 #define RADIOLIB_BCH_MAX_K (31)
44 void begin(uint8_t n, uint8_t k, uint32_t poly);
52 uint32_t
encode(uint32_t dataword);
60 #if RADIOLIB_STATIC_ONLY
61 int32_t alphaTo[RADIOLIB_BCH_MAX_N + 1] = { 0 };
62 int32_t indexOf[RADIOLIB_BCH_MAX_N + 1] = { 0 };
63 int32_t generator[RADIOLIB_BCH_MAX_N - RADIOLIB_BCH_MAX_K + 1] = { 0 };
65 int32_t* alphaTo =
nullptr;
66 int32_t* indexOf =
nullptr;
67 int32_t* generator =
nullptr;
75 #define SET_BIT_IN_ARRAY(A, k) ( A[(k/8)] |= (1 << (k%8)) )
76 #define CLEAR_BIT_IN_ARRAY(A, k) ( A[(k/8)] &= ~(1 << (k%8)) )
77 #define TEST_BIT_IN_ARRAY(A, k) ( A[(k/8)] & (1 << (k%8)) )
78 #define GET_BIT_IN_ARRAY(A, k) ( (A[(k/8)] & (1 << (k%8))) ? 1 : 0 )
Class to calculate Bose–Chaudhuri–Hocquenghem (BCH) class of forward error correction codes....
Definition: FEC.h:26
RadioLibBCH()
Default constructor.
Definition: FEC.cpp:4
void begin(uint8_t n, uint8_t k, uint32_t poly)
Initialization method.
Definition: FEC.cpp:21
~RadioLibBCH()
Default detructor.
Definition: FEC.cpp:8
uint32_t encode(uint32_t dataword)
Encoding method - encodes one data word (without check bits) into a code word (with check bits).
Definition: FEC.cpp:200