LoRaWAN-lib publish

Fork of LoRaWAN-lib by Christopher De Bank

Committer:
cdebank
Date:
Thu Nov 16 14:26:17 2017 +0000
Revision:
11:0cbf861e53f8
Parent:
8:26002607de9c
Child:
12:8fa78862788e
initial commit single frequency

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 8:26002607de9c 106 * Verification of default datarate
mluis 8:26002607de9c 107 */
mluis 8:26002607de9c 108 #if ( LORAMAC_DEFAULT_DATARATE > DR_5 )
mluis 8:26002607de9c 109 #error "A default DR higher than DR_5 may lead to connectivity loss."
mluis 8:26002607de9c 110 #endif
mluis 8:26002607de9c 111
mluis 8: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 8:26002607de9c 139 #elif defined( USE_BAND_470 )
mluis 8:26002607de9c 140
mluis 8:26002607de9c 141 /*!
mluis 8:26002607de9c 142 * LoRaMac maximum number of channels
mluis 8:26002607de9c 143 */
mluis 8:26002607de9c 144 #define LORA_MAX_NB_CHANNELS 96
mluis 8:26002607de9c 145
mluis 8:26002607de9c 146 /*!
mluis 8:26002607de9c 147 * Minimal datarate that can be used by the node
mluis 8:26002607de9c 148 */
mluis 8:26002607de9c 149 #define LORAMAC_TX_MIN_DATARATE DR_0
mluis 8:26002607de9c 150
mluis 8:26002607de9c 151 /*!
mluis 8:26002607de9c 152 * Maximal datarate that can be used by the node
mluis 8:26002607de9c 153 */
mluis 8:26002607de9c 154 #define LORAMAC_TX_MAX_DATARATE DR_5
mluis 8:26002607de9c 155
mluis 8:26002607de9c 156 /*!
mluis 8:26002607de9c 157 * Minimal datarate that can be used by the node
mluis 8:26002607de9c 158 */
mluis 8:26002607de9c 159 #define LORAMAC_RX_MIN_DATARATE DR_0
mluis 8:26002607de9c 160
mluis 8:26002607de9c 161 /*!
mluis 8:26002607de9c 162 * Maximal datarate that can be used by the node
mluis 8:26002607de9c 163 */
mluis 8:26002607de9c 164 #define LORAMAC_RX_MAX_DATARATE DR_5
mluis 8:26002607de9c 165
mluis 8:26002607de9c 166 /*!
mluis 8:26002607de9c 167 * Default datarate used by the node
mluis 8:26002607de9c 168 */
mluis 8:26002607de9c 169 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 8:26002607de9c 170
mluis 8:26002607de9c 171 /*!
mluis 8:26002607de9c 172 * Minimal Rx1 receive datarate offset
mluis 8:26002607de9c 173 */
mluis 8:26002607de9c 174 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 8:26002607de9c 175
mluis 8:26002607de9c 176 /*!
mluis 8:26002607de9c 177 * Maximal Rx1 receive datarate offset
mluis 8:26002607de9c 178 */
mluis 8:26002607de9c 179 #define LORAMAC_MAX_RX1_DR_OFFSET 3
mluis 8:26002607de9c 180
mluis 8:26002607de9c 181 /*!
mluis 8:26002607de9c 182 * Minimal Tx output power that can be used by the node
mluis 8:26002607de9c 183 */
mluis 8:26002607de9c 184 #define LORAMAC_MIN_TX_POWER TX_POWER_2_DBM
mluis 8:26002607de9c 185
mluis 8:26002607de9c 186 /*!
mluis 8:26002607de9c 187 * Maximal Tx output power that can be used by the node
mluis 8:26002607de9c 188 */
mluis 8:26002607de9c 189 #define LORAMAC_MAX_TX_POWER TX_POWER_17_DBM
mluis 8:26002607de9c 190
mluis 8:26002607de9c 191 /*!
mluis 8:26002607de9c 192 * Default Tx output power used by the node
mluis 8:26002607de9c 193 */
mluis 8:26002607de9c 194 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM
mluis 8:26002607de9c 195
mluis 8:26002607de9c 196 /*!
mluis 8:26002607de9c 197 * LoRaMac TxPower definition
mluis 8:26002607de9c 198 */
mluis 8:26002607de9c 199 #define TX_POWER_17_DBM 0
mluis 8:26002607de9c 200 #define TX_POWER_16_DBM 1
mluis 8:26002607de9c 201 #define TX_POWER_14_DBM 2
mluis 8:26002607de9c 202 #define TX_POWER_12_DBM 3
mluis 8:26002607de9c 203 #define TX_POWER_10_DBM 4
mluis 8:26002607de9c 204 #define TX_POWER_7_DBM 5
mluis 8:26002607de9c 205 #define TX_POWER_5_DBM 6
mluis 8:26002607de9c 206 #define TX_POWER_2_DBM 7
mluis 8:26002607de9c 207
mluis 8:26002607de9c 208
mluis 8:26002607de9c 209 /*!
mluis 8:26002607de9c 210 * LoRaMac datarates definition
mluis 8:26002607de9c 211 */
mluis 8:26002607de9c 212 #define DR_0 0 // SF12 - BW125 |
mluis 8:26002607de9c 213 #define DR_1 1 // SF11 - BW125 |
mluis 8:26002607de9c 214 #define DR_2 2 // SF10 - BW125 |
mluis 8:26002607de9c 215 #define DR_3 3 // SF9 - BW125 |
mluis 8:26002607de9c 216 #define DR_4 4 // SF8 - BW125 |
mluis 8:26002607de9c 217 #define DR_5 5 // SF7 - BW125 |
mluis 8:26002607de9c 218
mluis 8:26002607de9c 219 /*!
mluis 8:26002607de9c 220 * Second reception window channel definition.
mluis 8:26002607de9c 221 */
mluis 8:26002607de9c 222 // Channel = { Frequency [Hz], Datarate }
mluis 8:26002607de9c 223 #define RX_WND_2_CHANNEL { 505300000, DR_0 }
mluis 8:26002607de9c 224
mluis 8:26002607de9c 225 /*!
mluis 8:26002607de9c 226 * LoRaMac maximum number of bands
mluis 8:26002607de9c 227 */
mluis 8:26002607de9c 228 #define LORA_MAX_NB_BANDS 1
mluis 8:26002607de9c 229
mluis 8:26002607de9c 230 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 8:26002607de9c 231 #define BAND0 { 1, TX_POWER_17_DBM, 0, 0 } // 100.0 %
mluis 8: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 8:26002607de9c 313 * Verification of default datarate
mluis 8:26002607de9c 314 */
mluis 8:26002607de9c 315 #if ( LORAMAC_DEFAULT_DATARATE > DR_5 )
mluis 8:26002607de9c 316 #error "A default DR higher than DR_5 may lead to connectivity loss."
mluis 8:26002607de9c 317 #endif
mluis 8:26002607de9c 318
mluis 8: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 }
cdebank 11:0cbf861e53f8 331 //#define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 332 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 333
mluis 0:91d1a7783bb9 334 /*!
mluis 0:91d1a7783bb9 335 * LoRaMac default channels
mluis 0:91d1a7783bb9 336 */
mluis 0:91d1a7783bb9 337 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 338 #define LC1 { 779500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 4:37c12dbc8dc7 339 #define LC2 { 779700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 340 #define LC3 { 779900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 341
mluis 4:37c12dbc8dc7 342 /*!
mluis 4:37c12dbc8dc7 343 * LoRaMac channels which are allowed for the join procedure
mluis 4:37c12dbc8dc7 344 */
mluis 4:37c12dbc8dc7 345 #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) )
mluis 4:37c12dbc8dc7 346
mluis 0:91d1a7783bb9 347 #elif defined( USE_BAND_868 )
mluis 0:91d1a7783bb9 348
mluis 0:91d1a7783bb9 349 /*!
mluis 0:91d1a7783bb9 350 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 351 */
mluis 0:91d1a7783bb9 352 #define LORA_MAX_NB_CHANNELS 16
mluis 0:91d1a7783bb9 353
mluis 0:91d1a7783bb9 354 /*!
mluis 0:91d1a7783bb9 355 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 356 */
mluis 4:37c12dbc8dc7 357 #define LORAMAC_TX_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 358
mluis 0:91d1a7783bb9 359 /*!
mluis 7:c16969e0f70f 360 * Maximal datarate that can be used by the node
mluis 0:91d1a7783bb9 361 */
mluis 4:37c12dbc8dc7 362 #define LORAMAC_TX_MAX_DATARATE DR_7
mluis 4:37c12dbc8dc7 363
mluis 4:37c12dbc8dc7 364 /*!
mluis 4:37c12dbc8dc7 365 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 366 */
mluis 4:37c12dbc8dc7 367 #define LORAMAC_RX_MIN_DATARATE DR_0
mluis 4:37c12dbc8dc7 368
mluis 4:37c12dbc8dc7 369 /*!
mluis 7:c16969e0f70f 370 * Maximal datarate that can be used by the node
mluis 4:37c12dbc8dc7 371 */
mluis 4:37c12dbc8dc7 372 #define LORAMAC_RX_MAX_DATARATE DR_7
mluis 0:91d1a7783bb9 373
mluis 0:91d1a7783bb9 374 /*!
mluis 0:91d1a7783bb9 375 * Default datarate used by the node
mluis 0:91d1a7783bb9 376 */
mluis 0:91d1a7783bb9 377 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 378
mluis 0:91d1a7783bb9 379 /*!
mluis 1:91e4e6c60d1e 380 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 381 */
mluis 1:91e4e6c60d1e 382 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 383
mluis 1:91e4e6c60d1e 384 /*!
mluis 1:91e4e6c60d1e 385 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 386 */
mluis 1:91e4e6c60d1e 387 #define LORAMAC_MAX_RX1_DR_OFFSET 5
mluis 1:91e4e6c60d1e 388
mluis 1:91e4e6c60d1e 389 /*!
mluis 0:91d1a7783bb9 390 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 391 */
mluis 0:91d1a7783bb9 392 #define LORAMAC_MIN_TX_POWER TX_POWER_02_DBM
mluis 0:91d1a7783bb9 393
mluis 0:91d1a7783bb9 394 /*!
mluis 7:c16969e0f70f 395 * Maximal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 396 */
mluis 0:91d1a7783bb9 397 #define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM
mluis 0:91d1a7783bb9 398
mluis 0:91d1a7783bb9 399 /*!
mluis 0:91d1a7783bb9 400 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 401 */
mluis 0:91d1a7783bb9 402 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM
mluis 0:91d1a7783bb9 403
mluis 0:91d1a7783bb9 404 /*!
mluis 0:91d1a7783bb9 405 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 406 */
mluis 0:91d1a7783bb9 407 #define TX_POWER_20_DBM 0
mluis 0:91d1a7783bb9 408 #define TX_POWER_14_DBM 1
mluis 0:91d1a7783bb9 409 #define TX_POWER_11_DBM 2
mluis 0:91d1a7783bb9 410 #define TX_POWER_08_DBM 3
mluis 0:91d1a7783bb9 411 #define TX_POWER_05_DBM 4
mluis 0:91d1a7783bb9 412 #define TX_POWER_02_DBM 5
mluis 0:91d1a7783bb9 413
mluis 0:91d1a7783bb9 414 /*!
mluis 0:91d1a7783bb9 415 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 416 */
mluis 0:91d1a7783bb9 417 #define DR_0 0 // SF12 - BW125
mluis 0:91d1a7783bb9 418 #define DR_1 1 // SF11 - BW125
mluis 0:91d1a7783bb9 419 #define DR_2 2 // SF10 - BW125
mluis 0:91d1a7783bb9 420 #define DR_3 3 // SF9 - BW125
mluis 0:91d1a7783bb9 421 #define DR_4 4 // SF8 - BW125
mluis 0:91d1a7783bb9 422 #define DR_5 5 // SF7 - BW125
mluis 0:91d1a7783bb9 423 #define DR_6 6 // SF7 - BW250
mluis 0:91d1a7783bb9 424 #define DR_7 7 // FSK
mluis 0:91d1a7783bb9 425
mluis 0:91d1a7783bb9 426 /*!
mluis 8:26002607de9c 427 * Verification of default datarate
mluis 8:26002607de9c 428 */
mluis 8:26002607de9c 429 #if ( LORAMAC_DEFAULT_DATARATE > DR_5 )
mluis 8:26002607de9c 430 #error "A default DR higher than DR_5 may lead to connectivity loss."
mluis 8:26002607de9c 431 #endif
mluis 8:26002607de9c 432
mluis 8:26002607de9c 433 /*!
mluis 0:91d1a7783bb9 434 * Second reception window channel definition.
mluis 0:91d1a7783bb9 435 */
mluis 0:91d1a7783bb9 436 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 437 #define RX_WND_2_CHANNEL { 869525000, DR_0 }
mluis 0:91d1a7783bb9 438
mluis 0:91d1a7783bb9 439 /*!
mluis 0:91d1a7783bb9 440 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 441 */
mluis 0:91d1a7783bb9 442 #define LORA_MAX_NB_BANDS 5
mluis 0:91d1a7783bb9 443
mluis 0:91d1a7783bb9 444 /*!
mluis 0:91d1a7783bb9 445 * LoRaMac EU868 default bands
mluis 0:91d1a7783bb9 446 */
mluis 0:91d1a7783bb9 447 typedef enum
mluis 0:91d1a7783bb9 448 {
mluis 0:91d1a7783bb9 449 BAND_G1_0,
mluis 0:91d1a7783bb9 450 BAND_G1_1,
mluis 0:91d1a7783bb9 451 BAND_G1_2,
mluis 0:91d1a7783bb9 452 BAND_G1_3,
mluis 0:91d1a7783bb9 453 BAND_G1_4,
mluis 0:91d1a7783bb9 454 }BandId_t;
mluis 0:91d1a7783bb9 455
mluis 0:91d1a7783bb9 456 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 457 #define BAND0 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 458 #define BAND1 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 459 #define BAND2 { 1000, TX_POWER_14_DBM, 0, 0 } // 0.1 %
mluis 0:91d1a7783bb9 460 #define BAND3 { 10 , TX_POWER_14_DBM, 0, 0 } // 10.0 %
mluis 0:91d1a7783bb9 461 #define BAND4 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 462
mluis 0:91d1a7783bb9 463 /*!
mluis 0:91d1a7783bb9 464 * LoRaMac default channels
mluis 0:91d1a7783bb9 465 */
mluis 0:91d1a7783bb9 466 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
cdebank 11:0cbf861e53f8 467 //Commented out by Chris
cdebank 11:0cbf861e53f8 468 //#define LC1 { 868100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
cdebank 11:0cbf861e53f8 469 //#define LC2 { 868300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
cdebank 11:0cbf861e53f8 470 //#define LC3 { 868500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
cdebank 11:0cbf861e53f8 471
cdebank 11:0cbf861e53f8 472 #define LC1 { 869400000, { ( ( DR_5 << 4 ) | DR_5 ) }, 3 }
mluis 0:91d1a7783bb9 473
mluis 4:37c12dbc8dc7 474 /*!
mluis 4:37c12dbc8dc7 475 * LoRaMac channels which are allowed for the join procedure
mluis 4:37c12dbc8dc7 476 */
cdebank 11:0cbf861e53f8 477 //Commented out by Chris
cdebank 11:0cbf861e53f8 478 //#define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) )
cdebank 11:0cbf861e53f8 479 #define JOIN_CHANNELS ( uint16_t )( LC( 1 ))
mluis 4:37c12dbc8dc7 480
mluis 0:91d1a7783bb9 481 #elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID )
mluis 0:91d1a7783bb9 482
mluis 0:91d1a7783bb9 483 /*!
mluis 0:91d1a7783bb9 484 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 485 */
mluis 0:91d1a7783bb9 486 #define LORA_MAX_NB_CHANNELS 72
mluis 0:91d1a7783bb9 487
mluis 0:91d1a7783bb9 488 /*!
mluis 0:91d1a7783bb9 489 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 490 */
mluis 4:37c12dbc8dc7 491 #define LORAMAC_TX_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 492
mluis 0:91d1a7783bb9 493 /*!
mluis 7:c16969e0f70f 494 * Maximal datarate that can be used by the node
mluis 0:91d1a7783bb9 495 */
mluis 4:37c12dbc8dc7 496 #define LORAMAC_TX_MAX_DATARATE DR_4
mluis 4:37c12dbc8dc7 497
mluis 4:37c12dbc8dc7 498 /*!
mluis 4:37c12dbc8dc7 499 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 500 */
mluis 4:37c12dbc8dc7 501 #define LORAMAC_RX_MIN_DATARATE DR_8
mluis 4:37c12dbc8dc7 502
mluis 4:37c12dbc8dc7 503 /*!
mluis 7:c16969e0f70f 504 * Maximal datarate that can be used by the node
mluis 4:37c12dbc8dc7 505 */
mluis 4:37c12dbc8dc7 506 #define LORAMAC_RX_MAX_DATARATE DR_13
mluis 0:91d1a7783bb9 507
mluis 0:91d1a7783bb9 508 /*!
mluis 0:91d1a7783bb9 509 * Default datarate used by the node
mluis 0:91d1a7783bb9 510 */
mluis 0:91d1a7783bb9 511 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 512
mluis 0:91d1a7783bb9 513 /*!
mluis 1:91e4e6c60d1e 514 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 515 */
mluis 1:91e4e6c60d1e 516 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 517
mluis 1:91e4e6c60d1e 518 /*!
mluis 1:91e4e6c60d1e 519 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 520 */
mluis 1:91e4e6c60d1e 521 #define LORAMAC_MAX_RX1_DR_OFFSET 3
mluis 1:91e4e6c60d1e 522
mluis 1:91e4e6c60d1e 523 /*!
mluis 0:91d1a7783bb9 524 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 525 */
mluis 0:91d1a7783bb9 526 #define LORAMAC_MIN_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 527
mluis 0:91d1a7783bb9 528 /*!
mluis 7:c16969e0f70f 529 * Maximal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 530 */
mluis 0:91d1a7783bb9 531 #define LORAMAC_MAX_TX_POWER TX_POWER_30_DBM
mluis 0:91d1a7783bb9 532
mluis 0:91d1a7783bb9 533 /*!
mluis 0:91d1a7783bb9 534 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 535 */
mluis 0:91d1a7783bb9 536 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_20_DBM
mluis 0:91d1a7783bb9 537
mluis 0:91d1a7783bb9 538 /*!
mluis 0:91d1a7783bb9 539 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 540 */
mluis 0:91d1a7783bb9 541 #define TX_POWER_30_DBM 0
mluis 0:91d1a7783bb9 542 #define TX_POWER_28_DBM 1
mluis 0:91d1a7783bb9 543 #define TX_POWER_26_DBM 2
mluis 0:91d1a7783bb9 544 #define TX_POWER_24_DBM 3
mluis 0:91d1a7783bb9 545 #define TX_POWER_22_DBM 4
mluis 0:91d1a7783bb9 546 #define TX_POWER_20_DBM 5
mluis 0:91d1a7783bb9 547 #define TX_POWER_18_DBM 6
mluis 0:91d1a7783bb9 548 #define TX_POWER_16_DBM 7
mluis 0:91d1a7783bb9 549 #define TX_POWER_14_DBM 8
mluis 0:91d1a7783bb9 550 #define TX_POWER_12_DBM 9
mluis 0:91d1a7783bb9 551 #define TX_POWER_10_DBM 10
mluis 0:91d1a7783bb9 552
mluis 0:91d1a7783bb9 553 /*!
mluis 0:91d1a7783bb9 554 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 555 */
mluis 0:91d1a7783bb9 556 #define DR_0 0 // SF10 - BW125 |
mluis 0:91d1a7783bb9 557 #define DR_1 1 // SF9 - BW125 |
mluis 0:91d1a7783bb9 558 #define DR_2 2 // SF8 - BW125 +-> Up link
mluis 0:91d1a7783bb9 559 #define DR_3 3 // SF7 - BW125 |
mluis 0:91d1a7783bb9 560 #define DR_4 4 // SF8 - BW500 |
mluis 0:91d1a7783bb9 561 #define DR_5 5 // RFU
mluis 0:91d1a7783bb9 562 #define DR_6 6 // RFU
mluis 0:91d1a7783bb9 563 #define DR_7 7 // RFU
mluis 0:91d1a7783bb9 564 #define DR_8 8 // SF12 - BW500 |
mluis 0:91d1a7783bb9 565 #define DR_9 9 // SF11 - BW500 |
mluis 0:91d1a7783bb9 566 #define DR_10 10 // SF10 - BW500 |
mluis 0:91d1a7783bb9 567 #define DR_11 11 // SF9 - BW500 |
mluis 0:91d1a7783bb9 568 #define DR_12 12 // SF8 - BW500 +-> Down link
mluis 0:91d1a7783bb9 569 #define DR_13 13 // SF7 - BW500 |
mluis 0:91d1a7783bb9 570 #define DR_14 14 // RFU |
mluis 0:91d1a7783bb9 571 #define DR_15 15 // RFU |
mluis 0:91d1a7783bb9 572
mluis 0:91d1a7783bb9 573 /*!
mluis 0:91d1a7783bb9 574 * Second reception window channel definition.
mluis 0:91d1a7783bb9 575 */
mluis 0:91d1a7783bb9 576 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 577 #define RX_WND_2_CHANNEL { 923300000, DR_8 }
mluis 0:91d1a7783bb9 578
mluis 0:91d1a7783bb9 579 /*!
mluis 0:91d1a7783bb9 580 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 581 */
mluis 0:91d1a7783bb9 582 #define LORA_MAX_NB_BANDS 1
mluis 0:91d1a7783bb9 583
mluis 0:91d1a7783bb9 584 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 585 #define BAND0 { 1, TX_POWER_20_DBM, 0, 0 } // 100.0 %
mluis 0:91d1a7783bb9 586
mluis 0:91d1a7783bb9 587 /*!
mluis 0:91d1a7783bb9 588 * LoRaMac default channels
mluis 0:91d1a7783bb9 589 */
mluis 0:91d1a7783bb9 590 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 591 /*
mluis 0:91d1a7783bb9 592 * US band channels are initialized using a loop in LoRaMacInit function
mluis 0:91d1a7783bb9 593 * \code
mluis 0:91d1a7783bb9 594 * // 125 kHz channels
mluis 0:91d1a7783bb9 595 * for( uint8_t i = 0; i < LORA_MAX_NB_CHANNELS - 8; i++ )
mluis 0:91d1a7783bb9 596 * {
mluis 0:91d1a7783bb9 597 * Channels[i].Frequency = 902.3e6 + i * 200e3;
mluis 0:91d1a7783bb9 598 * Channels[i].DrRange.Value = ( DR_3 << 4 ) | DR_0;
mluis 0:91d1a7783bb9 599 * Channels[i].Band = 0;
mluis 0:91d1a7783bb9 600 * }
mluis 2:14a5d6ad92d5 601 * // 500 kHz channels
mluis 0:91d1a7783bb9 602 * for( uint8_t i = LORA_MAX_NB_CHANNELS - 8; i < LORA_MAX_NB_CHANNELS; i++ )
mluis 0:91d1a7783bb9 603 * {
mluis 0:91d1a7783bb9 604 * Channels[i].Frequency = 903.0e6 + ( i - ( LORA_MAX_NB_CHANNELS - 8 ) ) * 1.6e6;
mluis 0:91d1a7783bb9 605 * Channels[i].DrRange.Value = ( DR_4 << 4 ) | DR_4;
mluis 0:91d1a7783bb9 606 * Channels[i].Band = 0;
mluis 0:91d1a7783bb9 607 * }
mluis 0:91d1a7783bb9 608 * \endcode
mluis 0:91d1a7783bb9 609 */
mluis 0:91d1a7783bb9 610 #else
mluis 0:91d1a7783bb9 611 #error "Please define a frequency band in the compiler options."
mluis 0:91d1a7783bb9 612 #endif
mluis 0:91d1a7783bb9 613
mluis 0:91d1a7783bb9 614 #endif // __LORAMAC_BOARD_H__