MAX20361 Demo with LoRa Module on LP1 mode

Dependencies:   SX1276GenericLib USBDevice

Fork of NonPingPong_PICO_LoRa_LP1 by Walter Luu

main.h

Committer:
walterluu
Date:
2020-10-16
Revision:
8:5ff74d7381dc
Parent:
7:6264bc5b6421

File content as of revision 8:5ff74d7381dc:

#include "mbed.h"
#include "PinMap.h"
//#include "GenericPingPong2.h"
//#include "support.h"
#include "sx1276-mbed-hal.h"
#include "global_buffers.h" //adding this for development   

#define FEATURE_LORA


//#ifdef FEATURE_LORA             // in main.cpp

/* Set this flag to '1' to display debug messages on the console */
//#define DEBUG_MESSAGE   1

/* Set this flag to '1' to use the LoRa modulation or to '0' to use FSK modulation */
//#define USE_MODEM_LORA  1
//#define USE_MODEM_FSK   !USE_MODEM_LORA
//#define RF_FREQUENCY            RF_FREQUENCY_915_0  // Hz
//#define TX_OUTPUT_POWER         14                  // 14 dBm

//#if USE_MODEM_LORA == 1

//#define LORA_BANDWIDTH          125000  // LoRa default, details in SX1276::BandwidthMap
//#define LORA_SPREADING_FACTOR   LORA_SF7
//#define LORA_CODINGRATE         LORA_ERROR_CODING_RATE_4_5

//#define LORA_PREAMBLE_LENGTH    8       // Same for Tx and Rx
//#define LORA_SYMBOL_TIMEOUT     5       // Symbols
//#define LORA_FIX_LENGTH_PAYLOAD_ON  false
//#define LORA_FHSS_ENABLED       false  
//#define LORA_NB_SYMB_HOP        4     
//#define LORA_IQ_INVERSION_ON    false
//#define LORA_CRC_ENABLED        true
    
//#elif USE_MODEM_FSK == 1

//#define FSK_FDEV                25000     // Hz
//#define FSK_DATARATE            19200     // bps
//#define FSK_BANDWIDTH           50000     // Hz
//#define FSK_AFC_BANDWIDTH       83333     // Hz
//#define FSK_PREAMBLE_LENGTH     5         // Same for Tx and Rx
//#define FSK_FIX_LENGTH_PAYLOAD_ON   false
//#define FSK_CRC_ENABLED         true
    
//#else
//    #error "Please define a modem in the compiler options."
//#endif 


//#define RX_TIMEOUT_VALUE    3500    // in ms

//#endif

/*
 *  Global variables declarations
 */
//typedef enum
//{
//    LOWPOWER = 0,
//    IDLE,
//    
//    RX,
//    RX_TIMEOUT,
//    RX_ERROR,
//    
//    TX,
//    TX_TIMEOUT,
//    
//    CAD,
//    CAD_DONE
//} AppStates_t;

//const uint8_t PingMsg[] = { 0xff, 0xff, 0x00, 0x00, 'P', 'I', 'N', 'G'};// "PING";
//const uint8_t PongMsg[] = { 0xff, 0xff, 0x00, 0x00, 'P', 'O', 'N', 'G'};// "PONG";

extern void dump(const char *title, const void *data, int len, bool dwords = false);
int SX1276PingPongSetup(uint8_t *BufferTxFromMain, uint8_t *BufferRxFromMain);