Files
meshcore-wch/User/lib/config.h
2025-12-28 12:23:11 +01:00

46 lines
1009 B
C

#ifndef CONFIG_HEADER
#define CONFIG_HEADER
#include "stdint.h"
#include "string.h"
#include "meshcore/packetstructs.h"
#define FLASH_USER_PAGE_ADDR ((const void *)(0x08077F00))
#define AESKeyCount 8
#define CONTACT_COUNT 100
typedef struct {
uint32_t magic; // e.g. 0xDEADBEEF
uint8_t privkey[32]; // Ed25519 private
uint8_t pubkey[32]; // Ed25519 public
uint8_t nodeType;
int32_t latitude;
int32_t longitude;
int32_t altitude;
int8_t txPowerInDbm;
uint32_t frequencyInHz;
uint8_t spreadingFactor;
uint8_t bandwidth;
uint8_t codingRate;
uint16_t preambleLength;
float tcxoVoltage;
uint8_t aesKeys[AESKeyCount][17];
uint8_t password[16];
char nodeName[32];
NodeEntry contacts[CONTACT_COUNT];
uint32_t crc32; // integrity check
} PersistentData_t;
extern PersistentData_t persistent;
void saveConfig();
void loadConfig();
void printNodeDB();
NodeEntry * getNextNode();
NodeEntry * getNode(uint8_t hash);
#endif