inspektors/common/include/common.h

27 lines
602 B
C
Raw Normal View History

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>
// 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
// 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 */