Forked LoRaWAN-lib for Legacy Gateway testing
Fork of LoRaWAN-lib by
LoRaMac-definitions.h@10:e52525844705, 2017-04-20 (annotated)
- Committer:
- mick_ccc
- Date:
- Thu Apr 20 14:26:48 2017 +0000
- Revision:
- 10:e52525844705
- Parent:
- 8:2d237e069df2
Hacked for Legacy Gateway testing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mluis | 0:91d1a7783bb9 | 1 | /* |
mluis | 0:91d1a7783bb9 | 2 | / _____) _ | | |
mluis | 0:91d1a7783bb9 | 3 | ( (____ _____ ____ _| |_ _____ ____| |__ |
mluis | 0:91d1a7783bb9 | 4 | \____ \| ___ | (_ _) ___ |/ ___) _ \ |
mluis | 0:91d1a7783bb9 | 5 | _____) ) ____| | | || |_| ____( (___| | | | |
mluis | 0:91d1a7783bb9 | 6 | (______/|_____)_|_|_| \__)_____)\____)_| |_| |
mluis | 0:91d1a7783bb9 | 7 | (C)2013 Semtech |
mluis | 0:91d1a7783bb9 | 8 | |
mluis | 7:c16969e0f70f | 9 | Description: LoRa MAC layer global definitions |
mluis | 0:91d1a7783bb9 | 10 | |
mluis | 0:91d1a7783bb9 | 11 | License: Revised BSD License, see LICENSE.TXT file include in the project |
mluis | 0:91d1a7783bb9 | 12 | |
mluis | 0:91d1a7783bb9 | 13 | Maintainer: Miguel Luis and Gregory Cristian |
mluis | 0:91d1a7783bb9 | 14 | */ |
mluis | 0:91d1a7783bb9 | 15 | #ifndef __LORAMAC_BOARD_H__ |
mluis | 0:91d1a7783bb9 | 16 | #define __LORAMAC_BOARD_H__ |
mluis | 0:91d1a7783bb9 | 17 | |
mluis | 0:91d1a7783bb9 | 18 | /*! |
mluis | 0:91d1a7783bb9 | 19 | * Returns individual channel mask |
mluis | 0:91d1a7783bb9 | 20 | * |
mluis | 0:91d1a7783bb9 | 21 | * \param[IN] channelIndex Channel index 1 based |
mluis | 0:91d1a7783bb9 | 22 | * \retval channelMask |
mluis | 0:91d1a7783bb9 | 23 | */ |
mluis | 0:91d1a7783bb9 | 24 | #define LC( channelIndex ) ( uint16_t )( 1 << ( channelIndex - 1 ) ) |
mluis | 0:91d1a7783bb9 | 25 | |
mluis | 0:91d1a7783bb9 | 26 | #if defined( USE_BAND_433 ) |
mluis | 0:91d1a7783bb9 | 27 | |
mluis | 0:91d1a7783bb9 | 28 | /*! |
mluis | 0:91d1a7783bb9 | 29 | * LoRaMac maximum number of channels |
mluis | 0:91d1a7783bb9 | 30 | */ |
mluis | 0:91d1a7783bb9 | 31 | #define LORA_MAX_NB_CHANNELS 16 |
mluis | 0:91d1a7783bb9 | 32 | |
mluis | 0:91d1a7783bb9 | 33 | /*! |
mluis | 0:91d1a7783bb9 | 34 | * Minimal datarate that can be used by the node |
mluis | 0:91d1a7783bb9 | 35 | */ |
mluis | 4:37c12dbc8dc7 | 36 | #define LORAMAC_TX_MIN_DATARATE DR_0 |
mluis | 0:91d1a7783bb9 | 37 | |
mluis | 0:91d1a7783bb9 | 38 | /*! |
mluis | 7:c16969e0f70f | 39 | * Maximal datarate that can be used by the node |
mluis | 0:91d1a7783bb9 | 40 | */ |
mluis | 4:37c12dbc8dc7 | 41 | #define LORAMAC_TX_MAX_DATARATE DR_7 |
mluis | 4:37c12dbc8dc7 | 42 | |
mluis | 4:37c12dbc8dc7 | 43 | /*! |
mluis | 4:37c12dbc8dc7 | 44 | * Minimal datarate that can be used by the node |
mluis | 4:37c12dbc8dc7 | 45 | */ |
mluis | 4:37c12dbc8dc7 | 46 | #define LORAMAC_RX_MIN_DATARATE DR_0 |
mluis | 4:37c12dbc8dc7 | 47 | |
mluis | 4:37c12dbc8dc7 | 48 | /*! |
mluis | 7:c16969e0f70f | 49 | * Maximal datarate that can be used by the node |
mluis | 4:37c12dbc8dc7 | 50 | */ |
mluis | 4:37c12dbc8dc7 | 51 | #define LORAMAC_RX_MAX_DATARATE DR_7 |
mluis | 0:91d1a7783bb9 | 52 | |
mluis | 0:91d1a7783bb9 | 53 | /*! |
mluis | 0:91d1a7783bb9 | 54 | * Default datarate used by the node |
mluis | 0:91d1a7783bb9 | 55 | */ |
mluis | 0:91d1a7783bb9 | 56 | #define LORAMAC_DEFAULT_DATARATE DR_0 |
mluis | 0:91d1a7783bb9 | 57 | |
mluis | 0:91d1a7783bb9 | 58 | /*! |
mluis | 1:91e4e6c60d1e | 59 | * Minimal Rx1 receive datarate offset |
mluis | 1:91e4e6c60d1e | 60 | */ |
mluis | 1:91e4e6c60d1e | 61 | #define LORAMAC_MIN_RX1_DR_OFFSET 0 |
mluis | 1:91e4e6c60d1e | 62 | |
mluis | 1:91e4e6c60d1e | 63 | /*! |
mluis | 1:91e4e6c60d1e | 64 | * Maximal Rx1 receive datarate offset |
mluis | 1:91e4e6c60d1e | 65 | */ |
mluis | 1:91e4e6c60d1e | 66 | #define LORAMAC_MAX_RX1_DR_OFFSET 5 |
mluis | 1:91e4e6c60d1e | 67 | |
mluis | 1:91e4e6c60d1e | 68 | /*! |
mluis | 0:91d1a7783bb9 | 69 | * Minimal Tx output power that can be used by the node |
mluis | 0:91d1a7783bb9 | 70 | */ |
mluis | 0:91d1a7783bb9 | 71 | #define LORAMAC_MIN_TX_POWER TX_POWER_M5_DBM |
mluis | 0:91d1a7783bb9 | 72 | |
mluis | 0:91d1a7783bb9 | 73 | /*! |
mluis | 7:c16969e0f70f | 74 | * Maximal Tx output power that can be used by the node |
mluis | 0:91d1a7783bb9 | 75 | */ |
mluis | 0:91d1a7783bb9 | 76 | #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM |
mluis | 0:91d1a7783bb9 | 77 | |
mluis | 0:91d1a7783bb9 | 78 | /*! |
mluis | 0:91d1a7783bb9 | 79 | * Default Tx output power used by the node |
mluis | 0:91d1a7783bb9 | 80 | */ |
mluis | 0:91d1a7783bb9 | 81 | #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM |
mluis | 0:91d1a7783bb9 | 82 | |
mluis | 0:91d1a7783bb9 | 83 | /*! |
mluis | 0:91d1a7783bb9 | 84 | * LoRaMac TxPower definition |
mluis | 0:91d1a7783bb9 | 85 | */ |
mluis | 0:91d1a7783bb9 | 86 | #define TX_POWER_10_DBM 0 |
mluis | 0:91d1a7783bb9 | 87 | #define TX_POWER_07_DBM 1 |
mluis | 0:91d1a7783bb9 | 88 | #define TX_POWER_04_DBM 2 |
mluis | 0:91d1a7783bb9 | 89 | #define TX_POWER_01_DBM 3 |
mluis | 0:91d1a7783bb9 | 90 | #define TX_POWER_M2_DBM 4 |
mluis | 0:91d1a7783bb9 | 91 | #define TX_POWER_M5_DBM 5 |
mluis | 0:91d1a7783bb9 | 92 | |
mluis | 0:91d1a7783bb9 | 93 | /*! |
mluis | 0:91d1a7783bb9 | 94 | * LoRaMac datarates definition |
mluis | 0:91d1a7783bb9 | 95 | */ |
mluis | 0:91d1a7783bb9 | 96 | #define DR_0 0 // SF12 - BW125 |
mluis | 0:91d1a7783bb9 | 97 | #define DR_1 1 // SF11 - BW125 |
mluis | 0:91d1a7783bb9 | 98 | #define DR_2 2 // SF10 - BW125 |
mluis | 0:91d1a7783bb9 | 99 | #define DR_3 3 // SF9 - BW125 |
mluis | 0:91d1a7783bb9 | 100 | #define DR_4 4 // SF8 - BW125 |
mluis | 0:91d1a7783bb9 | 101 | #define DR_5 5 // SF7 - BW125 |
mluis | 0:91d1a7783bb9 | 102 | #define DR_6 6 // SF7 - BW250 |
mluis | 0:91d1a7783bb9 | 103 | #define DR_7 7 // FSK |
mluis | 0:91d1a7783bb9 | 104 | |
mluis | 0:91d1a7783bb9 | 105 | /*! |
mluis | 8:2d237e069df2 | 106 | * Verification of default datarate |
mluis | 8:2d237e069df2 | 107 | */ |
mluis | 8:2d237e069df2 | 108 | #if ( LORAMAC_DEFAULT_DATARATE > DR_5 ) |
mluis | 8:2d237e069df2 | 109 | #error "A default DR higher than DR_5 may lead to connectivity loss." |
mluis | 8:2d237e069df2 | 110 | #endif |
mluis | 8:2d237e069df2 | 111 | |
mluis | 8:2d237e069df2 | 112 | /*! |
mluis | 0:91d1a7783bb9 | 113 | * Second reception window channel definition. |
mluis | 0:91d1a7783bb9 | 114 | */ |
mluis | 0:91d1a7783bb9 | 115 | // Channel = { Frequency [Hz], Datarate } |
mluis | 0:91d1a7783bb9 | 116 | #define RX_WND_2_CHANNEL { 434665000, DR_0 } |
mluis | 0:91d1a7783bb9 | 117 | |
mluis | 0:91d1a7783bb9 | 118 | /*! |
mluis | 0:91d1a7783bb9 | 119 | * LoRaMac maximum number of bands |
mluis | 0:91d1a7783bb9 | 120 | */ |
mluis | 0:91d1a7783bb9 | 121 | #define LORA_MAX_NB_BANDS 1 |
mluis | 0:91d1a7783bb9 | 122 | |
mluis | 0:91d1a7783bb9 | 123 | // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } |
mluis | 0:91d1a7783bb9 | 124 | #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 % |
mluis | 0:91d1a7783bb9 | 125 | |
mluis | 0:91d1a7783bb9 | 126 | /*! |
mluis | 0:91d1a7783bb9 | 127 | * LoRaMac default channels |
mluis | 0:91d1a7783bb9 | 128 | */ |
mluis | 0:91d1a7783bb9 | 129 | // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } |
mluis | 0:91d1a7783bb9 | 130 | #define LC1 { 433175000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } |
mluis | 4:37c12dbc8dc7 | 131 | #define LC2 { 433375000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } |
mluis | 0:91d1a7783bb9 | 132 | #define LC3 { 433575000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } |
mluis | 0:91d1a7783bb9 | 133 | |
mluis | 4:37c12dbc8dc7 | 134 | /*! |
mluis | 4:37c12dbc8dc7 | 135 | * LoRaMac channels which are allowed for the join procedure |
mluis | 4:37c12dbc8dc7 | 136 | */ |
mluis | 4:37c12dbc8dc7 | 137 | #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) ) |
mluis | 4:37c12dbc8dc7 | 138 | |
mluis | 8:2d237e069df2 | 139 | #elif defined( USE_BAND_470 ) |
mluis | 8:2d237e069df2 | 140 | |
mluis | 8:2d237e069df2 | 141 | /*! |
mluis | 8:2d237e069df2 | 142 | * LoRaMac maximum number of channels |
mluis | 8:2d237e069df2 | 143 | */ |
mluis | 8:2d237e069df2 | 144 | #define LORA_MAX_NB_CHANNELS 96 |
mluis | 8:2d237e069df2 | 145 | |
mluis | 8:2d237e069df2 | 146 | /*! |
mluis | 8:2d237e069df2 | 147 | * Minimal datarate that can be used by the node |
mluis | 8:2d237e069df2 | 148 | */ |
mluis | 8:2d237e069df2 | 149 | #define LORAMAC_TX_MIN_DATARATE DR_0 |
mluis | 8:2d237e069df2 | 150 | |
mluis | 8:2d237e069df2 | 151 | /*! |
mluis | 8:2d237e069df2 | 152 | * Maximal datarate that can be used by the node |
mluis | 8:2d237e069df2 | 153 | */ |
mluis | 8:2d237e069df2 | 154 | #define LORAMAC_TX_MAX_DATARATE DR_5 |
mluis | 8:2d237e069df2 | 155 | |
mluis | 8:2d237e069df2 | 156 | /*! |
mluis | 8:2d237e069df2 | 157 | * Minimal datarate that can be used by the node |
mluis | 8:2d237e069df2 | 158 | */ |
mluis | 8:2d237e069df2 | 159 | #define LORAMAC_RX_MIN_DATARATE DR_0 |
mluis | 8:2d237e069df2 | 160 | |
mluis | 8:2d237e069df2 | 161 | /*! |
mluis | 8:2d237e069df2 | 162 | * Maximal datarate that can be used by the node |
mluis | 8:2d237e069df2 | 163 | */ |
mluis | 8:2d237e069df2 | 164 | #define LORAMAC_RX_MAX_DATARATE DR_5 |
mluis | 8:2d237e069df2 | 165 | |
mluis | 8:2d237e069df2 | 166 | /*! |
mluis | 8:2d237e069df2 | 167 | * Default datarate used by the node |
mluis | 8:2d237e069df2 | 168 | */ |
mluis | 8:2d237e069df2 | 169 | #define LORAMAC_DEFAULT_DATARATE DR_0 |
mluis | 8:2d237e069df2 | 170 | |
mluis | 8:2d237e069df2 | 171 | /*! |
mluis | 8:2d237e069df2 | 172 | * Minimal Rx1 receive datarate offset |
mluis | 8:2d237e069df2 | 173 | */ |
mluis | 8:2d237e069df2 | 174 | #define LORAMAC_MIN_RX1_DR_OFFSET 0 |
mluis | 8:2d237e069df2 | 175 | |
mluis | 8:2d237e069df2 | 176 | /*! |
mluis | 8:2d237e069df2 | 177 | * Maximal Rx1 receive datarate offset |
mluis | 8:2d237e069df2 | 178 | */ |
mluis | 8:2d237e069df2 | 179 | #define LORAMAC_MAX_RX1_DR_OFFSET 3 |
mluis | 8:2d237e069df2 | 180 | |
mluis | 8:2d237e069df2 | 181 | /*! |
mluis | 8:2d237e069df2 | 182 | * Minimal Tx output power that can be used by the node |
mluis | 8:2d237e069df2 | 183 | */ |
mluis | 8:2d237e069df2 | 184 | #define LORAMAC_MIN_TX_POWER TX_POWER_2_DBM |
mluis | 8:2d237e069df2 | 185 | |
mluis | 8:2d237e069df2 | 186 | /*! |
mluis | 8:2d237e069df2 | 187 | * Maximal Tx output power that can be used by the node |
mluis | 8:2d237e069df2 | 188 | */ |
mluis | 8:2d237e069df2 | 189 | #define LORAMAC_MAX_TX_POWER TX_POWER_17_DBM |
mluis | 8:2d237e069df2 | 190 | |
mluis | 8:2d237e069df2 | 191 | /*! |
mluis | 8:2d237e069df2 | 192 | * Default Tx output power used by the node |
mluis | 8:2d237e069df2 | 193 | */ |
mluis | 8:2d237e069df2 | 194 | #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM |
mluis | 8:2d237e069df2 | 195 | |
mluis | 8:2d237e069df2 | 196 | /*! |
mluis | 8:2d237e069df2 | 197 | * LoRaMac TxPower definition |
mluis | 8:2d237e069df2 | 198 | */ |
mluis | 8:2d237e069df2 | 199 | #define TX_POWER_17_DBM 0 |
mluis | 8:2d237e069df2 | 200 | #define TX_POWER_16_DBM 1 |
mluis | 8:2d237e069df2 | 201 | #define TX_POWER_14_DBM 2 |
mluis | 8:2d237e069df2 | 202 | #define TX_POWER_12_DBM 3 |
mluis | 8:2d237e069df2 | 203 | #define TX_POWER_10_DBM 4 |
mluis | 8:2d237e069df2 | 204 | #define TX_POWER_7_DBM 5 |
mluis | 8:2d237e069df2 | 205 | #define TX_POWER_5_DBM 6 |
mluis | 8:2d237e069df2 | 206 | #define TX_POWER_2_DBM 7 |
mluis | 8:2d237e069df2 | 207 | |
mluis | 8:2d237e069df2 | 208 | |
mluis | 8:2d237e069df2 | 209 | /*! |
mluis | 8:2d237e069df2 | 210 | * LoRaMac datarates definition |
mluis | 8:2d237e069df2 | 211 | */ |
mluis | 8:2d237e069df2 | 212 | #define DR_0 0 // SF12 - BW125 | |
mluis | 8:2d237e069df2 | 213 | #define DR_1 1 // SF11 - BW125 | |
mluis | 8:2d237e069df2 | 214 | #define DR_2 2 // SF10 - BW125 | |
mluis | 8:2d237e069df2 | 215 | #define DR_3 3 // SF9 - BW125 | |
mluis | 8:2d237e069df2 | 216 | #define DR_4 4 // SF8 - BW125 | |
mluis | 8:2d237e069df2 | 217 | #define DR_5 5 // SF7 - BW125 | |
mluis | 8:2d237e069df2 | 218 | |
mluis | 8:2d237e069df2 | 219 | /*! |
mluis | 8:2d237e069df2 | 220 | * Second reception window channel definition. |
mluis | 8:2d237e069df2 | 221 | */ |
mluis | 8:2d237e069df2 | 222 | // Channel = { Frequency [Hz], Datarate } |
mluis | 8:2d237e069df2 | 223 | #define RX_WND_2_CHANNEL { 505300000, DR_0 } |
mluis | 8:2d237e069df2 | 224 | |
mluis | 8:2d237e069df2 | 225 | /*! |
mluis | 8:2d237e069df2 | 226 | * LoRaMac maximum number of bands |
mluis | 8:2d237e069df2 | 227 | */ |
mluis | 8:2d237e069df2 | 228 | #define LORA_MAX_NB_BANDS 1 |
mluis | 8:2d237e069df2 | 229 | |
mluis | 8:2d237e069df2 | 230 | // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } |
mluis | 8:2d237e069df2 | 231 | #define BAND0 { 1, TX_POWER_17_DBM, 0, 0 } // 100.0 % |
mluis | 8:2d237e069df2 | 232 | |
mluis | 0:91d1a7783bb9 | 233 | #elif defined( USE_BAND_780 ) |
mluis | 0:91d1a7783bb9 | 234 | |
mluis | 0:91d1a7783bb9 | 235 | /*! |
mluis | 0:91d1a7783bb9 | 236 | * LoRaMac maximum number of channels |
mluis | 0:91d1a7783bb9 | 237 | */ |
mluis | 0:91d1a7783bb9 | 238 | #define LORA_MAX_NB_CHANNELS 16 |
mluis | 0:91d1a7783bb9 | 239 | |
mluis | 0:91d1a7783bb9 | 240 | /*! |
mluis | 0:91d1a7783bb9 | 241 | * Minimal datarate that can be used by the node |
mluis | 0:91d1a7783bb9 | 242 | */ |
mluis | 4:37c12dbc8dc7 | 243 | #define LORAMAC_TX_MIN_DATARATE DR_0 |
mluis | 0:91d1a7783bb9 | 244 | |
mluis | 0:91d1a7783bb9 | 245 | /*! |
mluis | 7:c16969e0f70f | 246 | * Maximal datarate that can be used by the node |
mluis | 0:91d1a7783bb9 | 247 | */ |
mluis | 4:37c12dbc8dc7 | 248 | #define LORAMAC_TX_MAX_DATARATE DR_7 |
mluis | 4:37c12dbc8dc7 | 249 | |
mluis | 4:37c12dbc8dc7 | 250 | /*! |
mluis | 4:37c12dbc8dc7 | 251 | * Minimal datarate that can be used by the node |
mluis | 4:37c12dbc8dc7 | 252 | */ |
mluis | 4:37c12dbc8dc7 | 253 | #define LORAMAC_RX_MIN_DATARATE DR_0 |
mluis | 4:37c12dbc8dc7 | 254 | |
mluis | 4:37c12dbc8dc7 | 255 | /*! |
mluis | 7:c16969e0f70f | 256 | * Maximal datarate that can be used by the node |
mluis | 4:37c12dbc8dc7 | 257 | */ |
mluis | 4:37c12dbc8dc7 | 258 | #define LORAMAC_RX_MAX_DATARATE DR_7 |
mluis | 0:91d1a7783bb9 | 259 | |
mluis | 0:91d1a7783bb9 | 260 | /*! |
mluis | 0:91d1a7783bb9 | 261 | * Default datarate used by the node |
mluis | 0:91d1a7783bb9 | 262 | */ |
mluis | 0:91d1a7783bb9 | 263 | #define LORAMAC_DEFAULT_DATARATE DR_0 |
mluis | 0:91d1a7783bb9 | 264 | |
mluis | 0:91d1a7783bb9 | 265 | /*! |
mluis | 1:91e4e6c60d1e | 266 | * Minimal Rx1 receive datarate offset |
mluis | 1:91e4e6c60d1e | 267 | */ |
mluis | 1:91e4e6c60d1e | 268 | #define LORAMAC_MIN_RX1_DR_OFFSET 0 |
mluis | 1:91e4e6c60d1e | 269 | |
mluis | 1:91e4e6c60d1e | 270 | /*! |
mluis | 1:91e4e6c60d1e | 271 | * Maximal Rx1 receive datarate offset |
mluis | 1:91e4e6c60d1e | 272 | */ |
mluis | 1:91e4e6c60d1e | 273 | #define LORAMAC_MAX_RX1_DR_OFFSET 5 |
mluis | 1:91e4e6c60d1e | 274 | |
mluis | 1:91e4e6c60d1e | 275 | /*! |
mluis | 0:91d1a7783bb9 | 276 | * Minimal Tx output power that can be used by the node |
mluis | 0:91d1a7783bb9 | 277 | */ |
mluis | 0:91d1a7783bb9 | 278 | #define LORAMAC_MIN_TX_POWER TX_POWER_M5_DBM |
mluis | 0:91d1a7783bb9 | 279 | |
mluis | 0:91d1a7783bb9 | 280 | /*! |
mluis | 7:c16969e0f70f | 281 | * Maximal Tx output power that can be used by the node |
mluis | 0:91d1a7783bb9 | 282 | */ |
mluis | 0:91d1a7783bb9 | 283 | #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM |
mluis | 0:91d1a7783bb9 | 284 | |
mluis | 0:91d1a7783bb9 | 285 | /*! |
mluis | 0:91d1a7783bb9 | 286 | * Default Tx output power used by the node |
mluis | 0:91d1a7783bb9 | 287 | */ |
mluis | 0:91d1a7783bb9 | 288 | #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM |
mluis | 0:91d1a7783bb9 | 289 | |
mluis | 0:91d1a7783bb9 | 290 | /*! |
mluis | 0:91d1a7783bb9 | 291 | * LoRaMac TxPower definition |
mluis | 0:91d1a7783bb9 | 292 | */ |
mluis | 0:91d1a7783bb9 | 293 | #define TX_POWER_10_DBM 0 |
mluis | 0:91d1a7783bb9 | 294 | #define TX_POWER_07_DBM 1 |
mluis | 0:91d1a7783bb9 | 295 | #define TX_POWER_04_DBM 2 |
mluis | 0:91d1a7783bb9 | 296 | #define TX_POWER_01_DBM 3 |
mluis | 0:91d1a7783bb9 | 297 | #define TX_POWER_M2_DBM 4 |
mluis | 0:91d1a7783bb9 | 298 | #define TX_POWER_M5_DBM 5 |
mluis | 0:91d1a7783bb9 | 299 | |
mluis | 0:91d1a7783bb9 | 300 | /*! |
mluis | 0:91d1a7783bb9 | 301 | * LoRaMac datarates definition |
mluis | 0:91d1a7783bb9 | 302 | */ |
mluis | 0:91d1a7783bb9 | 303 | #define DR_0 0 // SF12 - BW125 |
mluis | 0:91d1a7783bb9 | 304 | #define DR_1 1 // SF11 - BW125 |
mluis | 0:91d1a7783bb9 | 305 | #define DR_2 2 // SF10 - BW125 |
mluis | 0:91d1a7783bb9 | 306 | #define DR_3 3 // SF9 - BW125 |
mluis | 0:91d1a7783bb9 | 307 | #define DR_4 4 // SF8 - BW125 |
mluis | 0:91d1a7783bb9 | 308 | #define DR_5 5 // SF7 - BW125 |
mluis | 0:91d1a7783bb9 | 309 | #define DR_6 6 // SF7 - BW250 |
mluis | 0:91d1a7783bb9 | 310 | #define DR_7 7 // FSK |
mluis | 0:91d1a7783bb9 | 311 | |
mluis | 0:91d1a7783bb9 | 312 | /*! |
mluis | 8:2d237e069df2 | 313 | * Verification of default datarate |
mluis | 8:2d237e069df2 | 314 | */ |
mluis | 8:2d237e069df2 | 315 | #if ( LORAMAC_DEFAULT_DATARATE > DR_5 ) |
mluis | 8:2d237e069df2 | 316 | #error "A default DR higher than DR_5 may lead to connectivity loss." |
mluis | 8:2d237e069df2 | 317 | #endif |
mluis | 8:2d237e069df2 | 318 | |
mluis | 8:2d237e069df2 | 319 | /*! |
mluis | 0:91d1a7783bb9 | 320 | * Second reception window channel definition. |
mluis | 0:91d1a7783bb9 | 321 | */ |
mluis | 0:91d1a7783bb9 | 322 | // Channel = { Frequency [Hz], Datarate } |
mluis | 0:91d1a7783bb9 | 323 | #define RX_WND_2_CHANNEL { 786000000, DR_0 } |
mluis | 0:91d1a7783bb9 | 324 | |
mluis | 0:91d1a7783bb9 | 325 | /*! |
mluis | 0:91d1a7783bb9 | 326 | * LoRaMac maximum number of bands |
mluis | 0:91d1a7783bb9 | 327 | */ |
mluis | 0:91d1a7783bb9 | 328 | #define LORA_MAX_NB_BANDS 1 |
mluis | 0:91d1a7783bb9 | 329 | |
mluis | 0:91d1a7783bb9 | 330 | // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } |
mluis | 0:91d1a7783bb9 | 331 | #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 % |
mluis | 0:91d1a7783bb9 | 332 | |
mluis | 0:91d1a7783bb9 | 333 | /*! |
mluis | 0:91d1a7783bb9 | 334 | * LoRaMac default channels |
mluis | 0:91d1a7783bb9 | 335 | */ |
mluis | 0:91d1a7783bb9 | 336 | // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } |
mluis | 0:91d1a7783bb9 | 337 | #define LC1 { 779500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } |
mluis | 4:37c12dbc8dc7 | 338 | #define LC2 { 779700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } |
mluis | 0:91d1a7783bb9 | 339 | #define LC3 { 779900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } |
mluis | 0:91d1a7783bb9 | 340 | |
mluis | 4:37c12dbc8dc7 | 341 | /*! |
mluis | 4:37c12dbc8dc7 | 342 | * LoRaMac channels which are allowed for the join procedure |
mluis | 4:37c12dbc8dc7 | 343 | */ |
mluis | 4:37c12dbc8dc7 | 344 | #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) ) |
mluis | 4:37c12dbc8dc7 | 345 | |
mluis | 0:91d1a7783bb9 | 346 | #elif defined( USE_BAND_868 ) |
mluis | 0:91d1a7783bb9 | 347 | |
mluis | 0:91d1a7783bb9 | 348 | /*! |
mluis | 0:91d1a7783bb9 | 349 | * LoRaMac maximum number of channels |
mluis | 0:91d1a7783bb9 | 350 | */ |
mluis | 0:91d1a7783bb9 | 351 | #define LORA_MAX_NB_CHANNELS 16 |
mluis | 0:91d1a7783bb9 | 352 | |
mluis | 0:91d1a7783bb9 | 353 | /*! |
mluis | 0:91d1a7783bb9 | 354 | * Minimal datarate that can be used by the node |
mluis | 0:91d1a7783bb9 | 355 | */ |
mluis | 4:37c12dbc8dc7 | 356 | #define LORAMAC_TX_MIN_DATARATE DR_0 |
mluis | 0:91d1a7783bb9 | 357 | |
mluis | 0:91d1a7783bb9 | 358 | /*! |
mluis | 7:c16969e0f70f | 359 | * Maximal datarate that can be used by the node |
mluis | 0:91d1a7783bb9 | 360 | */ |
mluis | 4:37c12dbc8dc7 | 361 | #define LORAMAC_TX_MAX_DATARATE DR_7 |
mluis | 4:37c12dbc8dc7 | 362 | |
mluis | 4:37c12dbc8dc7 | 363 | /*! |
mluis | 4:37c12dbc8dc7 | 364 | * Minimal datarate that can be used by the node |
mluis | 4:37c12dbc8dc7 | 365 | */ |
mluis | 4:37c12dbc8dc7 | 366 | #define LORAMAC_RX_MIN_DATARATE DR_0 |
mluis | 4:37c12dbc8dc7 | 367 | |
mluis | 4:37c12dbc8dc7 | 368 | /*! |
mluis | 7:c16969e0f70f | 369 | * Maximal datarate that can be used by the node |
mluis | 4:37c12dbc8dc7 | 370 | */ |
mluis | 4:37c12dbc8dc7 | 371 | #define LORAMAC_RX_MAX_DATARATE DR_7 |
mluis | 0:91d1a7783bb9 | 372 | |
mluis | 0:91d1a7783bb9 | 373 | /*! |
mluis | 0:91d1a7783bb9 | 374 | * Default datarate used by the node |
mluis | 0:91d1a7783bb9 | 375 | */ |
mluis | 0:91d1a7783bb9 | 376 | #define LORAMAC_DEFAULT_DATARATE DR_0 |
mluis | 0:91d1a7783bb9 | 377 | |
mluis | 0:91d1a7783bb9 | 378 | /*! |
mluis | 1:91e4e6c60d1e | 379 | * Minimal Rx1 receive datarate offset |
mluis | 1:91e4e6c60d1e | 380 | */ |
mluis | 1:91e4e6c60d1e | 381 | #define LORAMAC_MIN_RX1_DR_OFFSET 0 |
mluis | 1:91e4e6c60d1e | 382 | |
mluis | 1:91e4e6c60d1e | 383 | /*! |
mluis | 1:91e4e6c60d1e | 384 | * Maximal Rx1 receive datarate offset |
mluis | 1:91e4e6c60d1e | 385 | */ |
mluis | 1:91e4e6c60d1e | 386 | #define LORAMAC_MAX_RX1_DR_OFFSET 5 |
mluis | 1:91e4e6c60d1e | 387 | |
mluis | 1:91e4e6c60d1e | 388 | /*! |
mluis | 0:91d1a7783bb9 | 389 | * Minimal Tx output power that can be used by the node |
mluis | 0:91d1a7783bb9 | 390 | */ |
mluis | 0:91d1a7783bb9 | 391 | #define LORAMAC_MIN_TX_POWER TX_POWER_02_DBM |
mluis | 0:91d1a7783bb9 | 392 | |
mluis | 0:91d1a7783bb9 | 393 | /*! |
mluis | 7:c16969e0f70f | 394 | * Maximal Tx output power that can be used by the node |
mluis | 0:91d1a7783bb9 | 395 | */ |
mluis | 0:91d1a7783bb9 | 396 | #define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM |
mluis | 0:91d1a7783bb9 | 397 | |
mluis | 0:91d1a7783bb9 | 398 | /*! |
mluis | 0:91d1a7783bb9 | 399 | * Default Tx output power used by the node |
mluis | 0:91d1a7783bb9 | 400 | */ |
mluis | 0:91d1a7783bb9 | 401 | #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM |
mluis | 0:91d1a7783bb9 | 402 | |
mluis | 0:91d1a7783bb9 | 403 | /*! |
mluis | 0:91d1a7783bb9 | 404 | * LoRaMac TxPower definition |
mluis | 0:91d1a7783bb9 | 405 | */ |
mluis | 0:91d1a7783bb9 | 406 | #define TX_POWER_20_DBM 0 |
mluis | 0:91d1a7783bb9 | 407 | #define TX_POWER_14_DBM 1 |
mluis | 0:91d1a7783bb9 | 408 | #define TX_POWER_11_DBM 2 |
mluis | 0:91d1a7783bb9 | 409 | #define TX_POWER_08_DBM 3 |
mluis | 0:91d1a7783bb9 | 410 | #define TX_POWER_05_DBM 4 |
mluis | 0:91d1a7783bb9 | 411 | #define TX_POWER_02_DBM 5 |
mluis | 0:91d1a7783bb9 | 412 | |
mluis | 0:91d1a7783bb9 | 413 | /*! |
mluis | 0:91d1a7783bb9 | 414 | * LoRaMac datarates definition |
mluis | 0:91d1a7783bb9 | 415 | */ |
mluis | 0:91d1a7783bb9 | 416 | #define DR_0 0 // SF12 - BW125 |
mluis | 0:91d1a7783bb9 | 417 | #define DR_1 1 // SF11 - BW125 |
mluis | 0:91d1a7783bb9 | 418 | #define DR_2 2 // SF10 - BW125 |
mluis | 0:91d1a7783bb9 | 419 | #define DR_3 3 // SF9 - BW125 |
mluis | 0:91d1a7783bb9 | 420 | #define DR_4 4 // SF8 - BW125 |
mluis | 0:91d1a7783bb9 | 421 | #define DR_5 5 // SF7 - BW125 |
mluis | 0:91d1a7783bb9 | 422 | #define DR_6 6 // SF7 - BW250 |
mluis | 0:91d1a7783bb9 | 423 | #define DR_7 7 // FSK |
mluis | 0:91d1a7783bb9 | 424 | |
mluis | 0:91d1a7783bb9 | 425 | /*! |
mluis | 8:2d237e069df2 | 426 | * Verification of default datarate |
mluis | 8:2d237e069df2 | 427 | */ |
mluis | 8:2d237e069df2 | 428 | #if ( LORAMAC_DEFAULT_DATARATE > DR_5 ) |
mluis | 8:2d237e069df2 | 429 | #error "A default DR higher than DR_5 may lead to connectivity loss." |
mluis | 8:2d237e069df2 | 430 | #endif |
mluis | 8:2d237e069df2 | 431 | |
mluis | 8:2d237e069df2 | 432 | /*! |
mluis | 0:91d1a7783bb9 | 433 | * Second reception window channel definition. |
mluis | 0:91d1a7783bb9 | 434 | */ |
mluis | 0:91d1a7783bb9 | 435 | // Channel = { Frequency [Hz], Datarate } |
mluis | 0:91d1a7783bb9 | 436 | #define RX_WND_2_CHANNEL { 869525000, DR_0 } |
mluis | 0:91d1a7783bb9 | 437 | |
mluis | 0:91d1a7783bb9 | 438 | /*! |
mluis | 0:91d1a7783bb9 | 439 | * LoRaMac maximum number of bands |
mluis | 0:91d1a7783bb9 | 440 | */ |
mluis | 0:91d1a7783bb9 | 441 | #define LORA_MAX_NB_BANDS 5 |
mluis | 0:91d1a7783bb9 | 442 | |
mluis | 0:91d1a7783bb9 | 443 | /*! |
mluis | 0:91d1a7783bb9 | 444 | * LoRaMac EU868 default bands |
mluis | 0:91d1a7783bb9 | 445 | */ |
mluis | 0:91d1a7783bb9 | 446 | typedef enum |
mluis | 0:91d1a7783bb9 | 447 | { |
mluis | 0:91d1a7783bb9 | 448 | BAND_G1_0, |
mluis | 0:91d1a7783bb9 | 449 | BAND_G1_1, |
mluis | 0:91d1a7783bb9 | 450 | BAND_G1_2, |
mluis | 0:91d1a7783bb9 | 451 | BAND_G1_3, |
mluis | 0:91d1a7783bb9 | 452 | BAND_G1_4, |
mluis | 0:91d1a7783bb9 | 453 | }BandId_t; |
mluis | 0:91d1a7783bb9 | 454 | |
mluis | 0:91d1a7783bb9 | 455 | // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } |
mluis | 0:91d1a7783bb9 | 456 | #define BAND0 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % |
mluis | 0:91d1a7783bb9 | 457 | #define BAND1 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % |
mluis | 0:91d1a7783bb9 | 458 | #define BAND2 { 1000, TX_POWER_14_DBM, 0, 0 } // 0.1 % |
mluis | 0:91d1a7783bb9 | 459 | #define BAND3 { 10 , TX_POWER_14_DBM, 0, 0 } // 10.0 % |
mluis | 0:91d1a7783bb9 | 460 | #define BAND4 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % |
mluis | 0:91d1a7783bb9 | 461 | |
mluis | 0:91d1a7783bb9 | 462 | /*! |
mluis | 0:91d1a7783bb9 | 463 | * LoRaMac default channels |
mluis | 0:91d1a7783bb9 | 464 | */ |
mluis | 0:91d1a7783bb9 | 465 | // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } |
mluis | 0:91d1a7783bb9 | 466 | #define LC1 { 868100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } |
mluis | 4:37c12dbc8dc7 | 467 | #define LC2 { 868300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } |
mluis | 0:91d1a7783bb9 | 468 | #define LC3 { 868500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } |
mluis | 0:91d1a7783bb9 | 469 | |
mluis | 4:37c12dbc8dc7 | 470 | /*! |
mluis | 4:37c12dbc8dc7 | 471 | * LoRaMac channels which are allowed for the join procedure |
mluis | 4:37c12dbc8dc7 | 472 | */ |
mluis | 4:37c12dbc8dc7 | 473 | #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) ) |
mluis | 4:37c12dbc8dc7 | 474 | |
mick_ccc | 10:e52525844705 | 475 | #elif defined( USE_BAND_868_LEGACY ) |
mick_ccc | 10:e52525844705 | 476 | |
mick_ccc | 10:e52525844705 | 477 | /*! |
mick_ccc | 10:e52525844705 | 478 | * LoRaMac maximum number of channels |
mick_ccc | 10:e52525844705 | 479 | */ |
mick_ccc | 10:e52525844705 | 480 | #define LORA_MAX_NB_CHANNELS 16 |
mick_ccc | 10:e52525844705 | 481 | |
mick_ccc | 10:e52525844705 | 482 | /*! |
mick_ccc | 10:e52525844705 | 483 | * Minimal datarate that can be used by the node |
mick_ccc | 10:e52525844705 | 484 | */ |
mick_ccc | 10:e52525844705 | 485 | #define LORAMAC_TX_MIN_DATARATE DR_0 |
mick_ccc | 10:e52525844705 | 486 | |
mick_ccc | 10:e52525844705 | 487 | /*! |
mick_ccc | 10:e52525844705 | 488 | * Maximal datarate that can be used by the node |
mick_ccc | 10:e52525844705 | 489 | */ |
mick_ccc | 10:e52525844705 | 490 | #define LORAMAC_TX_MAX_DATARATE DR_7 |
mick_ccc | 10:e52525844705 | 491 | |
mick_ccc | 10:e52525844705 | 492 | /*! |
mick_ccc | 10:e52525844705 | 493 | * Minimal datarate that can be used by the node |
mick_ccc | 10:e52525844705 | 494 | */ |
mick_ccc | 10:e52525844705 | 495 | #define LORAMAC_RX_MIN_DATARATE DR_0 |
mick_ccc | 10:e52525844705 | 496 | |
mick_ccc | 10:e52525844705 | 497 | /*! |
mick_ccc | 10:e52525844705 | 498 | * Maximal datarate that can be used by the node |
mick_ccc | 10:e52525844705 | 499 | */ |
mick_ccc | 10:e52525844705 | 500 | #define LORAMAC_RX_MAX_DATARATE DR_7 |
mick_ccc | 10:e52525844705 | 501 | |
mick_ccc | 10:e52525844705 | 502 | /*! |
mick_ccc | 10:e52525844705 | 503 | * Default datarate used by the node |
mick_ccc | 10:e52525844705 | 504 | */ |
mick_ccc | 10:e52525844705 | 505 | #define LORAMAC_DEFAULT_DATARATE DR_0 |
mick_ccc | 10:e52525844705 | 506 | |
mick_ccc | 10:e52525844705 | 507 | /*! |
mick_ccc | 10:e52525844705 | 508 | * Minimal Rx1 receive datarate offset |
mick_ccc | 10:e52525844705 | 509 | */ |
mick_ccc | 10:e52525844705 | 510 | #define LORAMAC_MIN_RX1_DR_OFFSET 0 |
mick_ccc | 10:e52525844705 | 511 | |
mick_ccc | 10:e52525844705 | 512 | /*! |
mick_ccc | 10:e52525844705 | 513 | * Maximal Rx1 receive datarate offset |
mick_ccc | 10:e52525844705 | 514 | */ |
mick_ccc | 10:e52525844705 | 515 | #define LORAMAC_MAX_RX1_DR_OFFSET 7 |
mick_ccc | 10:e52525844705 | 516 | |
mick_ccc | 10:e52525844705 | 517 | /*! |
mick_ccc | 10:e52525844705 | 518 | * Minimal Tx output power that can be used by the node |
mick_ccc | 10:e52525844705 | 519 | */ |
mick_ccc | 10:e52525844705 | 520 | #define LORAMAC_MIN_TX_POWER TX_POWER_02_DBM |
mick_ccc | 10:e52525844705 | 521 | |
mick_ccc | 10:e52525844705 | 522 | /*! |
mick_ccc | 10:e52525844705 | 523 | * Maximal Tx output power that can be used by the node |
mick_ccc | 10:e52525844705 | 524 | */ |
mick_ccc | 10:e52525844705 | 525 | #define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM |
mick_ccc | 10:e52525844705 | 526 | |
mick_ccc | 10:e52525844705 | 527 | /*! |
mick_ccc | 10:e52525844705 | 528 | * Default Tx output power used by the node |
mick_ccc | 10:e52525844705 | 529 | */ |
mick_ccc | 10:e52525844705 | 530 | #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM |
mick_ccc | 10:e52525844705 | 531 | |
mick_ccc | 10:e52525844705 | 532 | /*! |
mick_ccc | 10:e52525844705 | 533 | * LoRaMac TxPower definition |
mick_ccc | 10:e52525844705 | 534 | */ |
mick_ccc | 10:e52525844705 | 535 | #define TX_POWER_20_DBM 0 |
mick_ccc | 10:e52525844705 | 536 | #define TX_POWER_14_DBM 1 |
mick_ccc | 10:e52525844705 | 537 | #define TX_POWER_11_DBM 2 |
mick_ccc | 10:e52525844705 | 538 | #define TX_POWER_08_DBM 3 |
mick_ccc | 10:e52525844705 | 539 | #define TX_POWER_05_DBM 4 |
mick_ccc | 10:e52525844705 | 540 | #define TX_POWER_02_DBM 5 |
mick_ccc | 10:e52525844705 | 541 | |
mick_ccc | 10:e52525844705 | 542 | /*! |
mick_ccc | 10:e52525844705 | 543 | * LoRaMac datarates definition |
mick_ccc | 10:e52525844705 | 544 | */ |
mick_ccc | 10:e52525844705 | 545 | #define DR_0 0 // SF12 - BW125 |
mick_ccc | 10:e52525844705 | 546 | #define DR_1 1 // SF11 - BW125 |
mick_ccc | 10:e52525844705 | 547 | #define DR_2 2 // SF10 - BW125 |
mick_ccc | 10:e52525844705 | 548 | #define DR_3 3 // SF9 - BW125 |
mick_ccc | 10:e52525844705 | 549 | #define DR_4 4 // SF8 - BW125 |
mick_ccc | 10:e52525844705 | 550 | #define DR_5 5 // SF7 - BW125 |
mick_ccc | 10:e52525844705 | 551 | #define DR_6 6 // SF7 - BW250 |
mick_ccc | 10:e52525844705 | 552 | #define DR_7 7 // FSK |
mick_ccc | 10:e52525844705 | 553 | |
mick_ccc | 10:e52525844705 | 554 | /*! |
mick_ccc | 10:e52525844705 | 555 | * Verification of default datarate |
mick_ccc | 10:e52525844705 | 556 | */ |
mick_ccc | 10:e52525844705 | 557 | #if ( LORAMAC_DEFAULT_DATARATE > DR_5 ) |
mick_ccc | 10:e52525844705 | 558 | #error "A default DR higher than DR_5 may lead to connectivity loss." |
mick_ccc | 10:e52525844705 | 559 | #endif |
mick_ccc | 10:e52525844705 | 560 | |
mick_ccc | 10:e52525844705 | 561 | /*! |
mick_ccc | 10:e52525844705 | 562 | * Second reception window channel definition. |
mick_ccc | 10:e52525844705 | 563 | */ |
mick_ccc | 10:e52525844705 | 564 | // Channel = { Frequency [Hz], Datarate } |
mick_ccc | 10:e52525844705 | 565 | #define RX_WND_2_CHANNEL { 865150000, DR_4 } |
mick_ccc | 10:e52525844705 | 566 | |
mick_ccc | 10:e52525844705 | 567 | /*! |
mick_ccc | 10:e52525844705 | 568 | * LoRaMac maximum number of bands |
mick_ccc | 10:e52525844705 | 569 | */ |
mick_ccc | 10:e52525844705 | 570 | #define LORA_MAX_NB_BANDS 5 |
mick_ccc | 10:e52525844705 | 571 | |
mick_ccc | 10:e52525844705 | 572 | /*! |
mick_ccc | 10:e52525844705 | 573 | * LoRaMac EU868 default bands |
mick_ccc | 10:e52525844705 | 574 | */ |
mick_ccc | 10:e52525844705 | 575 | typedef enum |
mick_ccc | 10:e52525844705 | 576 | { |
mick_ccc | 10:e52525844705 | 577 | BAND_G1_0, |
mick_ccc | 10:e52525844705 | 578 | BAND_G1_1, |
mick_ccc | 10:e52525844705 | 579 | BAND_G1_2, |
mick_ccc | 10:e52525844705 | 580 | BAND_G1_3, |
mick_ccc | 10:e52525844705 | 581 | BAND_G1_4, |
mick_ccc | 10:e52525844705 | 582 | }BandId_t; |
mick_ccc | 10:e52525844705 | 583 | |
mick_ccc | 10:e52525844705 | 584 | // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } |
mick_ccc | 10:e52525844705 | 585 | #define BAND0 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % |
mick_ccc | 10:e52525844705 | 586 | #define BAND1 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % |
mick_ccc | 10:e52525844705 | 587 | #define BAND2 { 1000, TX_POWER_14_DBM, 0, 0 } // 0.1 % |
mick_ccc | 10:e52525844705 | 588 | #define BAND3 { 10 , TX_POWER_14_DBM, 0, 0 } // 10.0 % |
mick_ccc | 10:e52525844705 | 589 | #define BAND4 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % |
mick_ccc | 10:e52525844705 | 590 | |
mick_ccc | 10:e52525844705 | 591 | /*! |
mick_ccc | 10:e52525844705 | 592 | * LoRaMac default channels |
mick_ccc | 10:e52525844705 | 593 | */ |
mick_ccc | 10:e52525844705 | 594 | // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } |
mick_ccc | 10:e52525844705 | 595 | #define LC1 { 868090000, { ( ( DR_6 << 4 ) | DR_6 ) }, 0 } |
mick_ccc | 10:e52525844705 | 596 | #define LC2 { 868270000, { ( ( DR_7 << 4 ) | DR_6 ) }, 0 } |
mick_ccc | 10:e52525844705 | 597 | #define LC3 { 868450000, { ( ( DR_7 << 4 ) | DR_6 ) }, 0 } |
mick_ccc | 10:e52525844705 | 598 | |
mick_ccc | 10:e52525844705 | 599 | /*! |
mick_ccc | 10:e52525844705 | 600 | * LoRaMac channels which are allowed for the join procedure |
mick_ccc | 10:e52525844705 | 601 | */ |
mick_ccc | 10:e52525844705 | 602 | #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) ) |
mick_ccc | 10:e52525844705 | 603 | |
mluis | 0:91d1a7783bb9 | 604 | #elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID ) |
mluis | 0:91d1a7783bb9 | 605 | |
mluis | 0:91d1a7783bb9 | 606 | /*! |
mluis | 0:91d1a7783bb9 | 607 | * LoRaMac maximum number of channels |
mluis | 0:91d1a7783bb9 | 608 | */ |
mluis | 0:91d1a7783bb9 | 609 | #define LORA_MAX_NB_CHANNELS 72 |
mluis | 0:91d1a7783bb9 | 610 | |
mluis | 0:91d1a7783bb9 | 611 | /*! |
mluis | 0:91d1a7783bb9 | 612 | * Minimal datarate that can be used by the node |
mluis | 0:91d1a7783bb9 | 613 | */ |
mluis | 4:37c12dbc8dc7 | 614 | #define LORAMAC_TX_MIN_DATARATE DR_0 |
mluis | 0:91d1a7783bb9 | 615 | |
mluis | 0:91d1a7783bb9 | 616 | /*! |
mluis | 7:c16969e0f70f | 617 | * Maximal datarate that can be used by the node |
mluis | 0:91d1a7783bb9 | 618 | */ |
mluis | 4:37c12dbc8dc7 | 619 | #define LORAMAC_TX_MAX_DATARATE DR_4 |
mluis | 4:37c12dbc8dc7 | 620 | |
mluis | 4:37c12dbc8dc7 | 621 | /*! |
mluis | 4:37c12dbc8dc7 | 622 | * Minimal datarate that can be used by the node |
mluis | 4:37c12dbc8dc7 | 623 | */ |
mluis | 4:37c12dbc8dc7 | 624 | #define LORAMAC_RX_MIN_DATARATE DR_8 |
mluis | 4:37c12dbc8dc7 | 625 | |
mluis | 4:37c12dbc8dc7 | 626 | /*! |
mluis | 7:c16969e0f70f | 627 | * Maximal datarate that can be used by the node |
mluis | 4:37c12dbc8dc7 | 628 | */ |
mluis | 4:37c12dbc8dc7 | 629 | #define LORAMAC_RX_MAX_DATARATE DR_13 |
mluis | 0:91d1a7783bb9 | 630 | |
mluis | 0:91d1a7783bb9 | 631 | /*! |
mluis | 0:91d1a7783bb9 | 632 | * Default datarate used by the node |
mluis | 0:91d1a7783bb9 | 633 | */ |
mluis | 0:91d1a7783bb9 | 634 | #define LORAMAC_DEFAULT_DATARATE DR_0 |
mluis | 0:91d1a7783bb9 | 635 | |
mluis | 0:91d1a7783bb9 | 636 | /*! |
mluis | 1:91e4e6c60d1e | 637 | * Minimal Rx1 receive datarate offset |
mluis | 1:91e4e6c60d1e | 638 | */ |
mluis | 1:91e4e6c60d1e | 639 | #define LORAMAC_MIN_RX1_DR_OFFSET 0 |
mluis | 1:91e4e6c60d1e | 640 | |
mluis | 1:91e4e6c60d1e | 641 | /*! |
mluis | 1:91e4e6c60d1e | 642 | * Maximal Rx1 receive datarate offset |
mluis | 1:91e4e6c60d1e | 643 | */ |
mluis | 1:91e4e6c60d1e | 644 | #define LORAMAC_MAX_RX1_DR_OFFSET 3 |
mluis | 1:91e4e6c60d1e | 645 | |
mluis | 1:91e4e6c60d1e | 646 | /*! |
mluis | 0:91d1a7783bb9 | 647 | * Minimal Tx output power that can be used by the node |
mluis | 0:91d1a7783bb9 | 648 | */ |
mluis | 0:91d1a7783bb9 | 649 | #define LORAMAC_MIN_TX_POWER TX_POWER_10_DBM |
mluis | 0:91d1a7783bb9 | 650 | |
mluis | 0:91d1a7783bb9 | 651 | /*! |
mluis | 7:c16969e0f70f | 652 | * Maximal Tx output power that can be used by the node |
mluis | 0:91d1a7783bb9 | 653 | */ |
mluis | 0:91d1a7783bb9 | 654 | #define LORAMAC_MAX_TX_POWER TX_POWER_30_DBM |
mluis | 0:91d1a7783bb9 | 655 | |
mluis | 0:91d1a7783bb9 | 656 | /*! |
mluis | 0:91d1a7783bb9 | 657 | * Default Tx output power used by the node |
mluis | 0:91d1a7783bb9 | 658 | */ |
mluis | 0:91d1a7783bb9 | 659 | #define LORAMAC_DEFAULT_TX_POWER TX_POWER_20_DBM |
mluis | 0:91d1a7783bb9 | 660 | |
mluis | 0:91d1a7783bb9 | 661 | /*! |
mluis | 0:91d1a7783bb9 | 662 | * LoRaMac TxPower definition |
mluis | 0:91d1a7783bb9 | 663 | */ |
mluis | 0:91d1a7783bb9 | 664 | #define TX_POWER_30_DBM 0 |
mluis | 0:91d1a7783bb9 | 665 | #define TX_POWER_28_DBM 1 |
mluis | 0:91d1a7783bb9 | 666 | #define TX_POWER_26_DBM 2 |
mluis | 0:91d1a7783bb9 | 667 | #define TX_POWER_24_DBM 3 |
mluis | 0:91d1a7783bb9 | 668 | #define TX_POWER_22_DBM 4 |
mluis | 0:91d1a7783bb9 | 669 | #define TX_POWER_20_DBM 5 |
mluis | 0:91d1a7783bb9 | 670 | #define TX_POWER_18_DBM 6 |
mluis | 0:91d1a7783bb9 | 671 | #define TX_POWER_16_DBM 7 |
mluis | 0:91d1a7783bb9 | 672 | #define TX_POWER_14_DBM 8 |
mluis | 0:91d1a7783bb9 | 673 | #define TX_POWER_12_DBM 9 |
mluis | 0:91d1a7783bb9 | 674 | #define TX_POWER_10_DBM 10 |
mluis | 0:91d1a7783bb9 | 675 | |
mluis | 0:91d1a7783bb9 | 676 | /*! |
mluis | 0:91d1a7783bb9 | 677 | * LoRaMac datarates definition |
mluis | 0:91d1a7783bb9 | 678 | */ |
mluis | 0:91d1a7783bb9 | 679 | #define DR_0 0 // SF10 - BW125 | |
mluis | 0:91d1a7783bb9 | 680 | #define DR_1 1 // SF9 - BW125 | |
mluis | 0:91d1a7783bb9 | 681 | #define DR_2 2 // SF8 - BW125 +-> Up link |
mluis | 0:91d1a7783bb9 | 682 | #define DR_3 3 // SF7 - BW125 | |
mluis | 0:91d1a7783bb9 | 683 | #define DR_4 4 // SF8 - BW500 | |
mluis | 0:91d1a7783bb9 | 684 | #define DR_5 5 // RFU |
mluis | 0:91d1a7783bb9 | 685 | #define DR_6 6 // RFU |
mluis | 0:91d1a7783bb9 | 686 | #define DR_7 7 // RFU |
mluis | 0:91d1a7783bb9 | 687 | #define DR_8 8 // SF12 - BW500 | |
mluis | 0:91d1a7783bb9 | 688 | #define DR_9 9 // SF11 - BW500 | |
mluis | 0:91d1a7783bb9 | 689 | #define DR_10 10 // SF10 - BW500 | |
mluis | 0:91d1a7783bb9 | 690 | #define DR_11 11 // SF9 - BW500 | |
mluis | 0:91d1a7783bb9 | 691 | #define DR_12 12 // SF8 - BW500 +-> Down link |
mluis | 0:91d1a7783bb9 | 692 | #define DR_13 13 // SF7 - BW500 | |
mluis | 0:91d1a7783bb9 | 693 | #define DR_14 14 // RFU | |
mluis | 0:91d1a7783bb9 | 694 | #define DR_15 15 // RFU | |
mluis | 0:91d1a7783bb9 | 695 | |
mluis | 0:91d1a7783bb9 | 696 | /*! |
mluis | 0:91d1a7783bb9 | 697 | * Second reception window channel definition. |
mluis | 0:91d1a7783bb9 | 698 | */ |
mluis | 0:91d1a7783bb9 | 699 | // Channel = { Frequency [Hz], Datarate } |
mluis | 0:91d1a7783bb9 | 700 | #define RX_WND_2_CHANNEL { 923300000, DR_8 } |
mluis | 0:91d1a7783bb9 | 701 | |
mluis | 0:91d1a7783bb9 | 702 | /*! |
mluis | 0:91d1a7783bb9 | 703 | * LoRaMac maximum number of bands |
mluis | 0:91d1a7783bb9 | 704 | */ |
mluis | 0:91d1a7783bb9 | 705 | #define LORA_MAX_NB_BANDS 1 |
mluis | 0:91d1a7783bb9 | 706 | |
mluis | 0:91d1a7783bb9 | 707 | // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } |
mluis | 0:91d1a7783bb9 | 708 | #define BAND0 { 1, TX_POWER_20_DBM, 0, 0 } // 100.0 % |
mluis | 0:91d1a7783bb9 | 709 | |
mluis | 0:91d1a7783bb9 | 710 | /*! |
mluis | 0:91d1a7783bb9 | 711 | * LoRaMac default channels |
mluis | 0:91d1a7783bb9 | 712 | */ |
mluis | 0:91d1a7783bb9 | 713 | // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } |
mluis | 0:91d1a7783bb9 | 714 | /* |
mluis | 0:91d1a7783bb9 | 715 | * US band channels are initialized using a loop in LoRaMacInit function |
mluis | 0:91d1a7783bb9 | 716 | * \code |
mluis | 0:91d1a7783bb9 | 717 | * // 125 kHz channels |
mluis | 0:91d1a7783bb9 | 718 | * for( uint8_t i = 0; i < LORA_MAX_NB_CHANNELS - 8; i++ ) |
mluis | 0:91d1a7783bb9 | 719 | * { |
mluis | 0:91d1a7783bb9 | 720 | * Channels[i].Frequency = 902.3e6 + i * 200e3; |
mluis | 0:91d1a7783bb9 | 721 | * Channels[i].DrRange.Value = ( DR_3 << 4 ) | DR_0; |
mluis | 0:91d1a7783bb9 | 722 | * Channels[i].Band = 0; |
mluis | 0:91d1a7783bb9 | 723 | * } |
mluis | 2:14a5d6ad92d5 | 724 | * // 500 kHz channels |
mluis | 0:91d1a7783bb9 | 725 | * for( uint8_t i = LORA_MAX_NB_CHANNELS - 8; i < LORA_MAX_NB_CHANNELS; i++ ) |
mluis | 0:91d1a7783bb9 | 726 | * { |
mluis | 0:91d1a7783bb9 | 727 | * Channels[i].Frequency = 903.0e6 + ( i - ( LORA_MAX_NB_CHANNELS - 8 ) ) * 1.6e6; |
mluis | 0:91d1a7783bb9 | 728 | * Channels[i].DrRange.Value = ( DR_4 << 4 ) | DR_4; |
mluis | 0:91d1a7783bb9 | 729 | * Channels[i].Band = 0; |
mluis | 0:91d1a7783bb9 | 730 | * } |
mluis | 0:91d1a7783bb9 | 731 | * \endcode |
mluis | 0:91d1a7783bb9 | 732 | */ |
mluis | 0:91d1a7783bb9 | 733 | #else |
mluis | 0:91d1a7783bb9 | 734 | #error "Please define a frequency band in the compiler options." |
mluis | 0:91d1a7783bb9 | 735 | #endif |
mluis | 0:91d1a7783bb9 | 736 | |
mluis | 0:91d1a7783bb9 | 737 | #endif // __LORAMAC_BOARD_H__ |