Compare commits
2 Commits
e5b5952e47
...
b910e3f7f5
| Author | SHA1 | Date | |
|---|---|---|---|
| b910e3f7f5 | |||
| f58d105bed |
13
include/packet.h
Normal file
13
include/packet.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t version; // version number to prevent breaking older packet formats
|
||||||
|
uint8_t ttl; // the number of hops left in the lifespan of the packet, prevents infinite hopping
|
||||||
|
uint8_t packetType; // packet type (message is the only type right now)
|
||||||
|
uint32_t senderId; // unique id of the person who sent the packet
|
||||||
|
uint32_t targetId; // 0xFFFFFFFF = broadcast
|
||||||
|
uint32_t messageId; // we can ignore packets if we've seen them twice
|
||||||
|
uint16_t payloadLength; // length of data
|
||||||
|
uint8_t payload[]; // actual data
|
||||||
|
} __attribute__((packed)) Packet;
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "../include/packet.h"
|
||||||
|
|
||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
|
|
||||||
#define LED_PIN 25
|
#define LED_PIN 25
|
||||||
|
|||||||
Reference in New Issue
Block a user