Fork of Semtech LoRaWAN stack

Fork of LoRaWAN-lib by canuck lehead

Committer:
Shaun Nelson
Date:
Mon Oct 15 09:15:20 2018 -0400
Branch:
SenetNetTool
Revision:
49:8b9e6442a02a
Parent:
31:930f949fdd9e
Removed static type for up/down counters for access from external code

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