2018-01-02 13:45:56 +02:00
|
|
|
#ifndef COMMON_H
|
|
|
|
#define COMMON_H
|
|
|
|
|
2018-01-02 19:14:50 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2018-01-20 22:51:44 +02:00
|
|
|
// Bit manioulation
|
2018-01-02 19:14:50 +02:00
|
|
|
#define BIT(mask) (1 << (mask))
|
|
|
|
#define SET(var, mask) ((var) |= (uint8_t)BIT(mask))
|
|
|
|
#define CLR(var, mask) ((var) &= (uint8_t)~(BIT(mask)))
|
|
|
|
#define CHK(var, mask) ((var) & (uint8_t)BIT(mask))
|
2018-01-17 18:08:58 +02:00
|
|
|
#define TOG(var, mask) ((var) ^= (uint8_t)BIT(mask))
|
2018-01-02 13:45:56 +02:00
|
|
|
|
2018-01-20 22:51:44 +02:00
|
|
|
// Maximum data size in bytes that can be sent/received with current nrf24L01+ lib
|
|
|
|
#define MAX_PAYLOAD_SIZE 32
|
|
|
|
|
|
|
|
enum return_codes {
|
|
|
|
R_OK,
|
|
|
|
R_PACKAGE_SIZE,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
double temp;
|
|
|
|
uint16_t distance;
|
|
|
|
} data_packet_t;
|
|
|
|
|
2018-01-02 13:45:56 +02:00
|
|
|
#endif /* COMMON_H */
|