inspektors/common/include/common.h
2018-01-22 21:23:27 +02:00

32 lines
791 B
C

#ifndef COMMON_H
#define COMMON_H
#include <stdint.h>
// Bit manipulation
#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))
#define TOG(var, mask) ((var) ^= (uint8_t)BIT(mask))
// 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;
int32_t distance;
} data_packet_t;
// Base station radio MAC address
static uint8_t base_mac[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};
// Mobile node radio MAC address
static uint8_t node_mac[5] = {0xD7, 0xD7, 0xD7, 0xD7, 0xD7};
#endif /* COMMON_H */