started planning packet struct while i wait for money to buy parts

This commit is contained in:
2026-03-01 06:50:54 +11:00
parent aeb32b6604
commit f58d105bed
2 changed files with 15 additions and 0 deletions

13
include/packet.h Normal file
View 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;

View File

@@ -1,3 +1,5 @@
#include "../include/packet.h"
#include "pico/stdlib.h"
#define LED_PIN 25