Fork of Semtech LoRaWAN stack

Fork of LoRaWAN-lib by canuck lehead

Committer:
Shaun Nelson
Date:
Thu Sep 15 15:39:41 2016 -0400
Branch:
v4.2.0
Revision:
18:5ccaea55a881
Parent:
4:37c12dbc8dc7
Child:
31:930f949fdd9e
Fix for not sending all MAC Link ADR command responses

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
Shaun Nelson 18:5ccaea55a881 18 /*
Shaun Nelson 18:5ccaea55a881 19 * Maximum join retransmission duty cycle timer wait period in seconds
Shaun Nelson 18:5ccaea55a881 20 */
Shaun Nelson 18:5ccaea55a881 21 #define JOIN_RETRANSMISSION_DC_WAIT_MAX 3600
Shaun Nelson 18:5ccaea55a881 22
mluis 0:91d1a7783bb9 23 /*!
mluis 0:91d1a7783bb9 24 * Returns individual channel mask
mluis 0:91d1a7783bb9 25 *
mluis 0:91d1a7783bb9 26 * \param[IN] channelIndex Channel index 1 based
mluis 0:91d1a7783bb9 27 * \retval channelMask
mluis 0:91d1a7783bb9 28 */
mluis 0:91d1a7783bb9 29 #define LC( channelIndex ) ( uint16_t )( 1 << ( channelIndex - 1 ) )
mluis 0:91d1a7783bb9 30
mluis 0:91d1a7783bb9 31 #if defined( USE_BAND_433 )
mluis 0:91d1a7783bb9 32
mluis 0:91d1a7783bb9 33 /*!
mluis 0:91d1a7783bb9 34 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 35 */
mluis 0:91d1a7783bb9 36 #define LORA_MAX_NB_CHANNELS 16
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_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 42
mluis 0:91d1a7783bb9 43 /*!
mluis 0:91d1a7783bb9 44 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 45 */
mluis 4:37c12dbc8dc7 46 #define LORAMAC_TX_MAX_DATARATE DR_7
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_MIN_DATARATE DR_0
mluis 4:37c12dbc8dc7 52
mluis 4:37c12dbc8dc7 53 /*!
mluis 4:37c12dbc8dc7 54 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 55 */
mluis 4:37c12dbc8dc7 56 #define LORAMAC_RX_MAX_DATARATE DR_7
mluis 0:91d1a7783bb9 57
mluis 0:91d1a7783bb9 58 /*!
mluis 0:91d1a7783bb9 59 * Default datarate used by the node
mluis 0:91d1a7783bb9 60 */
mluis 0:91d1a7783bb9 61 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 62
mluis 0:91d1a7783bb9 63 /*!
mluis 1:91e4e6c60d1e 64 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 65 */
mluis 1:91e4e6c60d1e 66 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 67
mluis 1:91e4e6c60d1e 68 /*!
mluis 1:91e4e6c60d1e 69 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 70 */
mluis 1:91e4e6c60d1e 71 #define LORAMAC_MAX_RX1_DR_OFFSET 5
mluis 1:91e4e6c60d1e 72
mluis 1:91e4e6c60d1e 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_MIN_TX_POWER TX_POWER_M5_DBM
mluis 0:91d1a7783bb9 77
mluis 0:91d1a7783bb9 78 /*!
mluis 0:91d1a7783bb9 79 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 80 */
mluis 0:91d1a7783bb9 81 #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 82
mluis 0:91d1a7783bb9 83 /*!
mluis 0:91d1a7783bb9 84 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 85 */
mluis 0:91d1a7783bb9 86 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 87
mluis 0:91d1a7783bb9 88 /*!
mluis 0:91d1a7783bb9 89 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 90 */
mluis 0:91d1a7783bb9 91 #define TX_POWER_10_DBM 0
mluis 0:91d1a7783bb9 92 #define TX_POWER_07_DBM 1
mluis 0:91d1a7783bb9 93 #define TX_POWER_04_DBM 2
mluis 0:91d1a7783bb9 94 #define TX_POWER_01_DBM 3
mluis 0:91d1a7783bb9 95 #define TX_POWER_M2_DBM 4
mluis 0:91d1a7783bb9 96 #define TX_POWER_M5_DBM 5
mluis 0:91d1a7783bb9 97
mluis 0:91d1a7783bb9 98 /*!
mluis 0:91d1a7783bb9 99 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 100 */
mluis 0:91d1a7783bb9 101 #define DR_0 0 // SF12 - BW125
mluis 0:91d1a7783bb9 102 #define DR_1 1 // SF11 - BW125
mluis 0:91d1a7783bb9 103 #define DR_2 2 // SF10 - BW125
mluis 0:91d1a7783bb9 104 #define DR_3 3 // SF9 - BW125
mluis 0:91d1a7783bb9 105 #define DR_4 4 // SF8 - BW125
mluis 0:91d1a7783bb9 106 #define DR_5 5 // SF7 - BW125
mluis 0:91d1a7783bb9 107 #define DR_6 6 // SF7 - BW250
mluis 0:91d1a7783bb9 108 #define DR_7 7 // FSK
mluis 0:91d1a7783bb9 109
mluis 0:91d1a7783bb9 110 /*!
mluis 0:91d1a7783bb9 111 * Second reception window channel definition.
mluis 0:91d1a7783bb9 112 */
mluis 0:91d1a7783bb9 113 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 114 #define RX_WND_2_CHANNEL { 434665000, DR_0 }
mluis 0:91d1a7783bb9 115
mluis 0:91d1a7783bb9 116 /*!
mluis 0:91d1a7783bb9 117 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 118 */
mluis 0:91d1a7783bb9 119 #define LORA_MAX_NB_BANDS 1
mluis 0:91d1a7783bb9 120
mluis 0:91d1a7783bb9 121 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 122 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 123
mluis 0:91d1a7783bb9 124 /*!
mluis 0:91d1a7783bb9 125 * LoRaMac default channels
mluis 0:91d1a7783bb9 126 */
mluis 0:91d1a7783bb9 127 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 128 #define LC1 { 433175000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 4:37c12dbc8dc7 129 #define LC2 { 433375000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 130 #define LC3 { 433575000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 131
mluis 4:37c12dbc8dc7 132 /*!
mluis 4:37c12dbc8dc7 133 * LoRaMac duty cycle for the join procedure
mluis 4:37c12dbc8dc7 134 */
mluis 4:37c12dbc8dc7 135 #define JOIN_DC 1000
mluis 4:37c12dbc8dc7 136
mluis 4:37c12dbc8dc7 137 /*!
mluis 4:37c12dbc8dc7 138 * LoRaMac channels which are allowed for the join procedure
mluis 4:37c12dbc8dc7 139 */
mluis 4:37c12dbc8dc7 140 #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) )
mluis 4:37c12dbc8dc7 141
mluis 0:91d1a7783bb9 142 #elif defined( USE_BAND_780 )
mluis 0:91d1a7783bb9 143
mluis 0:91d1a7783bb9 144 /*!
mluis 0:91d1a7783bb9 145 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 146 */
mluis 0:91d1a7783bb9 147 #define LORA_MAX_NB_CHANNELS 16
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_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 153
mluis 0:91d1a7783bb9 154 /*!
mluis 0:91d1a7783bb9 155 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 156 */
mluis 4:37c12dbc8dc7 157 #define LORAMAC_TX_MAX_DATARATE DR_7
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_MIN_DATARATE DR_0
mluis 4:37c12dbc8dc7 163
mluis 4:37c12dbc8dc7 164 /*!
mluis 4:37c12dbc8dc7 165 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 166 */
mluis 4:37c12dbc8dc7 167 #define LORAMAC_RX_MAX_DATARATE DR_7
mluis 0:91d1a7783bb9 168
mluis 0:91d1a7783bb9 169 /*!
mluis 0:91d1a7783bb9 170 * Default datarate used by the node
mluis 0:91d1a7783bb9 171 */
mluis 0:91d1a7783bb9 172 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 173
mluis 0:91d1a7783bb9 174 /*!
mluis 1:91e4e6c60d1e 175 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 176 */
mluis 1:91e4e6c60d1e 177 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 178
mluis 1:91e4e6c60d1e 179 /*!
mluis 1:91e4e6c60d1e 180 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 181 */
mluis 1:91e4e6c60d1e 182 #define LORAMAC_MAX_RX1_DR_OFFSET 5
mluis 1:91e4e6c60d1e 183
mluis 1:91e4e6c60d1e 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_MIN_TX_POWER TX_POWER_M5_DBM
mluis 0:91d1a7783bb9 188
mluis 0:91d1a7783bb9 189 /*!
mluis 0:91d1a7783bb9 190 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 191 */
mluis 0:91d1a7783bb9 192 #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 193
mluis 0:91d1a7783bb9 194 /*!
mluis 0:91d1a7783bb9 195 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 196 */
mluis 0:91d1a7783bb9 197 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 198
mluis 0:91d1a7783bb9 199 /*!
mluis 0:91d1a7783bb9 200 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 201 */
mluis 0:91d1a7783bb9 202 #define TX_POWER_10_DBM 0
mluis 0:91d1a7783bb9 203 #define TX_POWER_07_DBM 1
mluis 0:91d1a7783bb9 204 #define TX_POWER_04_DBM 2
mluis 0:91d1a7783bb9 205 #define TX_POWER_01_DBM 3
mluis 0:91d1a7783bb9 206 #define TX_POWER_M2_DBM 4
mluis 0:91d1a7783bb9 207 #define TX_POWER_M5_DBM 5
mluis 0:91d1a7783bb9 208
mluis 0:91d1a7783bb9 209 /*!
mluis 0:91d1a7783bb9 210 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 211 */
mluis 0:91d1a7783bb9 212 #define DR_0 0 // SF12 - BW125
mluis 0:91d1a7783bb9 213 #define DR_1 1 // SF11 - BW125
mluis 0:91d1a7783bb9 214 #define DR_2 2 // SF10 - BW125
mluis 0:91d1a7783bb9 215 #define DR_3 3 // SF9 - BW125
mluis 0:91d1a7783bb9 216 #define DR_4 4 // SF8 - BW125
mluis 0:91d1a7783bb9 217 #define DR_5 5 // SF7 - BW125
mluis 0:91d1a7783bb9 218 #define DR_6 6 // SF7 - BW250
mluis 0:91d1a7783bb9 219 #define DR_7 7 // FSK
mluis 0:91d1a7783bb9 220
mluis 0:91d1a7783bb9 221 /*!
mluis 0:91d1a7783bb9 222 * Second reception window channel definition.
mluis 0:91d1a7783bb9 223 */
mluis 0:91d1a7783bb9 224 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 225 #define RX_WND_2_CHANNEL { 786000000, DR_0 }
mluis 0:91d1a7783bb9 226
mluis 0:91d1a7783bb9 227 /*!
mluis 0:91d1a7783bb9 228 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 229 */
mluis 0:91d1a7783bb9 230 #define LORA_MAX_NB_BANDS 1
mluis 0:91d1a7783bb9 231
mluis 0:91d1a7783bb9 232 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 233 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 234
mluis 0:91d1a7783bb9 235 /*!
mluis 0:91d1a7783bb9 236 * LoRaMac default channels
mluis 0:91d1a7783bb9 237 */
mluis 0:91d1a7783bb9 238 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 239 #define LC1 { 779500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 4:37c12dbc8dc7 240 #define LC2 { 779700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 241 #define LC3 { 779900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 242
mluis 4:37c12dbc8dc7 243 /*!
mluis 4:37c12dbc8dc7 244 * LoRaMac duty cycle for the join procedure
mluis 4:37c12dbc8dc7 245 */
mluis 4:37c12dbc8dc7 246 #define JOIN_DC 1000
mluis 4:37c12dbc8dc7 247
mluis 4:37c12dbc8dc7 248 /*!
mluis 4:37c12dbc8dc7 249 * LoRaMac channels which are allowed for the join procedure
mluis 4:37c12dbc8dc7 250 */
mluis 4:37c12dbc8dc7 251 #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) )
mluis 4:37c12dbc8dc7 252
mluis 0:91d1a7783bb9 253 #elif defined( USE_BAND_868 )
mluis 0:91d1a7783bb9 254
mluis 0:91d1a7783bb9 255 /*!
mluis 0:91d1a7783bb9 256 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 257 */
mluis 0:91d1a7783bb9 258 #define LORA_MAX_NB_CHANNELS 16
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_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 264
mluis 0:91d1a7783bb9 265 /*!
mluis 0:91d1a7783bb9 266 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 267 */
mluis 4:37c12dbc8dc7 268 #define LORAMAC_TX_MAX_DATARATE DR_7
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_MIN_DATARATE DR_0
mluis 4:37c12dbc8dc7 274
mluis 4:37c12dbc8dc7 275 /*!
mluis 4:37c12dbc8dc7 276 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 277 */
mluis 4:37c12dbc8dc7 278 #define LORAMAC_RX_MAX_DATARATE DR_7
mluis 0:91d1a7783bb9 279
mluis 0:91d1a7783bb9 280 /*!
mluis 0:91d1a7783bb9 281 * Default datarate used by the node
mluis 0:91d1a7783bb9 282 */
mluis 0:91d1a7783bb9 283 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 284
mluis 0:91d1a7783bb9 285 /*!
mluis 1:91e4e6c60d1e 286 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 287 */
mluis 1:91e4e6c60d1e 288 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 289
mluis 1:91e4e6c60d1e 290 /*!
mluis 1:91e4e6c60d1e 291 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 292 */
mluis 1:91e4e6c60d1e 293 #define LORAMAC_MAX_RX1_DR_OFFSET 5
mluis 1:91e4e6c60d1e 294
mluis 1:91e4e6c60d1e 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_MIN_TX_POWER TX_POWER_02_DBM
mluis 0:91d1a7783bb9 299
mluis 0:91d1a7783bb9 300 /*!
mluis 0:91d1a7783bb9 301 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 302 */
mluis 0:91d1a7783bb9 303 #define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM
mluis 0:91d1a7783bb9 304
mluis 0:91d1a7783bb9 305 /*!
mluis 0:91d1a7783bb9 306 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 307 */
mluis 0:91d1a7783bb9 308 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM
mluis 0:91d1a7783bb9 309
mluis 0:91d1a7783bb9 310 /*!
mluis 0:91d1a7783bb9 311 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 312 */
mluis 0:91d1a7783bb9 313 #define TX_POWER_20_DBM 0
mluis 0:91d1a7783bb9 314 #define TX_POWER_14_DBM 1
mluis 0:91d1a7783bb9 315 #define TX_POWER_11_DBM 2
mluis 0:91d1a7783bb9 316 #define TX_POWER_08_DBM 3
mluis 0:91d1a7783bb9 317 #define TX_POWER_05_DBM 4
mluis 0:91d1a7783bb9 318 #define TX_POWER_02_DBM 5
mluis 0:91d1a7783bb9 319
mluis 0:91d1a7783bb9 320 /*!
mluis 0:91d1a7783bb9 321 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 322 */
mluis 0:91d1a7783bb9 323 #define DR_0 0 // SF12 - BW125
mluis 0:91d1a7783bb9 324 #define DR_1 1 // SF11 - BW125
mluis 0:91d1a7783bb9 325 #define DR_2 2 // SF10 - BW125
mluis 0:91d1a7783bb9 326 #define DR_3 3 // SF9 - BW125
mluis 0:91d1a7783bb9 327 #define DR_4 4 // SF8 - BW125
mluis 0:91d1a7783bb9 328 #define DR_5 5 // SF7 - BW125
mluis 0:91d1a7783bb9 329 #define DR_6 6 // SF7 - BW250
mluis 0:91d1a7783bb9 330 #define DR_7 7 // FSK
mluis 0:91d1a7783bb9 331
mluis 0:91d1a7783bb9 332 /*!
mluis 0:91d1a7783bb9 333 * Second reception window channel definition.
mluis 0:91d1a7783bb9 334 */
mluis 0:91d1a7783bb9 335 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 336 #define RX_WND_2_CHANNEL { 869525000, DR_0 }
mluis 0:91d1a7783bb9 337
mluis 0:91d1a7783bb9 338 /*!
mluis 0:91d1a7783bb9 339 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 340 */
mluis 0:91d1a7783bb9 341 #define LORA_MAX_NB_BANDS 5
mluis 0:91d1a7783bb9 342
mluis 0:91d1a7783bb9 343 /*!
mluis 0:91d1a7783bb9 344 * LoRaMac EU868 default bands
mluis 0:91d1a7783bb9 345 */
mluis 0:91d1a7783bb9 346 typedef enum
mluis 0:91d1a7783bb9 347 {
mluis 0:91d1a7783bb9 348 BAND_G1_0,
mluis 0:91d1a7783bb9 349 BAND_G1_1,
mluis 0:91d1a7783bb9 350 BAND_G1_2,
mluis 0:91d1a7783bb9 351 BAND_G1_3,
mluis 0:91d1a7783bb9 352 BAND_G1_4,
mluis 0:91d1a7783bb9 353 }BandId_t;
mluis 0:91d1a7783bb9 354
mluis 0:91d1a7783bb9 355 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 356 #define BAND0 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 357 #define BAND1 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 358 #define BAND2 { 1000, TX_POWER_14_DBM, 0, 0 } // 0.1 %
mluis 0:91d1a7783bb9 359 #define BAND3 { 10 , TX_POWER_14_DBM, 0, 0 } // 10.0 %
mluis 0:91d1a7783bb9 360 #define BAND4 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 361
mluis 0:91d1a7783bb9 362 /*!
mluis 0:91d1a7783bb9 363 * LoRaMac default channels
mluis 0:91d1a7783bb9 364 */
mluis 0:91d1a7783bb9 365 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 366 #define LC1 { 868100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
mluis 4:37c12dbc8dc7 367 #define LC2 { 868300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
mluis 0:91d1a7783bb9 368 #define LC3 { 868500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
mluis 0:91d1a7783bb9 369
mluis 4:37c12dbc8dc7 370 /*!
mluis 4:37c12dbc8dc7 371 * LoRaMac duty cycle for the join procedure
mluis 4:37c12dbc8dc7 372 */
mluis 4:37c12dbc8dc7 373 #define JOIN_DC 1000
mluis 4:37c12dbc8dc7 374
mluis 4:37c12dbc8dc7 375 /*!
mluis 4:37c12dbc8dc7 376 * LoRaMac channels which are allowed for the join procedure
mluis 4:37c12dbc8dc7 377 */
mluis 4:37c12dbc8dc7 378 #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) )
mluis 4:37c12dbc8dc7 379
mluis 0:91d1a7783bb9 380 #elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID )
mluis 0:91d1a7783bb9 381
mluis 0:91d1a7783bb9 382 /*!
mluis 0:91d1a7783bb9 383 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 384 */
mluis 0:91d1a7783bb9 385 #define LORA_MAX_NB_CHANNELS 72
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_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 391
mluis 0:91d1a7783bb9 392 /*!
mluis 0:91d1a7783bb9 393 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 394 */
mluis 4:37c12dbc8dc7 395 #define LORAMAC_TX_MAX_DATARATE DR_4
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_MIN_DATARATE DR_8
mluis 4:37c12dbc8dc7 401
mluis 4:37c12dbc8dc7 402 /*!
mluis 4:37c12dbc8dc7 403 * Minimal datarate that can be used by the node
mluis 4:37c12dbc8dc7 404 */
mluis 4:37c12dbc8dc7 405 #define LORAMAC_RX_MAX_DATARATE DR_13
mluis 0:91d1a7783bb9 406
mluis 0:91d1a7783bb9 407 /*!
mluis 0:91d1a7783bb9 408 * Default datarate used by the node
mluis 0:91d1a7783bb9 409 */
mluis 0:91d1a7783bb9 410 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 411
mluis 0:91d1a7783bb9 412 /*!
mluis 1:91e4e6c60d1e 413 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 414 */
mluis 1:91e4e6c60d1e 415 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 416
mluis 1:91e4e6c60d1e 417 /*!
mluis 1:91e4e6c60d1e 418 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 419 */
mluis 1:91e4e6c60d1e 420 #define LORAMAC_MAX_RX1_DR_OFFSET 3
mluis 1:91e4e6c60d1e 421
mluis 1:91e4e6c60d1e 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_MIN_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 426
mluis 0:91d1a7783bb9 427 /*!
mluis 0:91d1a7783bb9 428 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 429 */
mluis 0:91d1a7783bb9 430 #define LORAMAC_MAX_TX_POWER TX_POWER_30_DBM
mluis 0:91d1a7783bb9 431
mluis 0:91d1a7783bb9 432 /*!
mluis 0:91d1a7783bb9 433 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 434 */
mluis 0:91d1a7783bb9 435 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_20_DBM
mluis 0:91d1a7783bb9 436
mluis 0:91d1a7783bb9 437 /*!
mluis 0:91d1a7783bb9 438 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 439 */
mluis 0:91d1a7783bb9 440 #define TX_POWER_30_DBM 0
mluis 0:91d1a7783bb9 441 #define TX_POWER_28_DBM 1
mluis 0:91d1a7783bb9 442 #define TX_POWER_26_DBM 2
mluis 0:91d1a7783bb9 443 #define TX_POWER_24_DBM 3
mluis 0:91d1a7783bb9 444 #define TX_POWER_22_DBM 4
mluis 0:91d1a7783bb9 445 #define TX_POWER_20_DBM 5
mluis 0:91d1a7783bb9 446 #define TX_POWER_18_DBM 6
mluis 0:91d1a7783bb9 447 #define TX_POWER_16_DBM 7
mluis 0:91d1a7783bb9 448 #define TX_POWER_14_DBM 8
mluis 0:91d1a7783bb9 449 #define TX_POWER_12_DBM 9
mluis 0:91d1a7783bb9 450 #define TX_POWER_10_DBM 10
mluis 0:91d1a7783bb9 451
mluis 0:91d1a7783bb9 452 /*!
mluis 0:91d1a7783bb9 453 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 454 */
mluis 0:91d1a7783bb9 455 #define DR_0 0 // SF10 - BW125 |
mluis 0:91d1a7783bb9 456 #define DR_1 1 // SF9 - BW125 |
mluis 0:91d1a7783bb9 457 #define DR_2 2 // SF8 - BW125 +-> Up link
mluis 0:91d1a7783bb9 458 #define DR_3 3 // SF7 - BW125 |
mluis 0:91d1a7783bb9 459 #define DR_4 4 // SF8 - BW500 |
mluis 0:91d1a7783bb9 460 #define DR_5 5 // RFU
mluis 0:91d1a7783bb9 461 #define DR_6 6 // RFU
mluis 0:91d1a7783bb9 462 #define DR_7 7 // RFU
mluis 0:91d1a7783bb9 463 #define DR_8 8 // SF12 - BW500 |
mluis 0:91d1a7783bb9 464 #define DR_9 9 // SF11 - BW500 |
mluis 0:91d1a7783bb9 465 #define DR_10 10 // SF10 - BW500 |
mluis 0:91d1a7783bb9 466 #define DR_11 11 // SF9 - BW500 |
mluis 0:91d1a7783bb9 467 #define DR_12 12 // SF8 - BW500 +-> Down link
mluis 0:91d1a7783bb9 468 #define DR_13 13 // SF7 - BW500 |
mluis 0:91d1a7783bb9 469 #define DR_14 14 // RFU |
mluis 0:91d1a7783bb9 470 #define DR_15 15 // RFU |
mluis 0:91d1a7783bb9 471
mluis 0:91d1a7783bb9 472 /*!
mluis 0:91d1a7783bb9 473 * Second reception window channel definition.
mluis 0:91d1a7783bb9 474 */
mluis 0:91d1a7783bb9 475 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 476 #define RX_WND_2_CHANNEL { 923300000, DR_8 }
mluis 0:91d1a7783bb9 477
mluis 0:91d1a7783bb9 478 /*!
mluis 0:91d1a7783bb9 479 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 480 */
mluis 0:91d1a7783bb9 481 #define LORA_MAX_NB_BANDS 1
mluis 0:91d1a7783bb9 482
mluis 0:91d1a7783bb9 483 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 484 #define BAND0 { 1, TX_POWER_20_DBM, 0, 0 } // 100.0 %
mluis 0:91d1a7783bb9 485
mluis 0:91d1a7783bb9 486 /*!
mluis 0:91d1a7783bb9 487 * LoRaMac default channels
mluis 0:91d1a7783bb9 488 */
mluis 0:91d1a7783bb9 489 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 490 /*
mluis 0:91d1a7783bb9 491 * US band channels are initialized using a loop in LoRaMacInit function
mluis 0:91d1a7783bb9 492 * \code
mluis 0:91d1a7783bb9 493 * // 125 kHz channels
mluis 0:91d1a7783bb9 494 * for( uint8_t i = 0; i < LORA_MAX_NB_CHANNELS - 8; i++ )
mluis 0:91d1a7783bb9 495 * {
mluis 0:91d1a7783bb9 496 * Channels[i].Frequency = 902.3e6 + i * 200e3;
mluis 0:91d1a7783bb9 497 * Channels[i].DrRange.Value = ( DR_3 << 4 ) | DR_0;
mluis 0:91d1a7783bb9 498 * Channels[i].Band = 0;
mluis 0:91d1a7783bb9 499 * }
mluis 2:14a5d6ad92d5 500 * // 500 kHz channels
mluis 0:91d1a7783bb9 501 * for( uint8_t i = LORA_MAX_NB_CHANNELS - 8; i < LORA_MAX_NB_CHANNELS; i++ )
mluis 0:91d1a7783bb9 502 * {
mluis 0:91d1a7783bb9 503 * Channels[i].Frequency = 903.0e6 + ( i - ( LORA_MAX_NB_CHANNELS - 8 ) ) * 1.6e6;
mluis 0:91d1a7783bb9 504 * Channels[i].DrRange.Value = ( DR_4 << 4 ) | DR_4;
mluis 0:91d1a7783bb9 505 * Channels[i].Band = 0;
mluis 0:91d1a7783bb9 506 * }
mluis 0:91d1a7783bb9 507 * \endcode
mluis 0:91d1a7783bb9 508 */
mluis 0:91d1a7783bb9 509 #else
mluis 0:91d1a7783bb9 510 #error "Please define a frequency band in the compiler options."
mluis 0:91d1a7783bb9 511 #endif
mluis 0:91d1a7783bb9 512
mluis 0:91d1a7783bb9 513 #endif // __LORAMAC_BOARD_H__