Team Walter / Mbed OS NonPingPong_PICO_LoRa

Dependencies:   SX1276GenericLib USBDevice

Fork of NonPingPong_PICO_LoRa by Walter Luu

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.h Source File

main.h

00001 #include "mbed.h"
00002 #include "PinMap.h"
00003 //#include "GenericPingPong2.h"
00004 //#include "support.h"
00005 #include "sx1276-mbed-hal.h"
00006 #include "global_buffers.h" //adding this for development   
00007 
00008 #define FEATURE_LORA
00009 
00010 
00011 //#ifdef FEATURE_LORA             // in main.cpp
00012 
00013 /* Set this flag to '1' to display debug messages on the console */
00014 //#define DEBUG_MESSAGE   1
00015 
00016 /* Set this flag to '1' to use the LoRa modulation or to '0' to use FSK modulation */
00017 //#define USE_MODEM_LORA  1
00018 //#define USE_MODEM_FSK   !USE_MODEM_LORA
00019 //#define RF_FREQUENCY            RF_FREQUENCY_915_0  // Hz
00020 //#define TX_OUTPUT_POWER         14                  // 14 dBm
00021 
00022 //#if USE_MODEM_LORA == 1
00023 
00024 //#define LORA_BANDWIDTH          125000  // LoRa default, details in SX1276::BandwidthMap
00025 //#define LORA_SPREADING_FACTOR   LORA_SF7
00026 //#define LORA_CODINGRATE         LORA_ERROR_CODING_RATE_4_5
00027 
00028 //#define LORA_PREAMBLE_LENGTH    8       // Same for Tx and Rx
00029 //#define LORA_SYMBOL_TIMEOUT     5       // Symbols
00030 //#define LORA_FIX_LENGTH_PAYLOAD_ON  false
00031 //#define LORA_FHSS_ENABLED       false  
00032 //#define LORA_NB_SYMB_HOP        4     
00033 //#define LORA_IQ_INVERSION_ON    false
00034 //#define LORA_CRC_ENABLED        true
00035     
00036 //#elif USE_MODEM_FSK == 1
00037 
00038 //#define FSK_FDEV                25000     // Hz
00039 //#define FSK_DATARATE            19200     // bps
00040 //#define FSK_BANDWIDTH           50000     // Hz
00041 //#define FSK_AFC_BANDWIDTH       83333     // Hz
00042 //#define FSK_PREAMBLE_LENGTH     5         // Same for Tx and Rx
00043 //#define FSK_FIX_LENGTH_PAYLOAD_ON   false
00044 //#define FSK_CRC_ENABLED         true
00045     
00046 //#else
00047 //    #error "Please define a modem in the compiler options."
00048 //#endif 
00049 
00050 
00051 //#define RX_TIMEOUT_VALUE    3500    // in ms
00052 
00053 //#endif
00054 
00055 /*
00056  *  Global variables declarations
00057  */
00058 //typedef enum
00059 //{
00060 //    LOWPOWER = 0,
00061 //    IDLE,
00062 //    
00063 //    RX,
00064 //    RX_TIMEOUT,
00065 //    RX_ERROR,
00066 //    
00067 //    TX,
00068 //    TX_TIMEOUT,
00069 //    
00070 //    CAD,
00071 //    CAD_DONE
00072 //} AppStates_t;
00073 
00074 //const uint8_t PingMsg[] = { 0xff, 0xff, 0x00, 0x00, 'P', 'I', 'N', 'G'};// "PING";
00075 //const uint8_t PongMsg[] = { 0xff, 0xff, 0x00, 0x00, 'P', 'O', 'N', 'G'};// "PONG";
00076 
00077 extern void dump(const char *title, const void *data, int len, bool dwords = false);
00078 int SX1276PingPongSetup(uint8_t *BufferTxFromMain, uint8_t *BufferRxFromMain);