diff --git a/src/protocols/AX25/AX25.h b/src/protocols/AX25/AX25.h index 3f258320..c7678a3a 100644 --- a/src/protocols/AX25/AX25.h +++ b/src/protocols/AX25/AX25.h @@ -9,12 +9,7 @@ #include "../AFSK/AFSK.h" #include "../BellModem/BellModem.h" #include "../../utils/CRC.h" - -// macros to access bits in byte array, from http://www.mathcs.emory.edu/~cheung/Courses/255/Syllabus/1-C-intro/bit-array.html -#define SET_BIT_IN_ARRAY(A, k) ( A[(k/8)] |= (1 << (k%8)) ) -#define CLEAR_BIT_IN_ARRAY(A, k) ( A[(k/8)] &= ~(1 << (k%8)) ) -#define TEST_BIT_IN_ARRAY(A, k) ( A[(k/8)] & (1 << (k%8)) ) -#define GET_BIT_IN_ARRAY(A, k) ( (A[(k/8)] & (1 << (k%8))) ? 1 : 0 ) +#include "../../utils/FEC.h" // maximum callsign length in bytes #define RADIOLIB_AX25_MAX_CALLSIGN_LEN 6 diff --git a/src/utils/FEC.h b/src/utils/FEC.h index 30ba17ef..a33ff61f 100644 --- a/src/utils/FEC.h +++ b/src/utils/FEC.h @@ -71,4 +71,11 @@ class RadioLibBCH { // the global singleton extern RadioLibBCH RadioLibBCHInstance; -#endif \ No newline at end of file +// macros to access bits in byte array, from http://www.mathcs.emory.edu/~cheung/Courses/255/Syllabus/1-C-intro/bit-array.html +#define SET_BIT_IN_ARRAY(A, k) ( A[(k/8)] |= (1 << (k%8)) ) +#define CLEAR_BIT_IN_ARRAY(A, k) ( A[(k/8)] &= ~(1 << (k%8)) ) +#define TEST_BIT_IN_ARRAY(A, k) ( A[(k/8)] & (1 << (k%8)) ) +#define GET_BIT_IN_ARRAY(A, k) ( (A[(k/8)] & (1 << (k%8))) ? 1 : 0 ) + + +#endif