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