[FEC] Move generically useful macros

This commit is contained in:
jgromes 2024-08-05 21:08:35 +02:00
parent d95e5e39e8
commit 079874345b
2 changed files with 9 additions and 7 deletions

View file

@ -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

View file

@ -71,4 +71,11 @@ class RadioLibBCH {
// the global singleton
extern RadioLibBCH RadioLibBCHInstance;
#endif
// 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