2020-04-23 01:22:09 -04:00
|
|
|
#ifndef __LORCOMM_H_H
|
|
|
|
#define __LORCOMM_H_H
|
|
|
|
|
|
|
|
// disable memory alignment
|
|
|
|
#pragma pack(push, 1)
|
|
|
|
typedef struct {
|
2020-04-25 00:06:56 -04:00
|
|
|
uint8_t id;
|
2020-04-23 01:22:09 -04:00
|
|
|
uint8_t src[3];
|
|
|
|
uint8_t dst[3];
|
|
|
|
uint8_t type;
|
|
|
|
void *payload;
|
|
|
|
} lora_packet;
|
|
|
|
|
|
|
|
// this is wrong, why is working correctly? should be 7
|
|
|
|
#define LORA_PACKET_HEADER_SIZE (8)
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t length;
|
|
|
|
char *msg;
|
|
|
|
} lora_msg;
|
|
|
|
|
|
|
|
#define LORA_MSG_HEADER_SIZE (1)
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t origin[3];
|
|
|
|
uint8_t type; // same as packet type
|
|
|
|
void *payload;
|
|
|
|
} lora_routing;
|
|
|
|
|
|
|
|
#define LORA_ROUTING_HEADER_SIZE (4)
|
|
|
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
enum lora_msg_type {
|
|
|
|
TEXT = 0,
|
|
|
|
ROUTING,
|
|
|
|
};
|
|
|
|
|
2020-04-28 00:24:19 -04:00
|
|
|
extern uint8_t lormac[3];
|
|
|
|
|
2020-04-25 00:06:56 -04:00
|
|
|
void lorcomm_handle_receive(uint8_t size);
|
|
|
|
void lorcomm_send_message(lora32_cfg_t *lora, char *text);
|
2020-04-23 01:22:09 -04:00
|
|
|
|
|
|
|
#endif
|