Senet / LoRaWAN-lib

Fork of LoRaWAN-lib by canuck lehead

Committer:
Shaun Nelson
Date:
Wed Aug 09 16:20:21 2017 -0400
Branch:
class_b
Revision:
38:182ba91524e4
Synchronized with  https://github.com/Senetco/LoRaMac-node/commit/6cb21de99eaa65caad9d911318df8875867a6e60

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Shaun Nelson 38:182ba91524e4 1 /*!
Shaun Nelson 38:182ba91524e4 2 * \file RegionKR920.h
Shaun Nelson 38:182ba91524e4 3 *
Shaun Nelson 38:182ba91524e4 4 * \brief Region definition for KR920
Shaun Nelson 38:182ba91524e4 5 *
Shaun Nelson 38:182ba91524e4 6 * \copyright Revised BSD License, see section \ref LICENSE.
Shaun Nelson 38:182ba91524e4 7 *
Shaun Nelson 38:182ba91524e4 8 * \code
Shaun Nelson 38:182ba91524e4 9 * ______ _
Shaun Nelson 38:182ba91524e4 10 * / _____) _ | |
Shaun Nelson 38:182ba91524e4 11 * ( (____ _____ ____ _| |_ _____ ____| |__
Shaun Nelson 38:182ba91524e4 12 * \____ \| ___ | (_ _) ___ |/ ___) _ \
Shaun Nelson 38:182ba91524e4 13 * _____) ) ____| | | || |_| ____( (___| | | |
Shaun Nelson 38:182ba91524e4 14 * (______/|_____)_|_|_| \__)_____)\____)_| |_|
Shaun Nelson 38:182ba91524e4 15 * (C)2013 Semtech
Shaun Nelson 38:182ba91524e4 16 *
Shaun Nelson 38:182ba91524e4 17 * ___ _____ _ ___ _ _____ ___ ___ ___ ___
Shaun Nelson 38:182ba91524e4 18 * / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
Shaun Nelson 38:182ba91524e4 19 * \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
Shaun Nelson 38:182ba91524e4 20 * |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
Shaun Nelson 38:182ba91524e4 21 * embedded.connectivity.solutions===============
Shaun Nelson 38:182ba91524e4 22 *
Shaun Nelson 38:182ba91524e4 23 * \endcode
Shaun Nelson 38:182ba91524e4 24 *
Shaun Nelson 38:182ba91524e4 25 * \author Miguel Luis ( Semtech )
Shaun Nelson 38:182ba91524e4 26 *
Shaun Nelson 38:182ba91524e4 27 * \author Gregory Cristian ( Semtech )
Shaun Nelson 38:182ba91524e4 28 *
Shaun Nelson 38:182ba91524e4 29 * \author Daniel Jaeckle ( STACKFORCE )
Shaun Nelson 38:182ba91524e4 30 *
Shaun Nelson 38:182ba91524e4 31 * \defgroup REGIONKR920 Region KR920
Shaun Nelson 38:182ba91524e4 32 * Implementation according to LoRaWAN Specification v1.0.2.
Shaun Nelson 38:182ba91524e4 33 * \{
Shaun Nelson 38:182ba91524e4 34 */
Shaun Nelson 38:182ba91524e4 35 #ifndef __REGION_KR920_H__
Shaun Nelson 38:182ba91524e4 36 #define __REGION_KR920_H__
Shaun Nelson 38:182ba91524e4 37
Shaun Nelson 38:182ba91524e4 38 /*!
Shaun Nelson 38:182ba91524e4 39 * LoRaMac maximum number of channels
Shaun Nelson 38:182ba91524e4 40 */
Shaun Nelson 38:182ba91524e4 41 #define KR920_MAX_NB_CHANNELS 16
Shaun Nelson 38:182ba91524e4 42
Shaun Nelson 38:182ba91524e4 43 /*!
Shaun Nelson 38:182ba91524e4 44 * Number of default channels
Shaun Nelson 38:182ba91524e4 45 */
Shaun Nelson 38:182ba91524e4 46 #define KR920_NUMB_DEFAULT_CHANNELS 3
Shaun Nelson 38:182ba91524e4 47
Shaun Nelson 38:182ba91524e4 48 /*!
Shaun Nelson 38:182ba91524e4 49 * Number of channels to apply for the CF list
Shaun Nelson 38:182ba91524e4 50 */
Shaun Nelson 38:182ba91524e4 51 #define KR920_NUMB_CHANNELS_CF_LIST 5
Shaun Nelson 38:182ba91524e4 52
Shaun Nelson 38:182ba91524e4 53 /*!
Shaun Nelson 38:182ba91524e4 54 * Minimal datarate that can be used by the node
Shaun Nelson 38:182ba91524e4 55 */
Shaun Nelson 38:182ba91524e4 56 #define KR920_TX_MIN_DATARATE DR_0
Shaun Nelson 38:182ba91524e4 57
Shaun Nelson 38:182ba91524e4 58 /*!
Shaun Nelson 38:182ba91524e4 59 * Maximal datarate that can be used by the node
Shaun Nelson 38:182ba91524e4 60 */
Shaun Nelson 38:182ba91524e4 61 #define KR920_TX_MAX_DATARATE DR_5
Shaun Nelson 38:182ba91524e4 62
Shaun Nelson 38:182ba91524e4 63 /*!
Shaun Nelson 38:182ba91524e4 64 * Minimal datarate that can be used by the node
Shaun Nelson 38:182ba91524e4 65 */
Shaun Nelson 38:182ba91524e4 66 #define KR920_RX_MIN_DATARATE DR_0
Shaun Nelson 38:182ba91524e4 67
Shaun Nelson 38:182ba91524e4 68 /*!
Shaun Nelson 38:182ba91524e4 69 * Maximal datarate that can be used by the node
Shaun Nelson 38:182ba91524e4 70 */
Shaun Nelson 38:182ba91524e4 71 #define KR920_RX_MAX_DATARATE DR_5
Shaun Nelson 38:182ba91524e4 72
Shaun Nelson 38:182ba91524e4 73 /*!
Shaun Nelson 38:182ba91524e4 74 * Default datarate used by the node
Shaun Nelson 38:182ba91524e4 75 */
Shaun Nelson 38:182ba91524e4 76 #define KR920_DEFAULT_DATARATE DR_0
Shaun Nelson 38:182ba91524e4 77
Shaun Nelson 38:182ba91524e4 78 /*!
Shaun Nelson 38:182ba91524e4 79 * Minimal Rx1 receive datarate offset
Shaun Nelson 38:182ba91524e4 80 */
Shaun Nelson 38:182ba91524e4 81 #define KR920_MIN_RX1_DR_OFFSET 0
Shaun Nelson 38:182ba91524e4 82
Shaun Nelson 38:182ba91524e4 83 /*!
Shaun Nelson 38:182ba91524e4 84 * Maximal Rx1 receive datarate offset
Shaun Nelson 38:182ba91524e4 85 */
Shaun Nelson 38:182ba91524e4 86 #define KR920_MAX_RX1_DR_OFFSET 5
Shaun Nelson 38:182ba91524e4 87
Shaun Nelson 38:182ba91524e4 88 /*!
Shaun Nelson 38:182ba91524e4 89 * Default Rx1 receive datarate offset
Shaun Nelson 38:182ba91524e4 90 */
Shaun Nelson 38:182ba91524e4 91 #define KR920_DEFAULT_RX1_DR_OFFSET 0
Shaun Nelson 38:182ba91524e4 92
Shaun Nelson 38:182ba91524e4 93 /*!
Shaun Nelson 38:182ba91524e4 94 * Minimal Tx output power that can be used by the node
Shaun Nelson 38:182ba91524e4 95 */
Shaun Nelson 38:182ba91524e4 96 #define KR920_MIN_TX_POWER TX_POWER_7
Shaun Nelson 38:182ba91524e4 97
Shaun Nelson 38:182ba91524e4 98 /*!
Shaun Nelson 38:182ba91524e4 99 * Maximal Tx output power that can be used by the node
Shaun Nelson 38:182ba91524e4 100 */
Shaun Nelson 38:182ba91524e4 101 #define KR920_MAX_TX_POWER TX_POWER_0
Shaun Nelson 38:182ba91524e4 102
Shaun Nelson 38:182ba91524e4 103 /*!
Shaun Nelson 38:182ba91524e4 104 * Default Tx output power used by the node
Shaun Nelson 38:182ba91524e4 105 */
Shaun Nelson 38:182ba91524e4 106 #define KR920_DEFAULT_TX_POWER TX_POWER_0
Shaun Nelson 38:182ba91524e4 107
Shaun Nelson 38:182ba91524e4 108 /*!
Shaun Nelson 38:182ba91524e4 109 * Default Max EIRP for frequency 920.9 MHz - 921.9 MHz
Shaun Nelson 38:182ba91524e4 110 */
Shaun Nelson 38:182ba91524e4 111 #define KR920_DEFAULT_MAX_EIRP_LOW 10.0f
Shaun Nelson 38:182ba91524e4 112
Shaun Nelson 38:182ba91524e4 113 /*!
Shaun Nelson 38:182ba91524e4 114 * Default Max EIRP for frequency 922.1 MHz - 923.3 MHz
Shaun Nelson 38:182ba91524e4 115 */
Shaun Nelson 38:182ba91524e4 116 #define KR920_DEFAULT_MAX_EIRP_HIGH 14.0f
Shaun Nelson 38:182ba91524e4 117
Shaun Nelson 38:182ba91524e4 118 /*!
Shaun Nelson 38:182ba91524e4 119 * Default antenna gain
Shaun Nelson 38:182ba91524e4 120 */
Shaun Nelson 38:182ba91524e4 121 #define KR920_DEFAULT_ANTENNA_GAIN 2.15f
Shaun Nelson 38:182ba91524e4 122
Shaun Nelson 38:182ba91524e4 123 /*!
Shaun Nelson 38:182ba91524e4 124 * ADR Ack limit
Shaun Nelson 38:182ba91524e4 125 */
Shaun Nelson 38:182ba91524e4 126 #define KR920_ADR_ACK_LIMIT 64
Shaun Nelson 38:182ba91524e4 127
Shaun Nelson 38:182ba91524e4 128 /*!
Shaun Nelson 38:182ba91524e4 129 * ADR Ack delay
Shaun Nelson 38:182ba91524e4 130 */
Shaun Nelson 38:182ba91524e4 131 #define KR920_ADR_ACK_DELAY 32
Shaun Nelson 38:182ba91524e4 132
Shaun Nelson 38:182ba91524e4 133 /*!
Shaun Nelson 38:182ba91524e4 134 * Enabled or disabled the duty cycle
Shaun Nelson 38:182ba91524e4 135 */
Shaun Nelson 38:182ba91524e4 136 #define KR920_DUTY_CYCLE_ENABLED 0
Shaun Nelson 38:182ba91524e4 137
Shaun Nelson 38:182ba91524e4 138 /*!
Shaun Nelson 38:182ba91524e4 139 * Maximum RX window duration
Shaun Nelson 38:182ba91524e4 140 */
Shaun Nelson 38:182ba91524e4 141 #define KR920_MAX_RX_WINDOW 4000
Shaun Nelson 38:182ba91524e4 142
Shaun Nelson 38:182ba91524e4 143 /*!
Shaun Nelson 38:182ba91524e4 144 * Receive delay 1
Shaun Nelson 38:182ba91524e4 145 */
Shaun Nelson 38:182ba91524e4 146 #define KR920_RECEIVE_DELAY1 1000
Shaun Nelson 38:182ba91524e4 147
Shaun Nelson 38:182ba91524e4 148 /*!
Shaun Nelson 38:182ba91524e4 149 * Receive delay 2
Shaun Nelson 38:182ba91524e4 150 */
Shaun Nelson 38:182ba91524e4 151 #define KR920_RECEIVE_DELAY2 2000
Shaun Nelson 38:182ba91524e4 152
Shaun Nelson 38:182ba91524e4 153 /*!
Shaun Nelson 38:182ba91524e4 154 * Join accept delay 1
Shaun Nelson 38:182ba91524e4 155 */
Shaun Nelson 38:182ba91524e4 156 #define KR920_JOIN_ACCEPT_DELAY1 5000
Shaun Nelson 38:182ba91524e4 157
Shaun Nelson 38:182ba91524e4 158 /*!
Shaun Nelson 38:182ba91524e4 159 * Join accept delay 2
Shaun Nelson 38:182ba91524e4 160 */
Shaun Nelson 38:182ba91524e4 161 #define KR920_JOIN_ACCEPT_DELAY2 6000
Shaun Nelson 38:182ba91524e4 162
Shaun Nelson 38:182ba91524e4 163 /*!
Shaun Nelson 38:182ba91524e4 164 * Maximum frame counter gap
Shaun Nelson 38:182ba91524e4 165 */
Shaun Nelson 38:182ba91524e4 166 #define KR920_MAX_FCNT_GAP 16384
Shaun Nelson 38:182ba91524e4 167
Shaun Nelson 38:182ba91524e4 168 /*!
Shaun Nelson 38:182ba91524e4 169 * Ack timeout
Shaun Nelson 38:182ba91524e4 170 */
Shaun Nelson 38:182ba91524e4 171 #define KR920_ACKTIMEOUT 2000
Shaun Nelson 38:182ba91524e4 172
Shaun Nelson 38:182ba91524e4 173 /*!
Shaun Nelson 38:182ba91524e4 174 * Random ack timeout limits
Shaun Nelson 38:182ba91524e4 175 */
Shaun Nelson 38:182ba91524e4 176 #define KR920_ACK_TIMEOUT_RND 1000
Shaun Nelson 38:182ba91524e4 177
Shaun Nelson 38:182ba91524e4 178 #if ( KR920_DEFAULT_DATARATE > DR_5 )
Shaun Nelson 38:182ba91524e4 179 #error "A default DR higher than DR_5 may lead to connectivity loss."
Shaun Nelson 38:182ba91524e4 180 #endif
Shaun Nelson 38:182ba91524e4 181
Shaun Nelson 38:182ba91524e4 182 /*!
Shaun Nelson 38:182ba91524e4 183 * Second reception window channel frequency definition.
Shaun Nelson 38:182ba91524e4 184 */
Shaun Nelson 38:182ba91524e4 185 #define KR920_RX_WND_2_FREQ 921900000
Shaun Nelson 38:182ba91524e4 186
Shaun Nelson 38:182ba91524e4 187 /*!
Shaun Nelson 38:182ba91524e4 188 * Second reception window channel datarate definition.
Shaun Nelson 38:182ba91524e4 189 */
Shaun Nelson 38:182ba91524e4 190 #define KR920_RX_WND_2_DR DR_0
Shaun Nelson 38:182ba91524e4 191
Shaun Nelson 38:182ba91524e4 192 /*
Shaun Nelson 38:182ba91524e4 193 * CLASS B
Shaun Nelson 38:182ba91524e4 194 */
Shaun Nelson 38:182ba91524e4 195 /*!
Shaun Nelson 38:182ba91524e4 196 * Beacon interval in ms
Shaun Nelson 38:182ba91524e4 197 */
Shaun Nelson 38:182ba91524e4 198 #define KR920_BEACON_INTERVAL 128000
Shaun Nelson 38:182ba91524e4 199
Shaun Nelson 38:182ba91524e4 200 /*!
Shaun Nelson 38:182ba91524e4 201 * Beacon reserved time in ms
Shaun Nelson 38:182ba91524e4 202 */
Shaun Nelson 38:182ba91524e4 203 #define KR920_BEACON_RESERVED 2120
Shaun Nelson 38:182ba91524e4 204
Shaun Nelson 38:182ba91524e4 205 /*!
Shaun Nelson 38:182ba91524e4 206 * Beacon guard time in ms
Shaun Nelson 38:182ba91524e4 207 */
Shaun Nelson 38:182ba91524e4 208 #define KR920_BEACON_GUARD 3000
Shaun Nelson 38:182ba91524e4 209
Shaun Nelson 38:182ba91524e4 210 /*!
Shaun Nelson 38:182ba91524e4 211 * Beacon window time in ms
Shaun Nelson 38:182ba91524e4 212 */
Shaun Nelson 38:182ba91524e4 213 #define KR920_BEACON_WINDOW 122880
Shaun Nelson 38:182ba91524e4 214
Shaun Nelson 38:182ba91524e4 215 /*!
Shaun Nelson 38:182ba91524e4 216 * Beacon window time in numer of slots
Shaun Nelson 38:182ba91524e4 217 */
Shaun Nelson 38:182ba91524e4 218 #define KR920_BEACON_WINDOW_SLOTS 4096
Shaun Nelson 38:182ba91524e4 219
Shaun Nelson 38:182ba91524e4 220 /*!
Shaun Nelson 38:182ba91524e4 221 * Ping slot length time in ms
Shaun Nelson 38:182ba91524e4 222 */
Shaun Nelson 38:182ba91524e4 223 #define KR920_PING_SLOT_WINDOW 30
Shaun Nelson 38:182ba91524e4 224
Shaun Nelson 38:182ba91524e4 225 /*!
Shaun Nelson 38:182ba91524e4 226 * Default symbol timeout for beacons and ping slot windows
Shaun Nelson 38:182ba91524e4 227 */
Shaun Nelson 38:182ba91524e4 228 #define KR920_BEACON_SYMBOL_TO_DEFAULT 8
Shaun Nelson 38:182ba91524e4 229
Shaun Nelson 38:182ba91524e4 230 /*!
Shaun Nelson 38:182ba91524e4 231 * Maximum symbol timeout for beacons
Shaun Nelson 38:182ba91524e4 232 */
Shaun Nelson 38:182ba91524e4 233 #define KR920_BEACON_SYMBOL_TO_EXPANSION_MAX 400
Shaun Nelson 38:182ba91524e4 234
Shaun Nelson 38:182ba91524e4 235 /*!
Shaun Nelson 38:182ba91524e4 236 * Maximum symbol timeout for ping slots
Shaun Nelson 38:182ba91524e4 237 */
Shaun Nelson 38:182ba91524e4 238 #define KR920_PING_SLOT_SYMBOL_TO_EXPANSION_MAX 40
Shaun Nelson 38:182ba91524e4 239
Shaun Nelson 38:182ba91524e4 240 /*!
Shaun Nelson 38:182ba91524e4 241 * Symbol expansion value for beacon windows in case of beacon
Shaun Nelson 38:182ba91524e4 242 * loss in symbols
Shaun Nelson 38:182ba91524e4 243 */
Shaun Nelson 38:182ba91524e4 244 #define KR920_BEACON_SYMBOL_TO_EXPANSION_FACTOR 2
Shaun Nelson 38:182ba91524e4 245
Shaun Nelson 38:182ba91524e4 246 /*!
Shaun Nelson 38:182ba91524e4 247 * Symbol expansion value for ping slot windows in case of beacon
Shaun Nelson 38:182ba91524e4 248 * loss in symbols
Shaun Nelson 38:182ba91524e4 249 */
Shaun Nelson 38:182ba91524e4 250 #define KR920_PING_SLOT_SYMBOL_TO_EXPANSION_FACTOR 2
Shaun Nelson 38:182ba91524e4 251
Shaun Nelson 38:182ba91524e4 252 /*!
Shaun Nelson 38:182ba91524e4 253 * Maximum allowed beacon less time in ms
Shaun Nelson 38:182ba91524e4 254 */
Shaun Nelson 38:182ba91524e4 255 #define KR920_MAX_BEACON_LESS_PERIOD 7200000
Shaun Nelson 38:182ba91524e4 256
Shaun Nelson 38:182ba91524e4 257 /*!
Shaun Nelson 38:182ba91524e4 258 * Delay time for the BeaconTimingAns in ms
Shaun Nelson 38:182ba91524e4 259 */
Shaun Nelson 38:182ba91524e4 260 #define KR920_BEACON_DELAY_BEACON_TIMING_ANS 30
Shaun Nelson 38:182ba91524e4 261
Shaun Nelson 38:182ba91524e4 262 /*!
Shaun Nelson 38:182ba91524e4 263 * Beacon frequency
Shaun Nelson 38:182ba91524e4 264 */
Shaun Nelson 38:182ba91524e4 265 #define KR920_BEACON_CHANNEL_FREQ 923100000
Shaun Nelson 38:182ba91524e4 266
Shaun Nelson 38:182ba91524e4 267 /*!
Shaun Nelson 38:182ba91524e4 268 * Payload size of a beacon frame
Shaun Nelson 38:182ba91524e4 269 */
Shaun Nelson 38:182ba91524e4 270 #define KR920_BEACON_SIZE 17
Shaun Nelson 38:182ba91524e4 271
Shaun Nelson 38:182ba91524e4 272 /*!
Shaun Nelson 38:182ba91524e4 273 * Datarate of the beacon channel
Shaun Nelson 38:182ba91524e4 274 */
Shaun Nelson 38:182ba91524e4 275 #define KR920_BEACON_CHANNEL_DR DR_3
Shaun Nelson 38:182ba91524e4 276
Shaun Nelson 38:182ba91524e4 277 /*!
Shaun Nelson 38:182ba91524e4 278 * Bandwith of the beacon channel
Shaun Nelson 38:182ba91524e4 279 */
Shaun Nelson 38:182ba91524e4 280 #define KR920_BEACON_CHANNEL_BW 0
Shaun Nelson 38:182ba91524e4 281
Shaun Nelson 38:182ba91524e4 282 /*!
Shaun Nelson 38:182ba91524e4 283 * Maximum number of bands
Shaun Nelson 38:182ba91524e4 284 */
Shaun Nelson 38:182ba91524e4 285 #define KR920_MAX_NB_BANDS 1
Shaun Nelson 38:182ba91524e4 286
Shaun Nelson 38:182ba91524e4 287 /*!
Shaun Nelson 38:182ba91524e4 288 * Band 0 definition
Shaun Nelson 38:182ba91524e4 289 * { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff }
Shaun Nelson 38:182ba91524e4 290 */
Shaun Nelson 38:182ba91524e4 291 #define KR920_BAND0 { 1 , KR920_MAX_TX_POWER, 0, 0 } // 100.0 %
Shaun Nelson 38:182ba91524e4 292
Shaun Nelson 38:182ba91524e4 293 /*!
Shaun Nelson 38:182ba91524e4 294 * LoRaMac default channel 1
Shaun Nelson 38:182ba91524e4 295 * Channel = { Frequency [Hz], RX1 Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
Shaun Nelson 38:182ba91524e4 296 */
Shaun Nelson 38:182ba91524e4 297 #define KR920_LC1 { 922100000, 0, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
Shaun Nelson 38:182ba91524e4 298
Shaun Nelson 38:182ba91524e4 299 /*!
Shaun Nelson 38:182ba91524e4 300 * LoRaMac default channel 2
Shaun Nelson 38:182ba91524e4 301 * Channel = { Frequency [Hz], RX1 Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
Shaun Nelson 38:182ba91524e4 302 */
Shaun Nelson 38:182ba91524e4 303 #define KR920_LC2 { 922300000, 0, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
Shaun Nelson 38:182ba91524e4 304
Shaun Nelson 38:182ba91524e4 305 /*!
Shaun Nelson 38:182ba91524e4 306 * LoRaMac default channel 3
Shaun Nelson 38:182ba91524e4 307 * Channel = { Frequency [Hz], RX1 Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band }
Shaun Nelson 38:182ba91524e4 308 */
Shaun Nelson 38:182ba91524e4 309 #define KR920_LC3 { 922500000, 0, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
Shaun Nelson 38:182ba91524e4 310
Shaun Nelson 38:182ba91524e4 311 /*!
Shaun Nelson 38:182ba91524e4 312 * LoRaMac channels which are allowed for the join procedure
Shaun Nelson 38:182ba91524e4 313 */
Shaun Nelson 38:182ba91524e4 314 #define KR920_JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) )
Shaun Nelson 38:182ba91524e4 315
Shaun Nelson 38:182ba91524e4 316 /*!
Shaun Nelson 38:182ba91524e4 317 * RSSI threshold for a free channel [dBm]
Shaun Nelson 38:182ba91524e4 318 */
Shaun Nelson 38:182ba91524e4 319 #define KR920_RSSI_FREE_TH -65
Shaun Nelson 38:182ba91524e4 320
Shaun Nelson 38:182ba91524e4 321 /*!
Shaun Nelson 38:182ba91524e4 322 * Specifies the time the node performs a carrier sense
Shaun Nelson 38:182ba91524e4 323 */
Shaun Nelson 38:182ba91524e4 324 #define KR920_CARRIER_SENSE_TIME 6
Shaun Nelson 38:182ba91524e4 325
Shaun Nelson 38:182ba91524e4 326 /*!
Shaun Nelson 38:182ba91524e4 327 * Data rates table definition
Shaun Nelson 38:182ba91524e4 328 */
Shaun Nelson 38:182ba91524e4 329 static const uint8_t DataratesKR920[] = { 12, 11, 10, 9, 8, 7 };
Shaun Nelson 38:182ba91524e4 330
Shaun Nelson 38:182ba91524e4 331 /*!
Shaun Nelson 38:182ba91524e4 332 * Bandwidths table definition in Hz
Shaun Nelson 38:182ba91524e4 333 */
Shaun Nelson 38:182ba91524e4 334 static const uint32_t BandwidthsKR920[] = { 125000, 125000, 125000, 125000, 125000, 125000 };
Shaun Nelson 38:182ba91524e4 335
Shaun Nelson 38:182ba91524e4 336 /*!
Shaun Nelson 38:182ba91524e4 337 * Maximum payload with respect to the datarate index. Can operate with and without a repeater.
Shaun Nelson 38:182ba91524e4 338 */
Shaun Nelson 38:182ba91524e4 339 static const uint8_t MaxPayloadOfDatarateKR920[] = { 51, 51, 51, 115, 242, 242 };
Shaun Nelson 38:182ba91524e4 340
Shaun Nelson 38:182ba91524e4 341 /*!
Shaun Nelson 38:182ba91524e4 342 * Maximum payload with respect to the datarate index. Can operate with repeater.
Shaun Nelson 38:182ba91524e4 343 */
Shaun Nelson 38:182ba91524e4 344 static const uint8_t MaxPayloadOfDatarateRepeaterKR920[] = { 51, 51, 51, 115, 222, 222 };
Shaun Nelson 38:182ba91524e4 345
Shaun Nelson 38:182ba91524e4 346 /*!
Shaun Nelson 38:182ba91524e4 347 * \brief The function gets a value of a specific phy attribute.
Shaun Nelson 38:182ba91524e4 348 *
Shaun Nelson 38:182ba91524e4 349 * \param [IN] getPhy Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 350 *
Shaun Nelson 38:182ba91524e4 351 * \retval Returns a structure containing the PHY parameter.
Shaun Nelson 38:182ba91524e4 352 */
Shaun Nelson 38:182ba91524e4 353 PhyParam_t RegionKR920GetPhyParam( GetPhyParams_t* getPhy );
Shaun Nelson 38:182ba91524e4 354
Shaun Nelson 38:182ba91524e4 355 /*!
Shaun Nelson 38:182ba91524e4 356 * \brief Updates the last TX done parameters of the current channel.
Shaun Nelson 38:182ba91524e4 357 *
Shaun Nelson 38:182ba91524e4 358 * \param [IN] txDone Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 359 */
Shaun Nelson 38:182ba91524e4 360 void RegionKR920SetBandTxDone( SetBandTxDoneParams_t* txDone );
Shaun Nelson 38:182ba91524e4 361
Shaun Nelson 38:182ba91524e4 362 /*!
Shaun Nelson 38:182ba91524e4 363 * \brief Initializes the channels masks and the channels.
Shaun Nelson 38:182ba91524e4 364 *
Shaun Nelson 38:182ba91524e4 365 * \param [IN] type Sets the initialization type.
Shaun Nelson 38:182ba91524e4 366 */
Shaun Nelson 38:182ba91524e4 367 void RegionKR920InitDefaults( InitType_t type );
Shaun Nelson 38:182ba91524e4 368
Shaun Nelson 38:182ba91524e4 369 /*!
Shaun Nelson 38:182ba91524e4 370 * \brief Verifies a parameter.
Shaun Nelson 38:182ba91524e4 371 *
Shaun Nelson 38:182ba91524e4 372 * \param [IN] verify Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 373 *
Shaun Nelson 38:182ba91524e4 374 * \param [IN] type Sets the initialization type.
Shaun Nelson 38:182ba91524e4 375 *
Shaun Nelson 38:182ba91524e4 376 * \retval Returns true, if the parameter is valid.
Shaun Nelson 38:182ba91524e4 377 */
Shaun Nelson 38:182ba91524e4 378 bool RegionKR920Verify( VerifyParams_t* verify, PhyAttribute_t phyAttribute );
Shaun Nelson 38:182ba91524e4 379
Shaun Nelson 38:182ba91524e4 380 /*!
Shaun Nelson 38:182ba91524e4 381 * \brief The function parses the input buffer and sets up the channels of the
Shaun Nelson 38:182ba91524e4 382 * CF list.
Shaun Nelson 38:182ba91524e4 383 *
Shaun Nelson 38:182ba91524e4 384 * \param [IN] applyCFList Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 385 */
Shaun Nelson 38:182ba91524e4 386 void RegionKR920ApplyCFList( ApplyCFListParams_t* applyCFList );
Shaun Nelson 38:182ba91524e4 387
Shaun Nelson 38:182ba91524e4 388 /*!
Shaun Nelson 38:182ba91524e4 389 * \brief Sets a channels mask.
Shaun Nelson 38:182ba91524e4 390 *
Shaun Nelson 38:182ba91524e4 391 * \param [IN] chanMaskSet Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 392 *
Shaun Nelson 38:182ba91524e4 393 * \retval Returns true, if the channels mask could be set.
Shaun Nelson 38:182ba91524e4 394 */
Shaun Nelson 38:182ba91524e4 395 bool RegionKR920ChanMaskSet( ChanMaskSetParams_t* chanMaskSet );
Shaun Nelson 38:182ba91524e4 396
Shaun Nelson 38:182ba91524e4 397 /*!
Shaun Nelson 38:182ba91524e4 398 * \brief Calculates the next datarate to set, when ADR is on or off.
Shaun Nelson 38:182ba91524e4 399 *
Shaun Nelson 38:182ba91524e4 400 * \param [IN] adrNext Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 401 *
Shaun Nelson 38:182ba91524e4 402 * \param [OUT] drOut The calculated datarate for the next TX.
Shaun Nelson 38:182ba91524e4 403 *
Shaun Nelson 38:182ba91524e4 404 * \param [OUT] txPowOut The TX power for the next TX.
Shaun Nelson 38:182ba91524e4 405 *
Shaun Nelson 38:182ba91524e4 406 * \param [OUT] adrAckCounter The calculated ADR acknowledgement counter.
Shaun Nelson 38:182ba91524e4 407 *
Shaun Nelson 38:182ba91524e4 408 * \retval Returns true, if an ADR request should be performed.
Shaun Nelson 38:182ba91524e4 409 */
Shaun Nelson 38:182ba91524e4 410 bool RegionKR920AdrNext( AdrNextParams_t* adrNext, int8_t* drOut, int8_t* txPowOut, uint32_t* adrAckCounter );
Shaun Nelson 38:182ba91524e4 411
Shaun Nelson 38:182ba91524e4 412 /*!
Shaun Nelson 38:182ba91524e4 413 * Computes the Rx window timeout and offset.
Shaun Nelson 38:182ba91524e4 414 *
Shaun Nelson 38:182ba91524e4 415 * \param [IN] datarate Rx window datarate index to be used
Shaun Nelson 38:182ba91524e4 416 *
Shaun Nelson 38:182ba91524e4 417 * \param [IN] minRxSymbols Minimum required number of symbols to detect an Rx frame.
Shaun Nelson 38:182ba91524e4 418 *
Shaun Nelson 38:182ba91524e4 419 * \param [IN] rxError System maximum timing error of the receiver. In milliseconds
Shaun Nelson 38:182ba91524e4 420 * The receiver will turn on in a [-rxError : +rxError] ms
Shaun Nelson 38:182ba91524e4 421 * interval around RxOffset
Shaun Nelson 38:182ba91524e4 422 *
Shaun Nelson 38:182ba91524e4 423 * \param [OUT]rxConfigParams Returns updated WindowTimeout and WindowOffset fields.
Shaun Nelson 38:182ba91524e4 424 */
Shaun Nelson 38:182ba91524e4 425 void RegionKR920ComputeRxWindowParameters( int8_t datarate, uint8_t minRxSymbols, uint32_t rxError, RxConfigParams_t *rxConfigParams );
Shaun Nelson 38:182ba91524e4 426
Shaun Nelson 38:182ba91524e4 427 /*!
Shaun Nelson 38:182ba91524e4 428 * \brief Configuration of the RX windows.
Shaun Nelson 38:182ba91524e4 429 *
Shaun Nelson 38:182ba91524e4 430 * \param [IN] rxConfig Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 431 *
Shaun Nelson 38:182ba91524e4 432 * \param [OUT] datarate The datarate index which was set.
Shaun Nelson 38:182ba91524e4 433 *
Shaun Nelson 38:182ba91524e4 434 * \retval Returns true, if the configuration was applied successfully.
Shaun Nelson 38:182ba91524e4 435 */
Shaun Nelson 38:182ba91524e4 436 bool RegionKR920RxConfig( RxConfigParams_t* rxConfig, int8_t* datarate );
Shaun Nelson 38:182ba91524e4 437
Shaun Nelson 38:182ba91524e4 438 /*!
Shaun Nelson 38:182ba91524e4 439 * \brief TX configuration.
Shaun Nelson 38:182ba91524e4 440 *
Shaun Nelson 38:182ba91524e4 441 * \param [IN] txConfig Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 442 *
Shaun Nelson 38:182ba91524e4 443 * \param [OUT] txPower The tx power index which was set.
Shaun Nelson 38:182ba91524e4 444 *
Shaun Nelson 38:182ba91524e4 445 * \param [OUT] txTimeOnAir The time-on-air of the frame.
Shaun Nelson 38:182ba91524e4 446 *
Shaun Nelson 38:182ba91524e4 447 * \retval Returns true, if the configuration was applied successfully.
Shaun Nelson 38:182ba91524e4 448 */
Shaun Nelson 38:182ba91524e4 449 bool RegionKR920TxConfig( TxConfigParams_t* txConfig, int8_t* txPower, TimerTime_t* txTimeOnAir );
Shaun Nelson 38:182ba91524e4 450
Shaun Nelson 38:182ba91524e4 451 /*!
Shaun Nelson 38:182ba91524e4 452 * \brief The function processes a Link ADR Request.
Shaun Nelson 38:182ba91524e4 453 *
Shaun Nelson 38:182ba91524e4 454 * \param [IN] linkAdrReq Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 455 *
Shaun Nelson 38:182ba91524e4 456 * \retval Returns the status of the operation, according to the LoRaMAC specification.
Shaun Nelson 38:182ba91524e4 457 */
Shaun Nelson 38:182ba91524e4 458 uint8_t RegionKR920LinkAdrReq( LinkAdrReqParams_t* linkAdrReq, int8_t* drOut, int8_t* txPowOut, uint8_t* nbRepOut, uint8_t* nbBytesParsed );
Shaun Nelson 38:182ba91524e4 459
Shaun Nelson 38:182ba91524e4 460 /*!
Shaun Nelson 38:182ba91524e4 461 * \brief The function processes a RX Parameter Setup Request.
Shaun Nelson 38:182ba91524e4 462 *
Shaun Nelson 38:182ba91524e4 463 * \param [IN] rxParamSetupReq Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 464 *
Shaun Nelson 38:182ba91524e4 465 * \retval Returns the status of the operation, according to the LoRaMAC specification.
Shaun Nelson 38:182ba91524e4 466 */
Shaun Nelson 38:182ba91524e4 467 uint8_t RegionKR920RxParamSetupReq( RxParamSetupReqParams_t* rxParamSetupReq );
Shaun Nelson 38:182ba91524e4 468
Shaun Nelson 38:182ba91524e4 469 /*!
Shaun Nelson 38:182ba91524e4 470 * \brief The function processes a Channel Request.
Shaun Nelson 38:182ba91524e4 471 *
Shaun Nelson 38:182ba91524e4 472 * \param [IN] newChannelReq Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 473 *
Shaun Nelson 38:182ba91524e4 474 * \retval Returns the status of the operation, according to the LoRaMAC specification.
Shaun Nelson 38:182ba91524e4 475 */
Shaun Nelson 38:182ba91524e4 476 uint8_t RegionKR920NewChannelReq( NewChannelReqParams_t* newChannelReq );
Shaun Nelson 38:182ba91524e4 477
Shaun Nelson 38:182ba91524e4 478 /*!
Shaun Nelson 38:182ba91524e4 479 * \brief The function processes a TX ParamSetup Request.
Shaun Nelson 38:182ba91524e4 480 *
Shaun Nelson 38:182ba91524e4 481 * \param [IN] txParamSetupReq Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 482 *
Shaun Nelson 38:182ba91524e4 483 * \retval Returns the status of the operation, according to the LoRaMAC specification.
Shaun Nelson 38:182ba91524e4 484 * Returns -1, if the functionality is not implemented. In this case, the end node
Shaun Nelson 38:182ba91524e4 485 * shall not process the command.
Shaun Nelson 38:182ba91524e4 486 */
Shaun Nelson 38:182ba91524e4 487 int8_t RegionKR920TxParamSetupReq( TxParamSetupReqParams_t* txParamSetupReq );
Shaun Nelson 38:182ba91524e4 488
Shaun Nelson 38:182ba91524e4 489 /*!
Shaun Nelson 38:182ba91524e4 490 * \brief The function processes a DlChannel Request.
Shaun Nelson 38:182ba91524e4 491 *
Shaun Nelson 38:182ba91524e4 492 * \param [IN] dlChannelReq Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 493 *
Shaun Nelson 38:182ba91524e4 494 * \retval Returns the status of the operation, according to the LoRaMAC specification.
Shaun Nelson 38:182ba91524e4 495 */
Shaun Nelson 38:182ba91524e4 496 uint8_t RegionKR920DlChannelReq( DlChannelReqParams_t* dlChannelReq );
Shaun Nelson 38:182ba91524e4 497
Shaun Nelson 38:182ba91524e4 498 /*!
Shaun Nelson 38:182ba91524e4 499 * \brief Alternates the datarate of the channel for the join request.
Shaun Nelson 38:182ba91524e4 500 *
Shaun Nelson 38:182ba91524e4 501 * \param [IN] alternateDr Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 502 *
Shaun Nelson 38:182ba91524e4 503 * \retval Datarate to apply.
Shaun Nelson 38:182ba91524e4 504 */
Shaun Nelson 38:182ba91524e4 505 int8_t RegionKR920AlternateDr( AlternateDrParams_t* alternateDr );
Shaun Nelson 38:182ba91524e4 506
Shaun Nelson 38:182ba91524e4 507 /*!
Shaun Nelson 38:182ba91524e4 508 * \brief Calculates the back-off time.
Shaun Nelson 38:182ba91524e4 509 *
Shaun Nelson 38:182ba91524e4 510 * \param [IN] calcBackOff Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 511 */
Shaun Nelson 38:182ba91524e4 512 void RegionKR920CalcBackOff( CalcBackOffParams_t* calcBackOff );
Shaun Nelson 38:182ba91524e4 513
Shaun Nelson 38:182ba91524e4 514 /*!
Shaun Nelson 38:182ba91524e4 515 * \brief Searches and set the next random available channel
Shaun Nelson 38:182ba91524e4 516 *
Shaun Nelson 38:182ba91524e4 517 * \param [OUT] channel Next channel to use for TX.
Shaun Nelson 38:182ba91524e4 518 *
Shaun Nelson 38:182ba91524e4 519 * \param [OUT] time Time to wait for the next transmission according to the duty
Shaun Nelson 38:182ba91524e4 520 * cycle.
Shaun Nelson 38:182ba91524e4 521 *
Shaun Nelson 38:182ba91524e4 522 * \param [OUT] aggregatedTimeOff Updates the aggregated time off.
Shaun Nelson 38:182ba91524e4 523 *
Shaun Nelson 38:182ba91524e4 524 * \retval Function status [1: OK, 0: Unable to find a channel on the current datarate]
Shaun Nelson 38:182ba91524e4 525 */
Shaun Nelson 38:182ba91524e4 526 bool RegionKR920NextChannel( NextChanParams_t* nextChanParams, uint8_t* channel, TimerTime_t* time, TimerTime_t* aggregatedTimeOff );
Shaun Nelson 38:182ba91524e4 527
Shaun Nelson 38:182ba91524e4 528 /*!
Shaun Nelson 38:182ba91524e4 529 * \brief Adds a channel.
Shaun Nelson 38:182ba91524e4 530 *
Shaun Nelson 38:182ba91524e4 531 * \param [IN] channelAdd Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 532 *
Shaun Nelson 38:182ba91524e4 533 * \retval Status of the operation.
Shaun Nelson 38:182ba91524e4 534 */
Shaun Nelson 38:182ba91524e4 535 LoRaMacStatus_t RegionKR920ChannelAdd( ChannelAddParams_t* channelAdd );
Shaun Nelson 38:182ba91524e4 536
Shaun Nelson 38:182ba91524e4 537 /*!
Shaun Nelson 38:182ba91524e4 538 * \brief Removes a channel.
Shaun Nelson 38:182ba91524e4 539 *
Shaun Nelson 38:182ba91524e4 540 * \param [IN] channelRemove Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 541 *
Shaun Nelson 38:182ba91524e4 542 * \retval Returns true, if the channel was removed successfully.
Shaun Nelson 38:182ba91524e4 543 */
Shaun Nelson 38:182ba91524e4 544 bool RegionKR920ChannelsRemove( ChannelRemoveParams_t* channelRemove );
Shaun Nelson 38:182ba91524e4 545
Shaun Nelson 38:182ba91524e4 546 /*!
Shaun Nelson 38:182ba91524e4 547 * \brief Sets the radio into continuous wave mode.
Shaun Nelson 38:182ba91524e4 548 *
Shaun Nelson 38:182ba91524e4 549 * \param [IN] continuousWave Pointer to the function parameters.
Shaun Nelson 38:182ba91524e4 550 */
Shaun Nelson 38:182ba91524e4 551 void RegionKR920SetContinuousWave( ContinuousWaveParams_t* continuousWave );
Shaun Nelson 38:182ba91524e4 552
Shaun Nelson 38:182ba91524e4 553 /*!
Shaun Nelson 38:182ba91524e4 554 * \brief Computes new datarate according to the given offset
Shaun Nelson 38:182ba91524e4 555 *
Shaun Nelson 38:182ba91524e4 556 * \param [IN] downlinkDwellTime Downlink dwell time configuration. 0: No limit, 1: 400ms
Shaun Nelson 38:182ba91524e4 557 *
Shaun Nelson 38:182ba91524e4 558 * \param [IN] dr Current datarate
Shaun Nelson 38:182ba91524e4 559 *
Shaun Nelson 38:182ba91524e4 560 * \param [IN] drOffset Offset to be applied
Shaun Nelson 38:182ba91524e4 561 *
Shaun Nelson 38:182ba91524e4 562 * \retval newDr Computed datarate.
Shaun Nelson 38:182ba91524e4 563 */
Shaun Nelson 38:182ba91524e4 564 uint8_t RegionKR920ApplyDrOffset( uint8_t downlinkDwellTime, int8_t dr, int8_t drOffset );
Shaun Nelson 38:182ba91524e4 565
Shaun Nelson 38:182ba91524e4 566 /*! \} defgroup REGIONKR920 */
Shaun Nelson 38:182ba91524e4 567
Shaun Nelson 38:182ba91524e4 568 #endif // __REGION_KR920_H__