-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_packet.h
More file actions
33 lines (25 loc) · 1000 Bytes
/
Copy pathdata_packet.h
File metadata and controls
33 lines (25 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Header for the data_packet functions
#ifndef h_data_packet_h
#define h_data_packet_h
//#include <Arduino.h>
#include <cstdint>
/// Size of the data packet in bytes
#define DATA_PACKET_SIZE sizeof(packet_t)
struct packet_t {
uint32_t message;
uint32_t time;
uint16_t battery;
uint16_t last_tx_duration;
int16_t temp;
uint16_t humidity;
uint8_t status;
uint8_t data;
uint8_t node;
};
void build_data_packet(packet_t *data, const uint8_t node, const uint32_t message, const uint32_t time,
const uint16_t battery, const uint16_t last_tx_duration,
const int16_t temp, const uint16_t humidity, const uint8_t status);
void parse_data_packet(const packet_t *data, uint8_t *node, uint32_t *message, uint32_t *time, uint16_t *battery,
uint16_t *last_tx_duration, int16_t *temp, uint16_t *humidity, uint8_t *status);
char *data_packet_to_string(const packet_t *data, bool pretty = false);
#endif