A LoRa APRS node with KISS interface based on a Raspberry Pi Pico
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

86 lines
2.5 KiB

#ifndef CONFIG_H
#define CONFIG_H
#define MCU_VARIANT RPI_PICO
#define MTU 255
#define CMD_L 4
int lastRssi = -292;
uint8_t lastRssiRaw = 0x00;
size_t readLength = 0;
#if MCU_VARIANT == RPI_PICO
const int pinNSS = 10;
const int pinNRST = 9;
const int pinDIO0 = 2;
// const int pinLedRx = 5;
// const int pinLedTx = 4;
#endif
#define OFF 0
#define ON 1
const long serialBaudRate = 38400;
const int rssiOffset = 292;
const int loraRxTurnaround = 50;
// Default LoRa settings
int loraSpreadingFactor = 12;
int loraPreamble = 8;
int loraCodingRate = 5;
int loraTxPower = 17;
int LoRaPaSelect = 1;
uint32_t loraBandwidth = 125E3;
uint32_t loraFrequency = 433775000;
uint8_t txBuffer[MTU];
uint8_t rxBuffer[MTU];
uint32_t statRx = 0;
uint32_t statTx = 0;
bool outboundReady = false;
bool statSignalDetected = false;
bool statSignalSynced = false;
bool statRxOngoing = false;
bool dcd = false;
bool dcdLed = false;
bool dcdWaiting = false;
uint16_t dcdCount = 0;
uint16_t dcdThreshold = 15;
uint32_t statusIntervalms = 3;
uint32_t lastStatusUpdate = 0;
// Status flags
const uint8_t SIG_DETECT = 0x01;
const uint8_t SIG_SYNCED = 0x02;
const uint8_t RX_ONGOING = 0x04;
// The size of this struc should be a exactly 256 bytes, which is the FLASH_PAGE_SIZE of the RPi pico's flash memory
struct aprssettings {
uint8_t ValidFlashData = 0x5A; // Indicates flash contains valid data - 1 bytes
uint8_t MyCall[10] = { 'N','O','C','A','L','L','-','2', 0} ; // 10 bytes
uint8_t ServerCall[10] = { 'N','O','C','A','L','L','-','1', 0} ; // 10 bytes
uint8_t Destination[10] = { 'A','P','Z','M','D','M', 0} ; // 10 bytes
uint8_t Path1[10] = { 0,'I','D','E','1','-', '1', 0} ; // 10 bytes
uint8_t Path2[10] = { 0,'I','D','E','2','-', '2', 0} ; // 10 bytes
uint8_t FirmwareVersion[20] = { 'V','1',',','C','o','n','t','r', 'o','l','l','e','r',' ','0','1', 0} ; // 20 bytes
// 71 bytes total
uint8_t FillerData[256-71];
} AprsSettings;
struct status {
bool PowerSupply24V;
bool PowerSupply12V;
bool PowerSupply5V;
bool ControlRelay;
uint8_t StatusString[6] = { '0','0','0','0','0',0};
} Status;
#endif