Files
LoraSA/radio/FHSS.h
2025-03-02 20:24:12 -08:00

37 lines
1.1 KiB
C

#include "config.h"
#include <Arduino.h>
#include <LiLyGo.h>
#include <LoRaBoards.h>
#define SYNC_FREQUENCY 915.000
#define MAX_HOP_CHANNELS 5000 // 20 MHz range with 10 kHz step
#define PACKET_SEND_DURATION 1 * 60 * 1000 // 1 minutes in milliseconds
extern float hopTable[MAX_HOP_CHANNELS];
extern uint64_t packetNumber;
extern long int receivedPacketCounter;
extern uint32_t syncWord; // Example sync word (can be any 32-bit value)
extern int numChannels;
// Get the next frequency from the hopping table
extern int hopIndex;
extern unsigned long lastHopTime;
extern unsigned long dwellTime; // 500ms dwell time
extern float currentFreq;
extern uint32_t syncWord; // Example sync word
extern float maxWidthMHz; // Max hopping width of 20 MHz
extern float startFreq; // Start at 900 MHz
extern float stepKHz; // 10 kHz step size
// Function to generate a frequency hopping table, adapting if channels are fewer
int generateFrequencies(uint32_t syncWord, float startFreq, float stepKHz,
float maxWidthMHz);
// Function to print the generated table (for debugging)
void printHopTable(int numChannels);
void updateFrequency();