RadioLib
Universal wireless communication library for Arduino
FEC.h
1 #if !defined(_RADIOLIB_FEC_H)
2 #define _RADIOLIB_FEC_H
3 
4 #include "../TypeDef.h"
5 #include "../Module.h"
6 #if defined(RADIOLIB_BUILD_ARDUINO)
7 #include "../ArduinoHal.h"
8 #endif
9 
10 // BCH(31, 21) code constants
11 #define RADIOLIB_PAGER_BCH_N (31)
12 #define RADIOLIB_PAGER_BCH_K (21)
13 #define RADIOLIB_PAGER_BCH_PRIMITIVE_POLY (0x25)
14 
21 class RadioLibBCH {
22  public:
26  RadioLibBCH();
27 
34  void begin(uint8_t n, uint8_t k, uint32_t poly);
35 
42  uint32_t encode(uint32_t dataword);
43 
44  private:
45  uint8_t n;
46  uint8_t k;
47  uint32_t poly;
48  uint8_t m;
49  int32_t* alphaTo;
50  int32_t* indexOf;
51  int32_t* generator;
52 };
53 
54 // the global singleton
55 extern RadioLibBCH RadioLibBCHInstance;
56 
57 #endif
Class to calculate Bose–Chaudhuri–Hocquenghem (BCH) class of forward error correction codes....
Definition: FEC.h:21
RadioLibBCH()
Default constructor.
Definition: FEC.cpp:4
void begin(uint8_t n, uint8_t k, uint32_t poly)
Initialization method.
Definition: FEC.cpp:13
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:172