to be used with the DSPLoRa module (minor changes wrt transmit power)
Fork of LoRaWAN-lib by
Revision 4:06708c793508, committed 2016-03-31
- Comitter:
- spcores
- Date:
- Thu Mar 31 16:05:20 2016 +0000
- Parent:
- 3:b9d87593a8ae
- Child:
- 5:77f44e83b37d
- Commit message:
- WIP Support for India ISM Band
Changed in this revision
LoRaMac-board.h | Show annotated file Show diff for this revision Revisions of this file |
LoRaMac.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/LoRaMac-board.h Mon Mar 14 09:09:54 2016 +0000 +++ b/LoRaMac-board.h Thu Mar 31 16:05:20 2016 +0000 @@ -205,6 +205,128 @@ #define LC2 { 779700000, { ( ( DR_7 << 4 ) | DR_0 ) }, 0 } #define LC3 { 779900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } +/************************************************************************************/ +/******** India Frequency Declaration Start **********/ +/******** Added by: Sachin Pukale | 31.03.2016 **********/ +/************************************************************************************/ +#elif defined( USE_BAND_865 ) + +/*! + * LoRaMac maximum number of channels + */ +#define LORA_MAX_NB_CHANNELS 8 //SP: original 16 + +/*! + * Minimal datarate that can be used by the node + */ +#define LORAMAC_MIN_DATARATE DR_0 + +/*! + * Minimal datarate that can be used by the node + */ +#define LORAMAC_MAX_DATARATE DR_7 + +/*! + * Default datarate used by the node + */ +#define LORAMAC_DEFAULT_DATARATE DR_4 //DR_0 + +/*! + * Minimal Rx1 receive datarate offset + */ +#define LORAMAC_MIN_RX1_DR_OFFSET 0 + +/*! + * Maximal Rx1 receive datarate offset + */ +#define LORAMAC_MAX_RX1_DR_OFFSET 5 + +/*! + * LoRaMac TxPower definition + */ + +#define TC_POWER_27_DBM 0 //SP:Added support for 27dBM channel(Power = 500mW) +#define TX_POWER_20_DBM 1 +#define TX_POWER_14_DBM 2 +#define TX_POWER_11_DBM 3 +#define TX_POWER_08_DBM 4 +#define TX_POWER_05_DBM 5 +#define TX_POWER_02_DBM 6 + + +/*! + * Minimal Tx output power that can be used by the node + */ +#define LORAMAC_MIN_TX_POWER TX_POWER_02_DBM + +/*! + * Minimal Tx output power that can be used by the node + */ +#define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM + +/*! + * Default Tx output power used by the node + */ +#define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM + + +/*! + * LoRaMac datarates definition + */ +#define DR_0 0 // SF12 - BW125 +#define DR_1 1 // SF11 - BW125 +#define DR_2 2 // SF10 - BW125 +#define DR_3 3 // SF9 - BW125 +#define DR_4 4 // SF8 - BW125 +#define DR_5 5 // SF7 - BW125 +#define DR_6 6 // SF7 - BW250 +#define DR_7 7 // FSK + +/*! + * Second reception window channel definition. + */ +// Channel = { Frequency [Hz], Datarate } +#define RX_WND_2_CHANNEL { 866500000, DR_4 } //SP:Default Rate at SF8 for India + +/*! + * LoRaMac maximum number of bands + */ +#define LORA_MAX_NB_BANDS 1 //5 + +/*! + * LoRaMac EU865 default bands + */ +typedef enum +{ + BAND_G1_0, +/* + BAND_G1_1, + BAND_G1_2, + BAND_G1_3, + BAND_G1_4, +*/ +}BandId_t; + +// Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } +#define BAND0 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % +/* +#define BAND1 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % +#define BAND2 { 1000, TX_POWER_14_DBM, 0, 0 } // 0.1 % +#define BAND3 { 10 , TX_POWER_14_DBM, 0, 0 } // 10.0 % +#define BAND4 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % +*/ + +/*! + * LoRaMac default channels + */ +// Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } +#define LC1 { 865062500, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } +#define LC2 { 865402500, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } +#define LC3 { 865985000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } +/************************************************************************************/ +/******** India Frequency Declaration End **********/ +/************************************************************************************/ + #elif defined( USE_BAND_868 ) /*!
--- a/LoRaMac.cpp Mon Mar 14 09:09:54 2016 +0000 +++ b/LoRaMac.cpp Thu Mar 31 16:05:20 2016 +0000 @@ -259,6 +259,58 @@ LC2, LC3, }; +/************************************************************************************/ +/******** India Frequency Declaration Start **********/ +/******** Added by: Sachin Pukale | 31.03.2016 **********/ +/************************************************************************************/ +#elif defined( USE_BAND_865 ) +/*! + * Data rates table definition + */ +const uint8_t Datarates[] = { 12, 11, 10, 9, 8, 7, 7, 50 }; + +/*! + * Maximum payload with respect to the datarate index. Cannot operate with repeater. + */ +const uint8_t MaxPayloadOfDatarate[] = { 51, 51, 51, 115, 242, 242, 242, 242 }; + +/*! + * Maximum payload with respect to the datarate index. Can operate with repeater. + */ +const uint8_t MaxPayloadOfDatarateRepeater[] = { 51, 51, 51, 115, 222, 222, 222, 222 }; + +/*! + * Tx output powers table definition + */ +const int8_t TxPowers[] = { 27, 20, 14, 11, 8, 5, 2 }; //Added by SP 31.03.2016 + +/*! + * LoRaMac bands + */ +static Band_t Bands[LORA_MAX_NB_BANDS] = +{ + BAND0, + /* + BAND1, + BAND2, + BAND3, + BAND4, +*/ +}; + +/*! + * LoRaMAC channels + */ +static ChannelParams_t Channels[LORA_MAX_NB_CHANNELS] = +{ + LC1, + LC2, + LC3, +}; +/************************************************************************************/ +/******** India Frequency Declaration End **********/ +/************************************************************************************/ + #elif defined( USE_BAND_868 ) /*! * Data rates table definition