RadioLib
Universal wireless communication library for Arduino
Loading...
Searching...
No Matches
Utils.h
1
#if !defined(_RADIOLIB_UTILS_H)
2
#define _RADIOLIB_UTILS_H
3
4
#include <stdint.h>
5
#include <stdlib.h>
6
7
#include "../BuildOpt.h"
8
9
// macros to access bits in byte array, from http://www.mathcs.emory.edu/~cheung/Courses/255/Syllabus/1-C-intro/bit-array.html
10
#define SET_BIT_IN_ARRAY_MSB(A, k) ( A[((k)/8)] |= (1 << ((k)%8)) )
11
#define CLEAR_BIT_IN_ARRAY_MSB(A, k) ( A[((k)/8)] &= ~(1 << ((k)%8)) )
12
#define TEST_BIT_IN_ARRAY_MSB(A, k) ( A[((k)/8)] & (1 << ((k)%8)) )
13
#define GET_BIT_IN_ARRAY_MSB(A, k) ( (A[((k)/8)] & (1 << ((k)%8))) ? 1 : 0 )
14
#define SET_BIT_IN_ARRAY_LSB(A, k) ( A[((k)/8)] |= (1 << (7 - ((k)%8))) )
15
#define CLEAR_BIT_IN_ARRAY_LSB(A, k) ( A[((k)/8)] &= ~(1 << (7 - ((k)%8))) )
16
#define TEST_BIT_IN_ARRAY_LSB(A, k) ( A[((k)/8)] & (1 << (7 - ((k)%8))) )
17
#define GET_BIT_IN_ARRAY_LSB(A, k) ( (A[((k)/8)] & (1 << (7 - ((k)%8)))) ? 1 : 0 )
18
25
uint32_t rlb_reflect(uint32_t in, uint8_t bits);
26
36
void
rlb_hexdump(
const
char
* level,
const
uint8_t* data,
size_t
len, uint32_t offset = 0, uint8_t width = 1,
bool
be =
false
);
37
38
#if RADIOLIB_DEBUG && defined(RADIOLIB_BUILD_ARDUINO)
39
size_t
rlb_printf(
const
char
* format, ...);
40
#endif
41
42
#endif
src
utils
Utils.h
Generated by
1.9.8