Forked LoRaWAN-lib for Legacy Gateway testing

Fork of LoRaWAN-lib by Miguel Luis

Committer:
mluis
Date:
Tue Oct 20 13:21:26 2015 +0000
Revision:
0:91d1a7783bb9
Child:
1:91e4e6c60d1e
Library creation synchronized with GitHub LoRaMac-node v3.4 (https://github.com/Lora-net/LoRaMac-node)

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