2022-06-21 19:04:05 +00:00
|
|
|
#ifndef __FDRS_TYPES_H__
|
2022-06-21 19:12:46 +00:00
|
|
|
#define __FDRS_TYPES_H__
|
2022-06-21 19:04:05 +00:00
|
|
|
|
2022-06-22 23:06:13 +00:00
|
|
|
#include <stdint.h>
|
2022-06-23 20:31:51 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2022-06-22 23:06:13 +00:00
|
|
|
typedef struct __attribute__((packed)) DataReading_t {
|
2022-06-21 19:08:31 +00:00
|
|
|
|
2022-06-21 19:04:05 +00:00
|
|
|
float data;
|
|
|
|
uint16_t id;
|
|
|
|
uint8_t type;
|
2022-06-22 23:06:13 +00:00
|
|
|
DataReading_t(): data(0.0),id(0),type(0){
|
|
|
|
}
|
|
|
|
} DataReading_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct DataReadingBuffer_t{
|
|
|
|
DataReading_t buffer[256];
|
|
|
|
uint16_t len;
|
2022-06-21 19:04:05 +00:00
|
|
|
|
2022-06-22 23:06:13 +00:00
|
|
|
DataReadingBuffer_t(){
|
|
|
|
|
|
|
|
}
|
2022-06-21 20:31:47 +00:00
|
|
|
|
2022-06-22 23:06:13 +00:00
|
|
|
}DataReadingBuffer_t;
|
2022-06-21 20:31:47 +00:00
|
|
|
|
2022-06-23 20:31:51 +00:00
|
|
|
|
2022-06-24 15:40:06 +00:00
|
|
|
typedef struct Peer_t{
|
2022-06-23 20:31:51 +00:00
|
|
|
|
|
|
|
uint8_t peer[6];
|
2022-06-24 15:40:06 +00:00
|
|
|
Peer_t(){
|
2022-06-23 20:31:51 +00:00
|
|
|
memset(peer,0,6);
|
|
|
|
}
|
|
|
|
|
|
|
|
void _copy(uint8_t p[6]){
|
|
|
|
memcpy(peer,p,6);
|
|
|
|
}
|
|
|
|
uint8_t *_data(void){
|
|
|
|
return peer;
|
|
|
|
}
|
|
|
|
|
2022-06-24 15:40:06 +00:00
|
|
|
bool operator==(Peer_t c){
|
|
|
|
if(memcmp(this->peer,c.peer,6) == 0){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}Peer_t;
|
2022-06-23 20:31:51 +00:00
|
|
|
|
2022-06-21 19:04:05 +00:00
|
|
|
#endif
|