Simplified LoRaWAN library.

Fork of LoRaWAN-lib-v1_0_1 by Uttam Bhat

Committer:
mluis
Date:
Tue Jan 05 16:41:54 2016 +0000
Revision:
2:14a5d6ad92d5
Parent:
1:91e4e6c60d1e
Child:
3:b9d87593a8ae
Synchronized with https://github.com/Lora-net/LoRaMac-node git revision a2226468d470eceb251338e1acfb24cfd121effa

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 0:91d1a7783bb9 36 #define LORAMAC_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 0:91d1a7783bb9 41 #define LORAMAC_MAX_DATARATE DR_7
mluis 0:91d1a7783bb9 42
mluis 0:91d1a7783bb9 43 /*!
mluis 0:91d1a7783bb9 44 * Default datarate used by the node
mluis 0:91d1a7783bb9 45 */
mluis 0:91d1a7783bb9 46 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 47
mluis 0:91d1a7783bb9 48 /*!
mluis 1:91e4e6c60d1e 49 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 50 */
mluis 1:91e4e6c60d1e 51 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 52
mluis 1:91e4e6c60d1e 53 /*!
mluis 1:91e4e6c60d1e 54 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 55 */
mluis 1:91e4e6c60d1e 56 #define LORAMAC_MAX_RX1_DR_OFFSET 5
mluis 1:91e4e6c60d1e 57
mluis 1:91e4e6c60d1e 58 /*!
mluis 0:91d1a7783bb9 59 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 60 */
mluis 0:91d1a7783bb9 61 #define LORAMAC_MIN_TX_POWER TX_POWER_M5_DBM
mluis 0:91d1a7783bb9 62
mluis 0:91d1a7783bb9 63 /*!
mluis 0:91d1a7783bb9 64 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 65 */
mluis 0:91d1a7783bb9 66 #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 67
mluis 0:91d1a7783bb9 68 /*!
mluis 0:91d1a7783bb9 69 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 70 */
mluis 0:91d1a7783bb9 71 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 72
mluis 0:91d1a7783bb9 73 /*!
mluis 0:91d1a7783bb9 74 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 75 */
mluis 0:91d1a7783bb9 76 #define TX_POWER_10_DBM 0
mluis 0:91d1a7783bb9 77 #define TX_POWER_07_DBM 1
mluis 0:91d1a7783bb9 78 #define TX_POWER_04_DBM 2
mluis 0:91d1a7783bb9 79 #define TX_POWER_01_DBM 3
mluis 0:91d1a7783bb9 80 #define TX_POWER_M2_DBM 4
mluis 0:91d1a7783bb9 81 #define TX_POWER_M5_DBM 5
mluis 0:91d1a7783bb9 82
mluis 0:91d1a7783bb9 83 /*!
mluis 0:91d1a7783bb9 84 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 85 */
mluis 0:91d1a7783bb9 86 #define DR_0 0 // SF12 - BW125
mluis 0:91d1a7783bb9 87 #define DR_1 1 // SF11 - BW125
mluis 0:91d1a7783bb9 88 #define DR_2 2 // SF10 - BW125
mluis 0:91d1a7783bb9 89 #define DR_3 3 // SF9 - BW125
mluis 0:91d1a7783bb9 90 #define DR_4 4 // SF8 - BW125
mluis 0:91d1a7783bb9 91 #define DR_5 5 // SF7 - BW125
mluis 0:91d1a7783bb9 92 #define DR_6 6 // SF7 - BW250
mluis 0:91d1a7783bb9 93 #define DR_7 7 // FSK
mluis 0:91d1a7783bb9 94
mluis 0:91d1a7783bb9 95 /*!
mluis 0:91d1a7783bb9 96 * Second reception window channel definition.
mluis 0:91d1a7783bb9 97 */
mluis 0:91d1a7783bb9 98 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 99 #define RX_WND_2_CHANNEL { 434665000, DR_0 }
mluis 0:91d1a7783bb9 100
mluis 0:91d1a7783bb9 101 /*!
mluis 0:91d1a7783bb9 102 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 103 */
mluis 0:91d1a7783bb9 104 #define LORA_MAX_NB_BANDS 1
mluis 0:91d1a7783bb9 105
mluis 0:91d1a7783bb9 106 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 107 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 108
mluis 0:91d1a7783bb9 109 /*!
mluis 0:91d1a7783bb9 110 * LoRaMac default channels
mluis 0:91d1a7783bb9 111 */
mluis 0:91d1a7783bb9 112 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 113 #define LC1 { 433175000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 114 #define LC2 { 433375000, { ( ( DR_7 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 115 #define LC3 { 433575000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 116
mluis 0:91d1a7783bb9 117 #elif defined( USE_BAND_780 )
mluis 0:91d1a7783bb9 118
mluis 0:91d1a7783bb9 119 /*!
mluis 0:91d1a7783bb9 120 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 121 */
mluis 0:91d1a7783bb9 122 #define LORA_MAX_NB_CHANNELS 16
mluis 0:91d1a7783bb9 123
mluis 0:91d1a7783bb9 124 /*!
mluis 0:91d1a7783bb9 125 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 126 */
mluis 0:91d1a7783bb9 127 #define LORAMAC_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 128
mluis 0:91d1a7783bb9 129 /*!
mluis 0:91d1a7783bb9 130 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 131 */
mluis 0:91d1a7783bb9 132 #define LORAMAC_MAX_DATARATE DR_7
mluis 0:91d1a7783bb9 133
mluis 0:91d1a7783bb9 134 /*!
mluis 0:91d1a7783bb9 135 * Default datarate used by the node
mluis 0:91d1a7783bb9 136 */
mluis 0:91d1a7783bb9 137 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 138
mluis 0:91d1a7783bb9 139 /*!
mluis 1:91e4e6c60d1e 140 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 141 */
mluis 1:91e4e6c60d1e 142 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 143
mluis 1:91e4e6c60d1e 144 /*!
mluis 1:91e4e6c60d1e 145 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 146 */
mluis 1:91e4e6c60d1e 147 #define LORAMAC_MAX_RX1_DR_OFFSET 5
mluis 1:91e4e6c60d1e 148
mluis 1:91e4e6c60d1e 149 /*!
mluis 0:91d1a7783bb9 150 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 151 */
mluis 0:91d1a7783bb9 152 #define LORAMAC_MIN_TX_POWER TX_POWER_M5_DBM
mluis 0:91d1a7783bb9 153
mluis 0:91d1a7783bb9 154 /*!
mluis 0:91d1a7783bb9 155 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 156 */
mluis 0:91d1a7783bb9 157 #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 158
mluis 0:91d1a7783bb9 159 /*!
mluis 0:91d1a7783bb9 160 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 161 */
mluis 0:91d1a7783bb9 162 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 163
mluis 0:91d1a7783bb9 164 /*!
mluis 0:91d1a7783bb9 165 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 166 */
mluis 0:91d1a7783bb9 167 #define TX_POWER_10_DBM 0
mluis 0:91d1a7783bb9 168 #define TX_POWER_07_DBM 1
mluis 0:91d1a7783bb9 169 #define TX_POWER_04_DBM 2
mluis 0:91d1a7783bb9 170 #define TX_POWER_01_DBM 3
mluis 0:91d1a7783bb9 171 #define TX_POWER_M2_DBM 4
mluis 0:91d1a7783bb9 172 #define TX_POWER_M5_DBM 5
mluis 0:91d1a7783bb9 173
mluis 0:91d1a7783bb9 174 /*!
mluis 0:91d1a7783bb9 175 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 176 */
mluis 0:91d1a7783bb9 177 #define DR_0 0 // SF12 - BW125
mluis 0:91d1a7783bb9 178 #define DR_1 1 // SF11 - BW125
mluis 0:91d1a7783bb9 179 #define DR_2 2 // SF10 - BW125
mluis 0:91d1a7783bb9 180 #define DR_3 3 // SF9 - BW125
mluis 0:91d1a7783bb9 181 #define DR_4 4 // SF8 - BW125
mluis 0:91d1a7783bb9 182 #define DR_5 5 // SF7 - BW125
mluis 0:91d1a7783bb9 183 #define DR_6 6 // SF7 - BW250
mluis 0:91d1a7783bb9 184 #define DR_7 7 // FSK
mluis 0:91d1a7783bb9 185
mluis 0:91d1a7783bb9 186 /*!
mluis 0:91d1a7783bb9 187 * Second reception window channel definition.
mluis 0:91d1a7783bb9 188 */
mluis 0:91d1a7783bb9 189 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 190 #define RX_WND_2_CHANNEL { 786000000, DR_0 }
mluis 0:91d1a7783bb9 191
mluis 0:91d1a7783bb9 192 /*!
mluis 0:91d1a7783bb9 193 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 194 */
mluis 0:91d1a7783bb9 195 #define LORA_MAX_NB_BANDS 1
mluis 0:91d1a7783bb9 196
mluis 0:91d1a7783bb9 197 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 198 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 199
mluis 0:91d1a7783bb9 200 /*!
mluis 0:91d1a7783bb9 201 * LoRaMac default channels
mluis 0:91d1a7783bb9 202 */
mluis 0:91d1a7783bb9 203 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 204 #define LC1 { 779500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 205 #define LC2 { 779700000, { ( ( DR_7 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 206 #define LC3 { 779900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 207
mluis 0:91d1a7783bb9 208 #elif defined( USE_BAND_868 )
mluis 0:91d1a7783bb9 209
mluis 0:91d1a7783bb9 210 /*!
mluis 0:91d1a7783bb9 211 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 212 */
mluis 0:91d1a7783bb9 213 #define LORA_MAX_NB_CHANNELS 16
mluis 0:91d1a7783bb9 214
mluis 0:91d1a7783bb9 215 /*!
mluis 0:91d1a7783bb9 216 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 217 */
mluis 0:91d1a7783bb9 218 #define LORAMAC_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 219
mluis 0:91d1a7783bb9 220 /*!
mluis 0:91d1a7783bb9 221 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 222 */
mluis 0:91d1a7783bb9 223 #define LORAMAC_MAX_DATARATE DR_7
mluis 0:91d1a7783bb9 224
mluis 0:91d1a7783bb9 225 /*!
mluis 0:91d1a7783bb9 226 * Default datarate used by the node
mluis 0:91d1a7783bb9 227 */
mluis 0:91d1a7783bb9 228 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 229
mluis 0:91d1a7783bb9 230 /*!
mluis 1:91e4e6c60d1e 231 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 232 */
mluis 1:91e4e6c60d1e 233 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 234
mluis 1:91e4e6c60d1e 235 /*!
mluis 1:91e4e6c60d1e 236 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 237 */
mluis 1:91e4e6c60d1e 238 #define LORAMAC_MAX_RX1_DR_OFFSET 5
mluis 1:91e4e6c60d1e 239
mluis 1:91e4e6c60d1e 240 /*!
mluis 0:91d1a7783bb9 241 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 242 */
mluis 0:91d1a7783bb9 243 #define LORAMAC_MIN_TX_POWER TX_POWER_02_DBM
mluis 0:91d1a7783bb9 244
mluis 0:91d1a7783bb9 245 /*!
mluis 0:91d1a7783bb9 246 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 247 */
mluis 0:91d1a7783bb9 248 #define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM
mluis 0:91d1a7783bb9 249
mluis 0:91d1a7783bb9 250 /*!
mluis 0:91d1a7783bb9 251 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 252 */
mluis 0:91d1a7783bb9 253 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM
mluis 0:91d1a7783bb9 254
mluis 0:91d1a7783bb9 255 /*!
mluis 0:91d1a7783bb9 256 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 257 */
mluis 0:91d1a7783bb9 258 #define TX_POWER_20_DBM 0
mluis 0:91d1a7783bb9 259 #define TX_POWER_14_DBM 1
mluis 0:91d1a7783bb9 260 #define TX_POWER_11_DBM 2
mluis 0:91d1a7783bb9 261 #define TX_POWER_08_DBM 3
mluis 0:91d1a7783bb9 262 #define TX_POWER_05_DBM 4
mluis 0:91d1a7783bb9 263 #define TX_POWER_02_DBM 5
mluis 0:91d1a7783bb9 264
mluis 0:91d1a7783bb9 265 /*!
mluis 0:91d1a7783bb9 266 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 267 */
mluis 0:91d1a7783bb9 268 #define DR_0 0 // SF12 - BW125
mluis 0:91d1a7783bb9 269 #define DR_1 1 // SF11 - BW125
mluis 0:91d1a7783bb9 270 #define DR_2 2 // SF10 - BW125
mluis 0:91d1a7783bb9 271 #define DR_3 3 // SF9 - BW125
mluis 0:91d1a7783bb9 272 #define DR_4 4 // SF8 - BW125
mluis 0:91d1a7783bb9 273 #define DR_5 5 // SF7 - BW125
mluis 0:91d1a7783bb9 274 #define DR_6 6 // SF7 - BW250
mluis 0:91d1a7783bb9 275 #define DR_7 7 // FSK
mluis 0:91d1a7783bb9 276
mluis 0:91d1a7783bb9 277 /*!
mluis 0:91d1a7783bb9 278 * Second reception window channel definition.
mluis 0:91d1a7783bb9 279 */
mluis 0:91d1a7783bb9 280 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 281 #define RX_WND_2_CHANNEL { 869525000, DR_0 }
mluis 0:91d1a7783bb9 282
mluis 0:91d1a7783bb9 283 /*!
mluis 0:91d1a7783bb9 284 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 285 */
mluis 0:91d1a7783bb9 286 #define LORA_MAX_NB_BANDS 5
mluis 0:91d1a7783bb9 287
mluis 0:91d1a7783bb9 288 /*!
mluis 0:91d1a7783bb9 289 * LoRaMac EU868 default bands
mluis 0:91d1a7783bb9 290 */
mluis 0:91d1a7783bb9 291 typedef enum
mluis 0:91d1a7783bb9 292 {
mluis 0:91d1a7783bb9 293 BAND_G1_0,
mluis 0:91d1a7783bb9 294 BAND_G1_1,
mluis 0:91d1a7783bb9 295 BAND_G1_2,
mluis 0:91d1a7783bb9 296 BAND_G1_3,
mluis 0:91d1a7783bb9 297 BAND_G1_4,
mluis 0:91d1a7783bb9 298 }BandId_t;
mluis 0:91d1a7783bb9 299
mluis 0:91d1a7783bb9 300 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 301 #define BAND0 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 302 #define BAND1 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 303 #define BAND2 { 1000, TX_POWER_14_DBM, 0, 0 } // 0.1 %
mluis 0:91d1a7783bb9 304 #define BAND3 { 10 , TX_POWER_14_DBM, 0, 0 } // 10.0 %
mluis 0:91d1a7783bb9 305 #define BAND4 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 %
mluis 0:91d1a7783bb9 306
mluis 0:91d1a7783bb9 307 /*!
mluis 0:91d1a7783bb9 308 * LoRaMac default channels
mluis 0:91d1a7783bb9 309 */
mluis 0:91d1a7783bb9 310 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 311 #define LC1 { 868100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
mluis 0:91d1a7783bb9 312 #define LC2 { 868300000, { ( ( DR_6 << 4 ) | DR_0 ) }, 1 }
mluis 0:91d1a7783bb9 313 #define LC3 { 868500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 }
mluis 0:91d1a7783bb9 314 #define LC4 { 867100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 315 #define LC5 { 867300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 316 #define LC6 { 867500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 317 #define LC7 { 867700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 318 #define LC8 { 867900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
mluis 0:91d1a7783bb9 319 #define LC9 { 868800000, { ( ( DR_7 << 4 ) | DR_7 ) }, 2 }
mluis 0:91d1a7783bb9 320
mluis 0:91d1a7783bb9 321 #elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID )
mluis 0:91d1a7783bb9 322
mluis 0:91d1a7783bb9 323 /*!
mluis 0:91d1a7783bb9 324 * LoRaMac maximum number of channels
mluis 0:91d1a7783bb9 325 */
mluis 0:91d1a7783bb9 326 #define LORA_MAX_NB_CHANNELS 72
mluis 0:91d1a7783bb9 327
mluis 0:91d1a7783bb9 328 /*!
mluis 0:91d1a7783bb9 329 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 330 */
mluis 0:91d1a7783bb9 331 #define LORAMAC_MIN_DATARATE DR_0
mluis 0:91d1a7783bb9 332
mluis 0:91d1a7783bb9 333 /*!
mluis 0:91d1a7783bb9 334 * Minimal datarate that can be used by the node
mluis 0:91d1a7783bb9 335 */
mluis 0:91d1a7783bb9 336 #define LORAMAC_MAX_DATARATE DR_4
mluis 0:91d1a7783bb9 337
mluis 0:91d1a7783bb9 338 /*!
mluis 0:91d1a7783bb9 339 * Default datarate used by the node
mluis 0:91d1a7783bb9 340 */
mluis 0:91d1a7783bb9 341 #define LORAMAC_DEFAULT_DATARATE DR_0
mluis 0:91d1a7783bb9 342
mluis 0:91d1a7783bb9 343 /*!
mluis 1:91e4e6c60d1e 344 * Minimal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 345 */
mluis 1:91e4e6c60d1e 346 #define LORAMAC_MIN_RX1_DR_OFFSET 0
mluis 1:91e4e6c60d1e 347
mluis 1:91e4e6c60d1e 348 /*!
mluis 1:91e4e6c60d1e 349 * Maximal Rx1 receive datarate offset
mluis 1:91e4e6c60d1e 350 */
mluis 1:91e4e6c60d1e 351 #define LORAMAC_MAX_RX1_DR_OFFSET 3
mluis 1:91e4e6c60d1e 352
mluis 1:91e4e6c60d1e 353 /*!
mluis 0:91d1a7783bb9 354 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 355 */
mluis 0:91d1a7783bb9 356 #define LORAMAC_MIN_TX_POWER TX_POWER_10_DBM
mluis 0:91d1a7783bb9 357
mluis 0:91d1a7783bb9 358 /*!
mluis 0:91d1a7783bb9 359 * Minimal Tx output power that can be used by the node
mluis 0:91d1a7783bb9 360 */
mluis 0:91d1a7783bb9 361 #define LORAMAC_MAX_TX_POWER TX_POWER_30_DBM
mluis 0:91d1a7783bb9 362
mluis 0:91d1a7783bb9 363 /*!
mluis 0:91d1a7783bb9 364 * Default Tx output power used by the node
mluis 0:91d1a7783bb9 365 */
mluis 0:91d1a7783bb9 366 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_20_DBM
mluis 0:91d1a7783bb9 367
mluis 0:91d1a7783bb9 368 /*!
mluis 0:91d1a7783bb9 369 * LoRaMac TxPower definition
mluis 0:91d1a7783bb9 370 */
mluis 0:91d1a7783bb9 371 #define TX_POWER_30_DBM 0
mluis 0:91d1a7783bb9 372 #define TX_POWER_28_DBM 1
mluis 0:91d1a7783bb9 373 #define TX_POWER_26_DBM 2
mluis 0:91d1a7783bb9 374 #define TX_POWER_24_DBM 3
mluis 0:91d1a7783bb9 375 #define TX_POWER_22_DBM 4
mluis 0:91d1a7783bb9 376 #define TX_POWER_20_DBM 5
mluis 0:91d1a7783bb9 377 #define TX_POWER_18_DBM 6
mluis 0:91d1a7783bb9 378 #define TX_POWER_16_DBM 7
mluis 0:91d1a7783bb9 379 #define TX_POWER_14_DBM 8
mluis 0:91d1a7783bb9 380 #define TX_POWER_12_DBM 9
mluis 0:91d1a7783bb9 381 #define TX_POWER_10_DBM 10
mluis 0:91d1a7783bb9 382
mluis 0:91d1a7783bb9 383 /*!
mluis 0:91d1a7783bb9 384 * LoRaMac datarates definition
mluis 0:91d1a7783bb9 385 */
mluis 0:91d1a7783bb9 386 #define DR_0 0 // SF10 - BW125 |
mluis 0:91d1a7783bb9 387 #define DR_1 1 // SF9 - BW125 |
mluis 0:91d1a7783bb9 388 #define DR_2 2 // SF8 - BW125 +-> Up link
mluis 0:91d1a7783bb9 389 #define DR_3 3 // SF7 - BW125 |
mluis 0:91d1a7783bb9 390 #define DR_4 4 // SF8 - BW500 |
mluis 0:91d1a7783bb9 391 #define DR_5 5 // RFU
mluis 0:91d1a7783bb9 392 #define DR_6 6 // RFU
mluis 0:91d1a7783bb9 393 #define DR_7 7 // RFU
mluis 0:91d1a7783bb9 394 #define DR_8 8 // SF12 - BW500 |
mluis 0:91d1a7783bb9 395 #define DR_9 9 // SF11 - BW500 |
mluis 0:91d1a7783bb9 396 #define DR_10 10 // SF10 - BW500 |
mluis 0:91d1a7783bb9 397 #define DR_11 11 // SF9 - BW500 |
mluis 0:91d1a7783bb9 398 #define DR_12 12 // SF8 - BW500 +-> Down link
mluis 0:91d1a7783bb9 399 #define DR_13 13 // SF7 - BW500 |
mluis 0:91d1a7783bb9 400 #define DR_14 14 // RFU |
mluis 0:91d1a7783bb9 401 #define DR_15 15 // RFU |
mluis 0:91d1a7783bb9 402
mluis 0:91d1a7783bb9 403 /*!
mluis 0:91d1a7783bb9 404 * Second reception window channel definition.
mluis 0:91d1a7783bb9 405 */
mluis 0:91d1a7783bb9 406 // Channel = { Frequency [Hz], Datarate }
mluis 0:91d1a7783bb9 407 #define RX_WND_2_CHANNEL { 923300000, DR_8 }
mluis 0:91d1a7783bb9 408
mluis 0:91d1a7783bb9 409 /*!
mluis 0:91d1a7783bb9 410 * LoRaMac maximum number of bands
mluis 0:91d1a7783bb9 411 */
mluis 0:91d1a7783bb9 412 #define LORA_MAX_NB_BANDS 1
mluis 0:91d1a7783bb9 413
mluis 0:91d1a7783bb9 414 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
mluis 0:91d1a7783bb9 415 #define BAND0 { 1, TX_POWER_20_DBM, 0, 0 } // 100.0 %
mluis 0:91d1a7783bb9 416
mluis 0:91d1a7783bb9 417 /*!
mluis 0:91d1a7783bb9 418 * LoRaMac default channels
mluis 0:91d1a7783bb9 419 */
mluis 0:91d1a7783bb9 420 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
mluis 0:91d1a7783bb9 421 /*
mluis 0:91d1a7783bb9 422 * US band channels are initialized using a loop in LoRaMacInit function
mluis 0:91d1a7783bb9 423 * \code
mluis 0:91d1a7783bb9 424 * // 125 kHz channels
mluis 0:91d1a7783bb9 425 * for( uint8_t i = 0; i < LORA_MAX_NB_CHANNELS - 8; i++ )
mluis 0:91d1a7783bb9 426 * {
mluis 0:91d1a7783bb9 427 * Channels[i].Frequency = 902.3e6 + i * 200e3;
mluis 0:91d1a7783bb9 428 * Channels[i].DrRange.Value = ( DR_3 << 4 ) | DR_0;
mluis 0:91d1a7783bb9 429 * Channels[i].Band = 0;
mluis 0:91d1a7783bb9 430 * }
mluis 2:14a5d6ad92d5 431 * // 500 kHz channels
mluis 0:91d1a7783bb9 432 * for( uint8_t i = LORA_MAX_NB_CHANNELS - 8; i < LORA_MAX_NB_CHANNELS; i++ )
mluis 0:91d1a7783bb9 433 * {
mluis 0:91d1a7783bb9 434 * Channels[i].Frequency = 903.0e6 + ( i - ( LORA_MAX_NB_CHANNELS - 8 ) ) * 1.6e6;
mluis 0:91d1a7783bb9 435 * Channels[i].DrRange.Value = ( DR_4 << 4 ) | DR_4;
mluis 0:91d1a7783bb9 436 * Channels[i].Band = 0;
mluis 0:91d1a7783bb9 437 * }
mluis 0:91d1a7783bb9 438 * \endcode
mluis 0:91d1a7783bb9 439 */
mluis 0:91d1a7783bb9 440 #else
mluis 0:91d1a7783bb9 441 #error "Please define a frequency band in the compiler options."
mluis 0:91d1a7783bb9 442 #endif
mluis 0:91d1a7783bb9 443
mluis 0:91d1a7783bb9 444 #endif // __LORAMAC_BOARD_H__