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.
 
 
 
 
 
 

98 lines
3.2 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
#define CR 13
const long serialBaudRate = 38400;
const int rssiOffset = 292;
const int loraRxTurnaround = 50;
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 (or a multiple), which is the FLASH_PAGE_SIZE of the RPi pico's flash memory
// Struct can not be bigger than 4kbyte
struct aprssettings {
uint8_t ValidFlashData = 0x5A; // Indicates flash contains valid data - 1 bytes
uint8_t MyCall[10] = { 'P','E','1','R','X','F','-','5', 0, 0} ; // 10 bytes
uint8_t ServerCall[10] = { 'P','E','1','R','X','F','-','3', 0, 0} ; // 10 bytes
uint8_t Destination[10] = { 'A','P','Z','M','D','M', 0, 0, 0 ,0} ; // 10 bytes
uint8_t Path1[10] = { 0,'I','D','E','1','-', '1', 0, 0, 0} ; // 10 bytes
uint8_t Path2[10] = { 0,'I','D','E','2','-', '2', 0, 0 ,0} ; // 10 bytes
uint8_t FirmwareVersion[20] = { 'V','1',',','C','o','n','t','r', 'o','l','l','e','r',' ','0','1', 0, 0, 0, 0} ;
// 20 bytes
// Default LoRa settings
uint16_t loraSpreadingFactor = 12; // 2 bytes
uint16_t loraPreamble = 8; // 2 bytes
uint16_t loraCodingRate = 5; // 2 bytes
uint16_t loraTxPower = 17; // 2 bytes
uint16_t loraPaSelect = 1; // 2 bytes
uint32_t loraBandwidth = 125E3; // 4 bytes
uint32_t loraFrequency = 433775000; // 4 bytes
// Total 89 bytes
uint8_t FillerData[163];
} AprsSettings;
struct status {
bool PowerSupply24V;
bool PowerSupply12V;
bool PowerSupply5V;
bool ControlRelay;
uint8_t StatusString[6] = { '0','0','0','0','0',0};
uint8_t DescriptionString[20] ={ 'N','C',',','C','n','t','r',',','5','V',',','1','2','V',',','2','4','V',0,0};
uint8_t KissMode = OFF;
} Status;
#endif