end node on synchronous star LoRa network.

Dependencies:   SX127x sx12xx_hal TSL2561

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LoRaMac-definitions.h Source File

LoRaMac-definitions.h

00001 /*
00002  / _____)             _              | |
00003 ( (____  _____ ____ _| |_ _____  ____| |__
00004  \____ \| ___ |    (_   _) ___ |/ ___)  _ \
00005  _____) ) ____| | | || |_| ____( (___| | | |
00006 (______/|_____)_|_|_| \__)_____)\____)_| |_|
00007     (C)2013 Semtech
00008 
00009 Description: LoRa MAC layer global definitions
00010 
00011 License: Revised BSD License, see LICENSE.TXT file include in the project
00012 */
00013 #ifndef __LORAMAC_BOARD_H__
00014 #define __LORAMAC_BOARD_H__
00015 
00016 /*!
00017  * Returns individual channel mask
00018  *
00019  * \param[IN] channelIndex Channel index 1 based
00020  * \retval channelMask
00021  */
00022 #define LC( channelIndex )            ( uint16_t )( 1 << ( channelIndex - 1 ) )
00023 #if defined(SX128x_H)
00024 
00025     #define LORAMAC_DEFAULT_DATARATE                    5       // 5=sf7
00026     #define LORAMAC_DEFAULT_TX_POWER                    0
00027     #define LORAMAC_MAX_TX_POWER                        0
00028     #define LORAMAC_MIN_TX_POWER                        1
00029     #define LORAMAC_MIN_DATARATE                        0   // slowest
00030     #define LORAMAC_MAX_DATARATE                        9   // fastest
00031 
00032 #elif defined( USE_BAND_915_SINGLE ) 
00033 
00034 /*!
00035  * LoRaMac datarates definition
00036  */
00037 //#define DR_0                                        0  // SF10 - BW125 |
00038 //#define DR_1                                        1  // SF9  - BW125 |
00039 //#define DR_2                                        2  // SF8  - BW125 +-> Up link
00040 //#define DR_3                                        3  // SF7  - BW125 |
00041 //#define DR_4                                        4  // SF8  - BW500 |
00042 //#define DR_5                                        5  // RFU
00043 //#define DR_6                                        6  // RFU
00044 //#define DR_7                                        7  // RFU
00045 #define DR_8                                        8  // SF12 - BW500 |
00046 #define DR_9                                        9  // SF11 - BW500 |
00047 #define DR_10                                       10 // SF10 - BW500 |
00048 #define DR_11                                       11 // SF9  - BW500 |
00049 #define DR_12                                       12 // SF8  - BW500 +-> Down link
00050 #define DR_13                                       13 // SF7  - BW500 |
00051 #define DR_14                                       14 // RFU          |
00052 #define DR_15                                       15 // RFU          |
00053 
00054 #define LORAMAC_MAX_TX_POWER                        TX_POWER_20_DBM
00055 #define LORAMAC_MIN_TX_POWER                        TX_POWER_00_DBM
00056 
00057 /*!
00058  * LoRaMac TxPower definition
00059  */
00060 #define TX_POWER_30_DBM                             0
00061 #define TX_POWER_28_DBM                             1
00062 #define TX_POWER_26_DBM                             2
00063 #define TX_POWER_24_DBM                             3
00064 #define TX_POWER_22_DBM                             4
00065 #define TX_POWER_20_DBM                             5
00066 #define TX_POWER_18_DBM                             6
00067 #define TX_POWER_16_DBM                             7
00068 #define TX_POWER_14_DBM                             8
00069 #define TX_POWER_12_DBM                             9
00070 #define TX_POWER_10_DBM                             10
00071 #define TX_POWER_08_DBM                             11
00072 #define TX_POWER_06_DBM                             12
00073 #define TX_POWER_04_DBM                             13
00074 #define TX_POWER_02_DBM                             14
00075 #define TX_POWER_00_DBM                             15
00076 
00077 /*!
00078  * LoRaMac maximum number of bands
00079  */
00080 #define LORA_MAX_NB_BANDS                           1
00081 //
00082 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
00083 #define BAND0              { 1, TX_POWER_20_DBM, 0/*,  0*/ } //  100.0 %
00084 
00085 
00086 /*!
00087  * Default datarate used by the node
00088  */
00089 //#define LORAMAC_DEFAULT_DATARATE                    DR_8   // SINGLE sf12      8192us
00090 //#define LORAMAC_DEFAULT_DATARATE                    DR_9   // SINGLE sf11      4096us
00091 //#define LORAMAC_DEFAULT_DATARATE                    DR_10   // SINGLE sf10   2048us
00092 //#define LORAMAC_DEFAULT_DATARATE                    DR_11   // SINGLE sf9    1024us
00093 //#define LORAMAC_DEFAULT_DATARATE                    DR_12   // SINGLE sf8     512us
00094 #define LORAMAC_DEFAULT_DATARATE                    DR_13   // SINGLE sf7     256us
00095 
00096 /*!
00097  * Default Tx output power used by the node
00098  */
00099 #define LORAMAC_DEFAULT_TX_POWER                    TX_POWER_20_DBM
00100 
00101 /*!
00102  * Minimal (slowest) datarate that can be used by the node
00103  */
00104 #define LORAMAC_MIN_DATARATE                     DR_8
00105 
00106 /*!
00107  * Maximal (fastest) datarate that can be used by the node
00108  */
00109 #define LORAMAC_MAX_DATARATE                     DR_13
00110 
00111     /* end us915 */
00112 #elif defined (USE_BAND_433)
00113     #define TX_POWER_10_DBM    0
00114     #define TX_POWER_07_DBM    1
00115     #define TX_POWER_04_DBM    2
00116     #define TX_POWER_01_DBM    3
00117     #define TX_POWER_M2_DBM    4
00118     #define TX_POWER_M5_DBM    5
00119 
00120     #define LORAMAC_DEFAULT_TX_POWER            TX_POWER_10_DBM
00121 
00122     #define LORAMAC_MIN_TX_POWER                TX_POWER_M5_DBM
00123     #define LORAMAC_MAX_TX_POWER                TX_POWER_10_DBM
00124 
00125     #define DR_0                             0  // SF12 - BW125
00126     #define DR_1                             1  // SF11 - BW125
00127     #define DR_2                             2  // SF10 - BW125
00128     #define DR_3                             3  // SF9  - BW125
00129     #define DR_4                             4  // SF8  - BW125
00130     #define DR_5                             5  // SF7  - BW125
00131     #define DR_6                             6  // SF7  - BW250
00132     #define DR_7                             7  // FSK
00133 
00134     #define LORAMAC_MIN_DATARATE             DR_0   // slowest
00135     #define LORAMAC_MAX_DATARATE             DR_5   // fastest
00136 
00137     //#define LORAMAC_DEFAULT_DATARATE                    DR_0   //  sf12, 32768us
00138     //#define LORAMAC_DEFAULT_DATARATE                    DR_1   //  sf11, 16384us
00139     //#define LORAMAC_DEFAULT_DATARATE                    DR_2   //  sf10, 8192us
00140     //#define LORAMAC_DEFAULT_DATARATE                    DR_3   //  sf9, 4096us
00141     //#define LORAMAC_DEFAULT_DATARATE                    DR_4   //  sf8, 2048us
00142     #define LORAMAC_DEFAULT_DATARATE                    DR_5   //  sf7, 1024us
00143 
00144     /* end USE_BAND_433 */
00145 #else
00146     #error "Please define a frequency band in the compiler options."
00147 #endif
00148 
00149 #endif // __LORAMAC_BOARD_H__