调试版本,多个调试标识,接收时有bug

Fork of LoRaWAN-lib by Semtech

Committer:
mluis
Date:
Tue Jul 05 13:24:54 2016 +0000
Revision:
7:c16969e0f70f
Parent:
LoRaMac-board.h@4:37c12dbc8dc7
Child:
8:246353e3cbc5
Synchronized with https://github.com/Lora-net/LoRaMac-node git revision 7a4aec588de628d864c364e9469ae45105fdbe26

Who changed what in which revision?

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