Fork of Semtech LoRaWAN stack

Fork of LoRaWAN-lib by canuck lehead

Committer:
mluis
Date:
Mon Apr 24 09:42:37 2017 +0000
Revision:
32:26002607de9c
Parent:
7:c16969e0f70f
WARNING: Radio API timings changed from micro-seconds to milliseconds; ; Synchronized with https://github.com/Lora-net/LoRaMac-node git revision e506c246652fa44c3f24cecb89d0707b49ece739;

Who changed what in which revision?

UserRevisionLine numberNew 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 32:26002607de9c 106 * Verification of default datarate
mluis 32:26002607de9c 107 */
mluis 32:26002607de9c 108 #if ( LORAMAC_DEFAULT_DATARATE > DR_5 )
mluis 32:26002607de9c 109 #error "A default DR higher than DR_5 may lead to connectivity loss."
mluis 32:26002607de9c 110 #endif
mluis 32:26002607de9c 111
mluis 32:26002607de9c 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 32:26002607de9c 139 #elif defined( USE_BAND_470 )
mluis 32:26002607de9c 140
mluis 32:26002607de9c 141 /*!
mluis 32:26002607de9c 142 * LoRaMac maximum number of channels
mluis 32:26002607de9c 143 */
mluis 32:26002607de9c 144 #define LORA_MAX_NB_CHANNELS 96
mluis 32:26002607de9c 145
mluis 32:26002607de9c 146 /*!
mluis 32:26002607de9c 147 * Minimal datarate that can be used by the node
mluis 32:26002607de9c 148 */
mluis 32:26002607de9c 149 #define LORAMAC_TX_MIN_DATARATE DR_0
mluis 32:26002607de9c 150
mluis 32:26002607de9c 151 /*!
mluis 32:26002607de9c 152 * Maximal datarate that can be used by the node
mluis 32:26002607de9c 153 */
mluis 32:26002607de9c 154 #define LORAMAC_TX_MAX_DATARATE DR_5
mluis 32:26002607de9c 155
mluis 32:26002607de9c 156 /*!
mluis 32:26002607de9c 157 * Minimal datarate that can be used by the node
mluis 32:26002607de9c 158 */
mluis 32:26002607de9c 159 #define LORAMAC_RX_MIN_DATARATE DR_0
mluis 32:26002607de9c 160
mluis 32:26002607de9c 161 /*!
mluis 32:26002607de9c 162 * Maximal datarate that can be used by the node
mluis 32:26002607de9c 163 */
mluis 32:26002607de9c 164 #define LORAMAC_RX_MAX_DATARATE DR_5
mluis 32:26002607de9c 165
mluis 32:26002607de9c 166 /*!
mluis 32:26002607de9c 167 * Default datarate used by the node
mluis 32:26002607de9c 168 */
mluis 32:26002607de9c 169 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 32:26002607de9c 170
mluis 32:26002607de9c 171 /*!
mluis 32:26002607de9c 172 * Minimal Rx1 receive datarate offset
mluis 32:26002607de9c 173 */
mluis 32:26002607de9c 174 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 32:26002607de9c 175
mluis 32:26002607de9c 176 /*!
mluis 32:26002607de9c 177 * Maximal Rx1 receive datarate offset
mluis 32:26002607de9c 178 */
mluis 32:26002607de9c 179 #define LORAMAC_MAX_RX1_DR_OFFSET 3
mluis 32:26002607de9c 180
mluis 32:26002607de9c 181 /*!
mluis 32:26002607de9c 182 * Minimal Tx output power that can be used by the node
mluis 32:26002607de9c 183 */
mluis 32:26002607de9c 184 #define LORAMAC_MIN_TX_POWER TX_POWER_2_DBM
mluis 32:26002607de9c 185
mluis 32:26002607de9c 186 /*!
mluis 32:26002607de9c 187 * Maximal Tx output power that can be used by the node
mluis 32:26002607de9c 188 */
mluis 32:26002607de9c 189 #define LORAMAC_MAX_TX_POWER TX_POWER_17_DBM
mluis 32:26002607de9c 190
mluis 32:26002607de9c 191 /*!
mluis 32:26002607de9c 192 * Default Tx output power used by the node
mluis 32:26002607de9c 193 */
mluis 32:26002607de9c 194 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM
mluis 32:26002607de9c 195
mluis 32:26002607de9c 196 /*!
mluis 32:26002607de9c 197 * LoRaMac TxPower definition
mluis 32:26002607de9c 198 */
mluis 32:26002607de9c 199 #define TX_POWER_17_DBM 0
mluis 32:26002607de9c 200 #define TX_POWER_16_DBM 1
mluis 32:26002607de9c 201 #define TX_POWER_14_DBM 2
mluis 32:26002607de9c 202 #define TX_POWER_12_DBM 3
mluis 32:26002607de9c 203 #define TX_POWER_10_DBM 4
mluis 32:26002607de9c 204 #define TX_POWER_7_DBM 5
mluis 32:26002607de9c 205 #define TX_POWER_5_DBM 6
mluis 32:26002607de9c 206 #define TX_POWER_2_DBM 7
mluis 32:26002607de9c 207
mluis 32:26002607de9c 208
mluis 32:26002607de9c 209 /*!
mluis 32:26002607de9c 210 * LoRaMac datarates definition
mluis 32:26002607de9c 211 */
mluis 32:26002607de9c 212 #define DR_0 0 // SF12 - BW125 |
mluis 32:26002607de9c 213 #define DR_1 1 // SF11 - BW125 |
mluis 32:26002607de9c 214 #define DR_2 2 // SF10 - BW125 |
mluis 32:26002607de9c 215 #define DR_3 3 // SF9 - BW125 |
mluis 32:26002607de9c 216 #define DR_4 4 // SF8 - BW125 |
mluis 32:26002607de9c 217 #define DR_5 5 // SF7 - BW125 |
mluis 32:26002607de9c 218
mluis 32:26002607de9c 219 /*!
mluis 32:26002607de9c 220 * Second reception window channel definition.
mluis 32:26002607de9c 221 */
mluis 32:26002607de9c 222 // Channel = { Frequency [Hz], Datarate }
mluis 32:26002607de9c 223 #define RX_WND_2_CHANNEL { 505300000, DR_0 }
mluis 32:26002607de9c 224
mluis 32:26002607de9c 225 /*!
mluis 32:26002607de9c 226 * LoRaMac maximum number of bands
mluis 32:26002607de9c 227 */
mluis 32:26002607de9c 228 #define LORA_MAX_NB_BANDS 1
mluis 32:26002607de9c 229
mluis 32:26002607de9c 230 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 32:26002607de9c 231 #define BAND0 { 1, TX_POWER_17_DBM, 0, 0 } // 100.0 %
mluis 32:26002607de9c 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 32:26002607de9c 313 * Verification of default datarate
mluis 32:26002607de9c 314 */
mluis 32:26002607de9c 315 #if ( LORAMAC_DEFAULT_DATARATE > DR_5 )
mluis 32:26002607de9c 316 #error "A default DR higher than DR_5 may lead to connectivity loss."
mluis 32:26002607de9c 317 #endif
mluis 32:26002607de9c 318
mluis 32:26002607de9c 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 32:26002607de9c 426 * Verification of default datarate
mluis 32:26002607de9c 427 */
mluis 32:26002607de9c 428 #if ( LORAMAC_DEFAULT_DATARATE > DR_5 )
mluis 32:26002607de9c 429 #error "A default DR higher than DR_5 may lead to connectivity loss."
mluis 32:26002607de9c 430 #endif
mluis 32:26002607de9c 431
mluis 32:26002607de9c 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
mluis 0:91d1a7783bb9 475 #elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID )
mluis 0:91d1a7783bb9 476
mluis 0:91d1a7783bb9 477 /*!
mluis 0:91d1a7783bb9 478 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 479 */
mluis 0:91d1a7783bb9 480 #define LORA_MAX_NB_CHANNELS 72
mluis 0:91d1a7783bb9 481
mluis 0:91d1a7783bb9 482 /*!
mluis 0:91d1a7783bb9 483 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 484 */
mluis 4:37c12dbc8dc7 485 #define LORAMAC_TX_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 486
mluis 0:91d1a7783bb9 487 /*!
mluis 7:c16969e0f70f 488 * Maximal datarate that can be used by the node
mluis 0:91d1a7783bb9 489 */
mluis 4:37c12dbc8dc7 490 #define LORAMAC_TX_MAX_DATARATE DR_4
mluis 4:37c12dbc8dc7 491
mluis 4:37c12dbc8dc7 492 /*!
mluis 4:37c12dbc8dc7 493 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 494 */
mluis 4:37c12dbc8dc7 495 #define LORAMAC_RX_MIN_DATARATE DR_8
mluis 4:37c12dbc8dc7 496
mluis 4:37c12dbc8dc7 497 /*!
mluis 7:c16969e0f70f 498 * Maximal datarate that can be used by the node
mluis 4:37c12dbc8dc7 499 */
mluis 4:37c12dbc8dc7 500 #define LORAMAC_RX_MAX_DATARATE DR_13
mluis 0:91d1a7783bb9 501
mluis 0:91d1a7783bb9 502 /*!
mluis 0:91d1a7783bb9 503 * Default datarate used by the node
mluis 0:91d1a7783bb9 504 */
mluis 0:91d1a7783bb9 505 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 506
mluis 0:91d1a7783bb9 507 /*!
mluis 1:91e4e6c60d1e 508 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 509 */
mluis 1:91e4e6c60d1e 510 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 511
mluis 1:91e4e6c60d1e 512 /*!
mluis 1:91e4e6c60d1e 513 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 514 */
mluis 1:91e4e6c60d1e 515 #define LORAMAC_MAX_RX1_DR_OFFSET 3
mluis 1:91e4e6c60d1e 516
mluis 1:91e4e6c60d1e 517 /*!
mluis 0:91d1a7783bb9 518 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 519 */
mluis 0:91d1a7783bb9 520 #define LORAMAC_MIN_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 521
mluis 0:91d1a7783bb9 522 /*!
mluis 7:c16969e0f70f 523 * Maximal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 524 */
mluis 0:91d1a7783bb9 525 #define LORAMAC_MAX_TX_POWER TX_POWER_30_DBM
mluis 0:91d1a7783bb9 526
mluis 0:91d1a7783bb9 527 /*!
mluis 0:91d1a7783bb9 528 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 529 */
mluis 0:91d1a7783bb9 530 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_20_DBM
mluis 0:91d1a7783bb9 531
mluis 0:91d1a7783bb9 532 /*!
mluis 0:91d1a7783bb9 533 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 534 */
mluis 0:91d1a7783bb9 535 #define TX_POWER_30_DBM 0
mluis 0:91d1a7783bb9 536 #define TX_POWER_28_DBM 1
mluis 0:91d1a7783bb9 537 #define TX_POWER_26_DBM 2
mluis 0:91d1a7783bb9 538 #define TX_POWER_24_DBM 3
mluis 0:91d1a7783bb9 539 #define TX_POWER_22_DBM 4
mluis 0:91d1a7783bb9 540 #define TX_POWER_20_DBM 5
mluis 0:91d1a7783bb9 541 #define TX_POWER_18_DBM 6
mluis 0:91d1a7783bb9 542 #define TX_POWER_16_DBM 7
mluis 0:91d1a7783bb9 543 #define TX_POWER_14_DBM 8
mluis 0:91d1a7783bb9 544 #define TX_POWER_12_DBM 9
mluis 0:91d1a7783bb9 545 #define TX_POWER_10_DBM 10
mluis 0:91d1a7783bb9 546
mluis 0:91d1a7783bb9 547 /*!
mluis 0:91d1a7783bb9 548 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 549 */
mluis 0:91d1a7783bb9 550 #define DR_0 0 // SF10 - BW125 |
mluis 0:91d1a7783bb9 551 #define DR_1 1 // SF9 - BW125 |
mluis 0:91d1a7783bb9 552 #define DR_2 2 // SF8 - BW125 +-> Up link
mluis 0:91d1a7783bb9 553 #define DR_3 3 // SF7 - BW125 |
mluis 0:91d1a7783bb9 554 #define DR_4 4 // SF8 - BW500 |
mluis 0:91d1a7783bb9 555 #define DR_5 5 // RFU
mluis 0:91d1a7783bb9 556 #define DR_6 6 // RFU
mluis 0:91d1a7783bb9 557 #define DR_7 7 // RFU
mluis 0:91d1a7783bb9 558 #define DR_8 8 // SF12 - BW500 |
mluis 0:91d1a7783bb9 559 #define DR_9 9 // SF11 - BW500 |
mluis 0:91d1a7783bb9 560 #define DR_10 10 // SF10 - BW500 |
mluis 0:91d1a7783bb9 561 #define DR_11 11 // SF9 - BW500 |
mluis 0:91d1a7783bb9 562 #define DR_12 12 // SF8 - BW500 +-> Down link
mluis 0:91d1a7783bb9 563 #define DR_13 13 // SF7 - BW500 |
mluis 0:91d1a7783bb9 564 #define DR_14 14 // RFU |
mluis 0:91d1a7783bb9 565 #define DR_15 15 // RFU |
mluis 0:91d1a7783bb9 566
mluis 0:91d1a7783bb9 567 /*!
mluis 0:91d1a7783bb9 568 * Second reception window channel definition.
mluis 0:91d1a7783bb9 569 */
mluis 0:91d1a7783bb9 570 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 571 #define RX_WND_2_CHANNEL { 923300000, DR_8 }
mluis 0:91d1a7783bb9 572
mluis 0:91d1a7783bb9 573 /*!
mluis 0:91d1a7783bb9 574 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 575 */
mluis 0:91d1a7783bb9 576 #define LORA_MAX_NB_BANDS 1
mluis 0:91d1a7783bb9 577
mluis 0:91d1a7783bb9 578 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 579 #define BAND0 { 1, TX_POWER_20_DBM, 0, 0 } // 100.0 %
mluis 0:91d1a7783bb9 580
mluis 0:91d1a7783bb9 581 /*!
mluis 0:91d1a7783bb9 582 * LoRaMac default channels
mluis 0:91d1a7783bb9 583 */
mluis 0:91d1a7783bb9 584 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 585 /*
mluis 0:91d1a7783bb9 586 * US band channels are initialized using a loop in LoRaMacInit function
mluis 0:91d1a7783bb9 587 * \code
mluis 0:91d1a7783bb9 588 * // 125 kHz channels
mluis 0:91d1a7783bb9 589 * for( uint8_t i = 0; i < LORA_MAX_NB_CHANNELS - 8; i++ )
mluis 0:91d1a7783bb9 590 * {
mluis 0:91d1a7783bb9 591 * Channels[i].Frequency = 902.3e6 + i * 200e3;
mluis 0:91d1a7783bb9 592 * Channels[i].DrRange.Value = ( DR_3 << 4 ) | DR_0;
mluis 0:91d1a7783bb9 593 * Channels[i].Band = 0;
mluis 0:91d1a7783bb9 594 * }
mluis 2:14a5d6ad92d5 595 * // 500 kHz channels
mluis 0:91d1a7783bb9 596 * for( uint8_t i = LORA_MAX_NB_CHANNELS - 8; i < LORA_MAX_NB_CHANNELS; i++ )
mluis 0:91d1a7783bb9 597 * {
mluis 0:91d1a7783bb9 598 * Channels[i].Frequency = 903.0e6 + ( i - ( LORA_MAX_NB_CHANNELS - 8 ) ) * 1.6e6;
mluis 0:91d1a7783bb9 599 * Channels[i].DrRange.Value = ( DR_4 << 4 ) | DR_4;
mluis 0:91d1a7783bb9 600 * Channels[i].Band = 0;
mluis 0:91d1a7783bb9 601 * }
mluis 0:91d1a7783bb9 602 * \endcode
mluis 0:91d1a7783bb9 603 */
mluis 0:91d1a7783bb9 604 #else
mluis 0:91d1a7783bb9 605 #error "Please define a frequency band in the compiler options."
mluis 0:91d1a7783bb9 606 #endif
mluis 0:91d1a7783bb9 607
mluis 0:91d1a7783bb9 608 #endif // __LORAMAC_BOARD_H__