Update LoRaWAN MAC

Dependents:   LoRaWAN-SX1272-Application-crash LoRaWAN-SX1272-Application-24-31-9sec Canada-SX1272-LoRaWAN-EEPROM Training-Aug2018-SX1272-X-NUCLEO-IKS01A2_Natalia

Fork of LoRaWAN-lib by Semtech

Committer:
ubhat
Date:
Fri Nov 10 09:22:15 2017 +0000
Revision:
11:58f66381eb7c
Parent:
4:37c12dbc8dc7
Fix channel mask reset issue

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 0:91d1a7783bb9 9 Description: LoRa MAC layer board dependent 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 0:91d1a7783bb9 39 * Minimal 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 4:37c12dbc8dc7 49 * Minimal 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 0:91d1a7783bb9 74 * Minimal 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 0:91d1a7783bb9 106 * Second reception window channel definition.
mluis 0:91d1a7783bb9 107 */
mluis 0:91d1a7783bb9 108 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 109 #define RX_WND_2_CHANNEL { 434665000, DR_0 }
mluis 0:91d1a7783bb9 110
mluis 0:91d1a7783bb9 111 /*!
mluis 0:91d1a7783bb9 112 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 113 */
mluis 0:91d1a7783bb9 114 #define LORA_MAX_NB_BANDS 1
mluis 0:91d1a7783bb9 115
mluis 0:91d1a7783bb9 116 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 117 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 118
mluis 0:91d1a7783bb9 119 /*!
mluis 0:91d1a7783bb9 120 * LoRaMac default channels
mluis 0:91d1a7783bb9 121 */
mluis 0:91d1a7783bb9 122 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 123 #define LC1 { 433175000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 4:37c12dbc8dc7 124 #define LC2 { 433375000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 125 #define LC3 { 433575000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 126
mluis 4:37c12dbc8dc7 127 /*!
mluis 4:37c12dbc8dc7 128 * LoRaMac duty cycle for the join procedure
mluis 4:37c12dbc8dc7 129 */
mluis 4:37c12dbc8dc7 130 #define JOIN_DC 1000
mluis 4:37c12dbc8dc7 131
mluis 4:37c12dbc8dc7 132 /*!
mluis 4:37c12dbc8dc7 133 * LoRaMac channels which are allowed for the join procedure
mluis 4:37c12dbc8dc7 134 */
mluis 4:37c12dbc8dc7 135 #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) )
mluis 4:37c12dbc8dc7 136
mluis 0:91d1a7783bb9 137 #elif defined( USE_BAND_780 )
mluis 0:91d1a7783bb9 138
mluis 0:91d1a7783bb9 139 /*!
mluis 0:91d1a7783bb9 140 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 141 */
mluis 0:91d1a7783bb9 142 #define LORA_MAX_NB_CHANNELS 16
mluis 0:91d1a7783bb9 143
mluis 0:91d1a7783bb9 144 /*!
mluis 0:91d1a7783bb9 145 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 146 */
mluis 4:37c12dbc8dc7 147 #define LORAMAC_TX_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 148
mluis 0:91d1a7783bb9 149 /*!
mluis 0:91d1a7783bb9 150 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 151 */
mluis 4:37c12dbc8dc7 152 #define LORAMAC_TX_MAX_DATARATE DR_7
mluis 4:37c12dbc8dc7 153
mluis 4:37c12dbc8dc7 154 /*!
mluis 4:37c12dbc8dc7 155 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 156 */
mluis 4:37c12dbc8dc7 157 #define LORAMAC_RX_MIN_DATARATE DR_0
mluis 4:37c12dbc8dc7 158
mluis 4:37c12dbc8dc7 159 /*!
mluis 4:37c12dbc8dc7 160 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 161 */
mluis 4:37c12dbc8dc7 162 #define LORAMAC_RX_MAX_DATARATE DR_7
mluis 0:91d1a7783bb9 163
mluis 0:91d1a7783bb9 164 /*!
mluis 0:91d1a7783bb9 165 * Default datarate used by the node
mluis 0:91d1a7783bb9 166 */
mluis 0:91d1a7783bb9 167 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 168
mluis 0:91d1a7783bb9 169 /*!
mluis 1:91e4e6c60d1e 170 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 171 */
mluis 1:91e4e6c60d1e 172 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 173
mluis 1:91e4e6c60d1e 174 /*!
mluis 1:91e4e6c60d1e 175 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 176 */
mluis 1:91e4e6c60d1e 177 #define LORAMAC_MAX_RX1_DR_OFFSET 5
mluis 1:91e4e6c60d1e 178
mluis 1:91e4e6c60d1e 179 /*!
mluis 0:91d1a7783bb9 180 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 181 */
mluis 0:91d1a7783bb9 182 #define LORAMAC_MIN_TX_POWER TX_POWER_M5_DBM
mluis 0:91d1a7783bb9 183
mluis 0:91d1a7783bb9 184 /*!
mluis 0:91d1a7783bb9 185 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 186 */
mluis 0:91d1a7783bb9 187 #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 188
mluis 0:91d1a7783bb9 189 /*!
mluis 0:91d1a7783bb9 190 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 191 */
mluis 0:91d1a7783bb9 192 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 193
mluis 0:91d1a7783bb9 194 /*!
mluis 0:91d1a7783bb9 195 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 196 */
mluis 0:91d1a7783bb9 197 #define TX_POWER_10_DBM 0
mluis 0:91d1a7783bb9 198 #define TX_POWER_07_DBM 1
mluis 0:91d1a7783bb9 199 #define TX_POWER_04_DBM 2
mluis 0:91d1a7783bb9 200 #define TX_POWER_01_DBM 3
mluis 0:91d1a7783bb9 201 #define TX_POWER_M2_DBM 4
mluis 0:91d1a7783bb9 202 #define TX_POWER_M5_DBM 5
mluis 0:91d1a7783bb9 203
mluis 0:91d1a7783bb9 204 /*!
mluis 0:91d1a7783bb9 205 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 206 */
mluis 0:91d1a7783bb9 207 #define DR_0 0 // SF12 - BW125
mluis 0:91d1a7783bb9 208 #define DR_1 1 // SF11 - BW125
mluis 0:91d1a7783bb9 209 #define DR_2 2 // SF10 - BW125
mluis 0:91d1a7783bb9 210 #define DR_3 3 // SF9 - BW125
mluis 0:91d1a7783bb9 211 #define DR_4 4 // SF8 - BW125
mluis 0:91d1a7783bb9 212 #define DR_5 5 // SF7 - BW125
mluis 0:91d1a7783bb9 213 #define DR_6 6 // SF7 - BW250
mluis 0:91d1a7783bb9 214 #define DR_7 7 // FSK
mluis 0:91d1a7783bb9 215
mluis 0:91d1a7783bb9 216 /*!
mluis 0:91d1a7783bb9 217 * Second reception window channel definition.
mluis 0:91d1a7783bb9 218 */
mluis 0:91d1a7783bb9 219 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 220 #define RX_WND_2_CHANNEL { 786000000, DR_0 }
mluis 0:91d1a7783bb9 221
mluis 0:91d1a7783bb9 222 /*!
mluis 0:91d1a7783bb9 223 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 224 */
mluis 0:91d1a7783bb9 225 #define LORA_MAX_NB_BANDS 1
mluis 0:91d1a7783bb9 226
mluis 0:91d1a7783bb9 227 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 228 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 229
mluis 0:91d1a7783bb9 230 /*!
mluis 0:91d1a7783bb9 231 * LoRaMac default channels
mluis 0:91d1a7783bb9 232 */
mluis 0:91d1a7783bb9 233 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 234 #define LC1 { 779500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 4:37c12dbc8dc7 235 #define LC2 { 779700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 236 #define LC3 { 779900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 237
mluis 4:37c12dbc8dc7 238 /*!
mluis 4:37c12dbc8dc7 239 * LoRaMac duty cycle for the join procedure
mluis 4:37c12dbc8dc7 240 */
mluis 4:37c12dbc8dc7 241 #define JOIN_DC 1000
mluis 4:37c12dbc8dc7 242
mluis 4:37c12dbc8dc7 243 /*!
mluis 4:37c12dbc8dc7 244 * LoRaMac channels which are allowed for the join procedure
mluis 4:37c12dbc8dc7 245 */
mluis 4:37c12dbc8dc7 246 #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) )
mluis 4:37c12dbc8dc7 247
mluis 0:91d1a7783bb9 248 #elif defined( USE_BAND_868 )
mluis 0:91d1a7783bb9 249
mluis 0:91d1a7783bb9 250 /*!
mluis 0:91d1a7783bb9 251 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 252 */
mluis 0:91d1a7783bb9 253 #define LORA_MAX_NB_CHANNELS 16
mluis 0:91d1a7783bb9 254
mluis 0:91d1a7783bb9 255 /*!
mluis 0:91d1a7783bb9 256 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 257 */
mluis 4:37c12dbc8dc7 258 #define LORAMAC_TX_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 259
mluis 0:91d1a7783bb9 260 /*!
mluis 0:91d1a7783bb9 261 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 262 */
mluis 4:37c12dbc8dc7 263 #define LORAMAC_TX_MAX_DATARATE DR_7
mluis 4:37c12dbc8dc7 264
mluis 4:37c12dbc8dc7 265 /*!
mluis 4:37c12dbc8dc7 266 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 267 */
mluis 4:37c12dbc8dc7 268 #define LORAMAC_RX_MIN_DATARATE DR_0
mluis 4:37c12dbc8dc7 269
mluis 4:37c12dbc8dc7 270 /*!
mluis 4:37c12dbc8dc7 271 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 272 */
mluis 4:37c12dbc8dc7 273 #define LORAMAC_RX_MAX_DATARATE DR_7
mluis 0:91d1a7783bb9 274
mluis 0:91d1a7783bb9 275 /*!
mluis 0:91d1a7783bb9 276 * Default datarate used by the node
mluis 0:91d1a7783bb9 277 */
mluis 0:91d1a7783bb9 278 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 279
mluis 0:91d1a7783bb9 280 /*!
mluis 1:91e4e6c60d1e 281 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 282 */
mluis 1:91e4e6c60d1e 283 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 284
mluis 1:91e4e6c60d1e 285 /*!
mluis 1:91e4e6c60d1e 286 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 287 */
mluis 1:91e4e6c60d1e 288 #define LORAMAC_MAX_RX1_DR_OFFSET 5
mluis 1:91e4e6c60d1e 289
mluis 1:91e4e6c60d1e 290 /*!
mluis 0:91d1a7783bb9 291 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 292 */
mluis 0:91d1a7783bb9 293 #define LORAMAC_MIN_TX_POWER TX_POWER_02_DBM
mluis 0:91d1a7783bb9 294
mluis 0:91d1a7783bb9 295 /*!
mluis 0:91d1a7783bb9 296 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 297 */
mluis 0:91d1a7783bb9 298 #define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM
mluis 0:91d1a7783bb9 299
mluis 0:91d1a7783bb9 300 /*!
mluis 0:91d1a7783bb9 301 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 302 */
mluis 0:91d1a7783bb9 303 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM
mluis 0:91d1a7783bb9 304
mluis 0:91d1a7783bb9 305 /*!
mluis 0:91d1a7783bb9 306 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 307 */
mluis 0:91d1a7783bb9 308 #define TX_POWER_20_DBM 0
mluis 0:91d1a7783bb9 309 #define TX_POWER_14_DBM 1
mluis 0:91d1a7783bb9 310 #define TX_POWER_11_DBM 2
mluis 0:91d1a7783bb9 311 #define TX_POWER_08_DBM 3
mluis 0:91d1a7783bb9 312 #define TX_POWER_05_DBM 4
mluis 0:91d1a7783bb9 313 #define TX_POWER_02_DBM 5
mluis 0:91d1a7783bb9 314
mluis 0:91d1a7783bb9 315 /*!
mluis 0:91d1a7783bb9 316 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 317 */
mluis 0:91d1a7783bb9 318 #define DR_0 0 // SF12 - BW125
mluis 0:91d1a7783bb9 319 #define DR_1 1 // SF11 - BW125
mluis 0:91d1a7783bb9 320 #define DR_2 2 // SF10 - BW125
mluis 0:91d1a7783bb9 321 #define DR_3 3 // SF9 - BW125
mluis 0:91d1a7783bb9 322 #define DR_4 4 // SF8 - BW125
mluis 0:91d1a7783bb9 323 #define DR_5 5 // SF7 - BW125
mluis 0:91d1a7783bb9 324 #define DR_6 6 // SF7 - BW250
mluis 0:91d1a7783bb9 325 #define DR_7 7 // FSK
mluis 0:91d1a7783bb9 326
mluis 0:91d1a7783bb9 327 /*!
mluis 0:91d1a7783bb9 328 * Second reception window channel definition.
mluis 0:91d1a7783bb9 329 */
mluis 0:91d1a7783bb9 330 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 331 #define RX_WND_2_CHANNEL { 869525000, DR_0 }
mluis 0:91d1a7783bb9 332
mluis 0:91d1a7783bb9 333 /*!
mluis 0:91d1a7783bb9 334 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 335 */
mluis 0:91d1a7783bb9 336 #define LORA_MAX_NB_BANDS 5
mluis 0:91d1a7783bb9 337
mluis 0:91d1a7783bb9 338 /*!
mluis 0:91d1a7783bb9 339 * LoRaMac EU868 default bands
mluis 0:91d1a7783bb9 340 */
mluis 0:91d1a7783bb9 341 typedef enum
mluis 0:91d1a7783bb9 342 {
mluis 0:91d1a7783bb9 343 BAND_G1_0,
mluis 0:91d1a7783bb9 344 BAND_G1_1,
mluis 0:91d1a7783bb9 345 BAND_G1_2,
mluis 0:91d1a7783bb9 346 BAND_G1_3,
mluis 0:91d1a7783bb9 347 BAND_G1_4,
mluis 0:91d1a7783bb9 348 }BandId_t;
mluis 0:91d1a7783bb9 349
mluis 0:91d1a7783bb9 350 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 351 #define BAND0 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 352 #define BAND1 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 353 #define BAND2 { 1000, TX_POWER_14_DBM, 0, 0 } // 0.1 %
mluis 0:91d1a7783bb9 354 #define BAND3 { 10 , TX_POWER_14_DBM, 0, 0 } // 10.0 %
mluis 0:91d1a7783bb9 355 #define BAND4 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 356
mluis 0:91d1a7783bb9 357 /*!
mluis 0:91d1a7783bb9 358 * LoRaMac default channels
mluis 0:91d1a7783bb9 359 */
mluis 0:91d1a7783bb9 360 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 361 #define LC1 { 868100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
mluis 4:37c12dbc8dc7 362 #define LC2 { 868300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
mluis 0:91d1a7783bb9 363 #define LC3 { 868500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
mluis 0:91d1a7783bb9 364
mluis 4:37c12dbc8dc7 365 /*!
mluis 4:37c12dbc8dc7 366 * LoRaMac duty cycle for the join procedure
mluis 4:37c12dbc8dc7 367 */
mluis 4:37c12dbc8dc7 368 #define JOIN_DC 1000
mluis 4:37c12dbc8dc7 369
mluis 4:37c12dbc8dc7 370 /*!
mluis 4:37c12dbc8dc7 371 * LoRaMac channels which are allowed for the join procedure
mluis 4:37c12dbc8dc7 372 */
mluis 4:37c12dbc8dc7 373 #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) )
mluis 4:37c12dbc8dc7 374
mluis 0:91d1a7783bb9 375 #elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID )
mluis 0:91d1a7783bb9 376
mluis 0:91d1a7783bb9 377 /*!
mluis 0:91d1a7783bb9 378 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 379 */
mluis 0:91d1a7783bb9 380 #define LORA_MAX_NB_CHANNELS 72
mluis 0:91d1a7783bb9 381
mluis 0:91d1a7783bb9 382 /*!
mluis 0:91d1a7783bb9 383 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 384 */
mluis 4:37c12dbc8dc7 385 #define LORAMAC_TX_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 386
mluis 0:91d1a7783bb9 387 /*!
mluis 0:91d1a7783bb9 388 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 389 */
mluis 4:37c12dbc8dc7 390 #define LORAMAC_TX_MAX_DATARATE DR_4
mluis 4:37c12dbc8dc7 391
mluis 4:37c12dbc8dc7 392 /*!
mluis 4:37c12dbc8dc7 393 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 394 */
mluis 4:37c12dbc8dc7 395 #define LORAMAC_RX_MIN_DATARATE DR_8
mluis 4:37c12dbc8dc7 396
mluis 4:37c12dbc8dc7 397 /*!
mluis 4:37c12dbc8dc7 398 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 399 */
mluis 4:37c12dbc8dc7 400 #define LORAMAC_RX_MAX_DATARATE DR_13
mluis 0:91d1a7783bb9 401
mluis 0:91d1a7783bb9 402 /*!
mluis 0:91d1a7783bb9 403 * Default datarate used by the node
mluis 0:91d1a7783bb9 404 */
mluis 0:91d1a7783bb9 405 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 406
mluis 0:91d1a7783bb9 407 /*!
mluis 1:91e4e6c60d1e 408 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 409 */
mluis 1:91e4e6c60d1e 410 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 411
mluis 1:91e4e6c60d1e 412 /*!
mluis 1:91e4e6c60d1e 413 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 414 */
mluis 1:91e4e6c60d1e 415 #define LORAMAC_MAX_RX1_DR_OFFSET 3
mluis 1:91e4e6c60d1e 416
mluis 1:91e4e6c60d1e 417 /*!
mluis 0:91d1a7783bb9 418 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 419 */
mluis 0:91d1a7783bb9 420 #define LORAMAC_MIN_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 421
mluis 0:91d1a7783bb9 422 /*!
mluis 0:91d1a7783bb9 423 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 424 */
mluis 0:91d1a7783bb9 425 #define LORAMAC_MAX_TX_POWER TX_POWER_30_DBM
mluis 0:91d1a7783bb9 426
mluis 0:91d1a7783bb9 427 /*!
mluis 0:91d1a7783bb9 428 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 429 */
mluis 0:91d1a7783bb9 430 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_20_DBM
mluis 0:91d1a7783bb9 431
mluis 0:91d1a7783bb9 432 /*!
mluis 0:91d1a7783bb9 433 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 434 */
mluis 0:91d1a7783bb9 435 #define TX_POWER_30_DBM 0
mluis 0:91d1a7783bb9 436 #define TX_POWER_28_DBM 1
mluis 0:91d1a7783bb9 437 #define TX_POWER_26_DBM 2
mluis 0:91d1a7783bb9 438 #define TX_POWER_24_DBM 3
mluis 0:91d1a7783bb9 439 #define TX_POWER_22_DBM 4
mluis 0:91d1a7783bb9 440 #define TX_POWER_20_DBM 5
mluis 0:91d1a7783bb9 441 #define TX_POWER_18_DBM 6
mluis 0:91d1a7783bb9 442 #define TX_POWER_16_DBM 7
mluis 0:91d1a7783bb9 443 #define TX_POWER_14_DBM 8
mluis 0:91d1a7783bb9 444 #define TX_POWER_12_DBM 9
mluis 0:91d1a7783bb9 445 #define TX_POWER_10_DBM 10
mluis 0:91d1a7783bb9 446
mluis 0:91d1a7783bb9 447 /*!
mluis 0:91d1a7783bb9 448 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 449 */
mluis 0:91d1a7783bb9 450 #define DR_0 0 // SF10 - BW125 |
mluis 0:91d1a7783bb9 451 #define DR_1 1 // SF9 - BW125 |
mluis 0:91d1a7783bb9 452 #define DR_2 2 // SF8 - BW125 +-> Up link
mluis 0:91d1a7783bb9 453 #define DR_3 3 // SF7 - BW125 |
mluis 0:91d1a7783bb9 454 #define DR_4 4 // SF8 - BW500 |
mluis 0:91d1a7783bb9 455 #define DR_5 5 // RFU
mluis 0:91d1a7783bb9 456 #define DR_6 6 // RFU
mluis 0:91d1a7783bb9 457 #define DR_7 7 // RFU
mluis 0:91d1a7783bb9 458 #define DR_8 8 // SF12 - BW500 |
mluis 0:91d1a7783bb9 459 #define DR_9 9 // SF11 - BW500 |
mluis 0:91d1a7783bb9 460 #define DR_10 10 // SF10 - BW500 |
mluis 0:91d1a7783bb9 461 #define DR_11 11 // SF9 - BW500 |
mluis 0:91d1a7783bb9 462 #define DR_12 12 // SF8 - BW500 +-> Down link
mluis 0:91d1a7783bb9 463 #define DR_13 13 // SF7 - BW500 |
mluis 0:91d1a7783bb9 464 #define DR_14 14 // RFU |
mluis 0:91d1a7783bb9 465 #define DR_15 15 // RFU |
mluis 0:91d1a7783bb9 466
mluis 0:91d1a7783bb9 467 /*!
mluis 0:91d1a7783bb9 468 * Second reception window channel definition.
mluis 0:91d1a7783bb9 469 */
mluis 0:91d1a7783bb9 470 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 471 #define RX_WND_2_CHANNEL { 923300000, DR_8 }
mluis 0:91d1a7783bb9 472
mluis 0:91d1a7783bb9 473 /*!
mluis 0:91d1a7783bb9 474 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 475 */
mluis 0:91d1a7783bb9 476 #define LORA_MAX_NB_BANDS 1
mluis 0:91d1a7783bb9 477
mluis 0:91d1a7783bb9 478 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 479 #define BAND0 { 1, TX_POWER_20_DBM, 0, 0 } // 100.0 %
mluis 0:91d1a7783bb9 480
mluis 0:91d1a7783bb9 481 /*!
mluis 0:91d1a7783bb9 482 * LoRaMac default channels
mluis 0:91d1a7783bb9 483 */
mluis 0:91d1a7783bb9 484 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 485 /*
mluis 0:91d1a7783bb9 486 * US band channels are initialized using a loop in LoRaMacInit function
mluis 0:91d1a7783bb9 487 * \code
mluis 0:91d1a7783bb9 488 * // 125 kHz channels
mluis 0:91d1a7783bb9 489 * for( uint8_t i = 0; i < LORA_MAX_NB_CHANNELS - 8; i++ )
mluis 0:91d1a7783bb9 490 * {
mluis 0:91d1a7783bb9 491 * Channels[i].Frequency = 902.3e6 + i * 200e3;
mluis 0:91d1a7783bb9 492 * Channels[i].DrRange.Value = ( DR_3 << 4 ) | DR_0;
mluis 0:91d1a7783bb9 493 * Channels[i].Band = 0;
mluis 0:91d1a7783bb9 494 * }
mluis 2:14a5d6ad92d5 495 * // 500 kHz channels
mluis 0:91d1a7783bb9 496 * for( uint8_t i = LORA_MAX_NB_CHANNELS - 8; i < LORA_MAX_NB_CHANNELS; i++ )
mluis 0:91d1a7783bb9 497 * {
mluis 0:91d1a7783bb9 498 * Channels[i].Frequency = 903.0e6 + ( i - ( LORA_MAX_NB_CHANNELS - 8 ) ) * 1.6e6;
mluis 0:91d1a7783bb9 499 * Channels[i].DrRange.Value = ( DR_4 << 4 ) | DR_4;
mluis 0:91d1a7783bb9 500 * Channels[i].Band = 0;
mluis 0:91d1a7783bb9 501 * }
mluis 0:91d1a7783bb9 502 * \endcode
mluis 0:91d1a7783bb9 503 */
mluis 0:91d1a7783bb9 504 #else
mluis 0:91d1a7783bb9 505 #error "Please define a frequency band in the compiler options."
mluis 0:91d1a7783bb9 506 #endif
mluis 0:91d1a7783bb9 507
mluis 0:91d1a7783bb9 508 #endif // __LORAMAC_BOARD_H__