asif-test
Fork of LoRaWAN-lib by
LoRaMac.h@1:91e4e6c60d1e, 2015-11-23 (annotated)
- Committer:
- mluis
- Date:
- Mon Nov 23 10:09:43 2015 +0000
- Revision:
- 1:91e4e6c60d1e
- Parent:
- 0:91d1a7783bb9
- Child:
- 2:14a5d6ad92d5
Keep LoRaMac only related files in the library.; Updated files according to latest GitHub version
Who changed what in which revision?
User | Revision | Line number | New 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 implementation |
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_H__ |
mluis | 0:91d1a7783bb9 | 16 | #define __LORAMAC_H__ |
mluis | 0:91d1a7783bb9 | 17 | |
mluis | 0:91d1a7783bb9 | 18 | // Includes board dependent definitions such as channels frequencies |
mluis | 0:91d1a7783bb9 | 19 | #include "LoRaMac-board.h" |
mluis | 0:91d1a7783bb9 | 20 | |
mluis | 0:91d1a7783bb9 | 21 | /*! |
mluis | 0:91d1a7783bb9 | 22 | * Beacon interval in us |
mluis | 0:91d1a7783bb9 | 23 | */ |
mluis | 0:91d1a7783bb9 | 24 | #define BEACON_INTERVAL 128000000 |
mluis | 0:91d1a7783bb9 | 25 | |
mluis | 0:91d1a7783bb9 | 26 | /*! |
mluis | 0:91d1a7783bb9 | 27 | * Class A&B receive delay in us |
mluis | 0:91d1a7783bb9 | 28 | */ |
mluis | 0:91d1a7783bb9 | 29 | #define RECEIVE_DELAY1 1000000 |
mluis | 0:91d1a7783bb9 | 30 | #define RECEIVE_DELAY2 2000000 |
mluis | 0:91d1a7783bb9 | 31 | |
mluis | 0:91d1a7783bb9 | 32 | /*! |
mluis | 0:91d1a7783bb9 | 33 | * Join accept receive delay in us |
mluis | 0:91d1a7783bb9 | 34 | */ |
mluis | 0:91d1a7783bb9 | 35 | #define JOIN_ACCEPT_DELAY1 5000000 |
mluis | 0:91d1a7783bb9 | 36 | #define JOIN_ACCEPT_DELAY2 6000000 |
mluis | 0:91d1a7783bb9 | 37 | |
mluis | 0:91d1a7783bb9 | 38 | /*! |
mluis | 0:91d1a7783bb9 | 39 | * Class A&B maximum receive window delay in us |
mluis | 0:91d1a7783bb9 | 40 | */ |
mluis | 0:91d1a7783bb9 | 41 | #define MAX_RX_WINDOW 3000000 |
mluis | 0:91d1a7783bb9 | 42 | |
mluis | 0:91d1a7783bb9 | 43 | /*! |
mluis | 0:91d1a7783bb9 | 44 | * Maximum allowed gap for the FCNT field |
mluis | 0:91d1a7783bb9 | 45 | */ |
mluis | 0:91d1a7783bb9 | 46 | #define MAX_FCNT_GAP 16384 |
mluis | 0:91d1a7783bb9 | 47 | |
mluis | 0:91d1a7783bb9 | 48 | /*! |
mluis | 0:91d1a7783bb9 | 49 | * ADR acknowledgement counter limit |
mluis | 0:91d1a7783bb9 | 50 | */ |
mluis | 0:91d1a7783bb9 | 51 | #define ADR_ACK_LIMIT 64 |
mluis | 0:91d1a7783bb9 | 52 | |
mluis | 0:91d1a7783bb9 | 53 | /*! |
mluis | 0:91d1a7783bb9 | 54 | * Number of ADR acknowledgement requests before returning to default datarate |
mluis | 0:91d1a7783bb9 | 55 | */ |
mluis | 0:91d1a7783bb9 | 56 | #define ADR_ACK_DELAY 32 |
mluis | 0:91d1a7783bb9 | 57 | |
mluis | 0:91d1a7783bb9 | 58 | /*! |
mluis | 0:91d1a7783bb9 | 59 | * Number of seconds after the start of the second reception window without |
mluis | 0:91d1a7783bb9 | 60 | * receiving an acknowledge. |
mluis | 0:91d1a7783bb9 | 61 | * AckTimeout = ACK_TIMEOUT + Random( -ACK_TIMEOUT_RND, ACK_TIMEOUT_RND ) |
mluis | 0:91d1a7783bb9 | 62 | */ |
mluis | 0:91d1a7783bb9 | 63 | #define ACK_TIMEOUT 2000000 |
mluis | 0:91d1a7783bb9 | 64 | |
mluis | 0:91d1a7783bb9 | 65 | /*! |
mluis | 0:91d1a7783bb9 | 66 | * Random number of seconds after the start of the second reception window without |
mluis | 0:91d1a7783bb9 | 67 | * receiving an acknowledge |
mluis | 0:91d1a7783bb9 | 68 | * AckTimeout = ACK_TIMEOUT + Random( -ACK_TIMEOUT_RND, ACK_TIMEOUT_RND ) |
mluis | 0:91d1a7783bb9 | 69 | */ |
mluis | 0:91d1a7783bb9 | 70 | #define ACK_TIMEOUT_RND 1000000 |
mluis | 0:91d1a7783bb9 | 71 | |
mluis | 0:91d1a7783bb9 | 72 | /*! |
mluis | 0:91d1a7783bb9 | 73 | * Check the Mac layer state every MAC_STATE_CHECK_TIMEOUT |
mluis | 0:91d1a7783bb9 | 74 | */ |
mluis | 0:91d1a7783bb9 | 75 | #define MAC_STATE_CHECK_TIMEOUT 1000000 |
mluis | 0:91d1a7783bb9 | 76 | |
mluis | 0:91d1a7783bb9 | 77 | /*! |
mluis | 0:91d1a7783bb9 | 78 | * Maximum number of times the MAC layer tries to get an acknowledge. |
mluis | 0:91d1a7783bb9 | 79 | */ |
mluis | 0:91d1a7783bb9 | 80 | #define MAX_ACK_RETRIES 8 |
mluis | 0:91d1a7783bb9 | 81 | |
mluis | 0:91d1a7783bb9 | 82 | /*! |
mluis | 0:91d1a7783bb9 | 83 | * RSSI free threshold |
mluis | 0:91d1a7783bb9 | 84 | */ |
mluis | 0:91d1a7783bb9 | 85 | #define RSSI_FREE_TH ( int8_t )( -90 ) // [dBm] |
mluis | 0:91d1a7783bb9 | 86 | |
mluis | 0:91d1a7783bb9 | 87 | /*! |
mluis | 0:91d1a7783bb9 | 88 | * Frame direction definition |
mluis | 0:91d1a7783bb9 | 89 | */ |
mluis | 0:91d1a7783bb9 | 90 | #define UP_LINK 0 |
mluis | 0:91d1a7783bb9 | 91 | #define DOWN_LINK 1 |
mluis | 0:91d1a7783bb9 | 92 | |
mluis | 0:91d1a7783bb9 | 93 | /*! |
mluis | 0:91d1a7783bb9 | 94 | * Sets the length of the LoRaMAC footer field. |
mluis | 0:91d1a7783bb9 | 95 | * Mainly indicates the MIC field length |
mluis | 0:91d1a7783bb9 | 96 | */ |
mluis | 0:91d1a7783bb9 | 97 | #define LORAMAC_MFR_LEN 4 |
mluis | 0:91d1a7783bb9 | 98 | |
mluis | 0:91d1a7783bb9 | 99 | /*! |
mluis | 0:91d1a7783bb9 | 100 | * Syncword for Private LoRa networks |
mluis | 0:91d1a7783bb9 | 101 | */ |
mluis | 0:91d1a7783bb9 | 102 | #define LORA_MAC_PRIVATE_SYNCWORD 0x12 |
mluis | 0:91d1a7783bb9 | 103 | |
mluis | 0:91d1a7783bb9 | 104 | /*! |
mluis | 0:91d1a7783bb9 | 105 | * Syncword for Public LoRa networks |
mluis | 0:91d1a7783bb9 | 106 | */ |
mluis | 0:91d1a7783bb9 | 107 | #define LORA_MAC_PUBLIC_SYNCWORD 0x34 |
mluis | 0:91d1a7783bb9 | 108 | |
mluis | 0:91d1a7783bb9 | 109 | /*! |
mluis | 0:91d1a7783bb9 | 110 | * LoRaWAN devices classes definition |
mluis | 0:91d1a7783bb9 | 111 | */ |
mluis | 0:91d1a7783bb9 | 112 | typedef enum |
mluis | 0:91d1a7783bb9 | 113 | { |
mluis | 0:91d1a7783bb9 | 114 | CLASS_A, |
mluis | 0:91d1a7783bb9 | 115 | CLASS_B, |
mluis | 0:91d1a7783bb9 | 116 | CLASS_C, |
mluis | 0:91d1a7783bb9 | 117 | }DeviceClass_t; |
mluis | 0:91d1a7783bb9 | 118 | |
mluis | 0:91d1a7783bb9 | 119 | /*! |
mluis | 0:91d1a7783bb9 | 120 | * LoRaMAC channels parameters definition |
mluis | 0:91d1a7783bb9 | 121 | */ |
mluis | 0:91d1a7783bb9 | 122 | typedef union |
mluis | 0:91d1a7783bb9 | 123 | { |
mluis | 0:91d1a7783bb9 | 124 | int8_t Value; |
mluis | 0:91d1a7783bb9 | 125 | struct |
mluis | 0:91d1a7783bb9 | 126 | { |
mluis | 0:91d1a7783bb9 | 127 | int8_t Min : 4; |
mluis | 0:91d1a7783bb9 | 128 | int8_t Max : 4; |
mluis | 0:91d1a7783bb9 | 129 | }Fields; |
mluis | 0:91d1a7783bb9 | 130 | }DrRange_t; |
mluis | 0:91d1a7783bb9 | 131 | |
mluis | 0:91d1a7783bb9 | 132 | typedef struct |
mluis | 0:91d1a7783bb9 | 133 | { |
mluis | 0:91d1a7783bb9 | 134 | uint16_t DCycle; |
mluis | 0:91d1a7783bb9 | 135 | int8_t TxMaxPower; |
mluis | 0:91d1a7783bb9 | 136 | uint64_t LastTxDoneTime; |
mluis | 0:91d1a7783bb9 | 137 | uint64_t TimeOff; |
mluis | 0:91d1a7783bb9 | 138 | }Band_t; |
mluis | 0:91d1a7783bb9 | 139 | |
mluis | 0:91d1a7783bb9 | 140 | typedef struct |
mluis | 0:91d1a7783bb9 | 141 | { |
mluis | 0:91d1a7783bb9 | 142 | uint32_t Frequency; // Hz |
mluis | 0:91d1a7783bb9 | 143 | DrRange_t DrRange; // Max datarate [0: SF12, 1: SF11, 2: SF10, 3: SF9, 4: SF8, 5: SF7, 6: SF7, 7: FSK] |
mluis | 0:91d1a7783bb9 | 144 | // Min datarate [0: SF12, 1: SF11, 2: SF10, 3: SF9, 4: SF8, 5: SF7, 6: SF7, 7: FSK] |
mluis | 0:91d1a7783bb9 | 145 | uint8_t Band; // Band index |
mluis | 0:91d1a7783bb9 | 146 | }ChannelParams_t; |
mluis | 0:91d1a7783bb9 | 147 | |
mluis | 0:91d1a7783bb9 | 148 | typedef struct |
mluis | 0:91d1a7783bb9 | 149 | { |
mluis | 0:91d1a7783bb9 | 150 | uint32_t Frequency; // Hz |
mluis | 0:91d1a7783bb9 | 151 | uint8_t Datarate; // [0: SF12, 1: SF11, 2: SF10, 3: SF9, 4: SF8, 5: SF7, 6: SF7, 7: FSK] |
mluis | 0:91d1a7783bb9 | 152 | }Rx2ChannelParams_t; |
mluis | 0:91d1a7783bb9 | 153 | |
mluis | 0:91d1a7783bb9 | 154 | typedef struct MulticastParams_s |
mluis | 0:91d1a7783bb9 | 155 | { |
mluis | 0:91d1a7783bb9 | 156 | uint32_t Address; |
mluis | 0:91d1a7783bb9 | 157 | uint8_t NwkSKey[16]; |
mluis | 0:91d1a7783bb9 | 158 | uint8_t AppSKey[16]; |
mluis | 0:91d1a7783bb9 | 159 | uint32_t DownLinkCounter; |
mluis | 0:91d1a7783bb9 | 160 | struct MulticastParams_s *Next; |
mluis | 0:91d1a7783bb9 | 161 | }MulticastParams_t; |
mluis | 0:91d1a7783bb9 | 162 | |
mluis | 0:91d1a7783bb9 | 163 | /*! |
mluis | 0:91d1a7783bb9 | 164 | * LoRaMAC frame types |
mluis | 0:91d1a7783bb9 | 165 | */ |
mluis | 0:91d1a7783bb9 | 166 | typedef enum |
mluis | 0:91d1a7783bb9 | 167 | { |
mluis | 0:91d1a7783bb9 | 168 | FRAME_TYPE_JOIN_REQ = 0x00, |
mluis | 0:91d1a7783bb9 | 169 | FRAME_TYPE_JOIN_ACCEPT = 0x01, |
mluis | 0:91d1a7783bb9 | 170 | FRAME_TYPE_DATA_UNCONFIRMED_UP = 0x02, |
mluis | 0:91d1a7783bb9 | 171 | FRAME_TYPE_DATA_UNCONFIRMED_DOWN = 0x03, |
mluis | 0:91d1a7783bb9 | 172 | FRAME_TYPE_DATA_CONFIRMED_UP = 0x04, |
mluis | 0:91d1a7783bb9 | 173 | FRAME_TYPE_DATA_CONFIRMED_DOWN = 0x05, |
mluis | 0:91d1a7783bb9 | 174 | FRAME_TYPE_RFU = 0x06, |
mluis | 0:91d1a7783bb9 | 175 | FRAME_TYPE_PROPRIETARY = 0x07, |
mluis | 0:91d1a7783bb9 | 176 | }LoRaMacFrameType_t; |
mluis | 0:91d1a7783bb9 | 177 | |
mluis | 0:91d1a7783bb9 | 178 | /*! |
mluis | 0:91d1a7783bb9 | 179 | * LoRaMAC mote MAC commands |
mluis | 0:91d1a7783bb9 | 180 | */ |
mluis | 0:91d1a7783bb9 | 181 | typedef enum |
mluis | 0:91d1a7783bb9 | 182 | { |
mluis | 0:91d1a7783bb9 | 183 | MOTE_MAC_LINK_CHECK_REQ = 0x02, |
mluis | 0:91d1a7783bb9 | 184 | MOTE_MAC_LINK_ADR_ANS = 0x03, |
mluis | 0:91d1a7783bb9 | 185 | MOTE_MAC_DUTY_CYCLE_ANS = 0x04, |
mluis | 0:91d1a7783bb9 | 186 | MOTE_MAC_RX_PARAM_SETUP_ANS = 0x05, |
mluis | 0:91d1a7783bb9 | 187 | MOTE_MAC_DEV_STATUS_ANS = 0x06, |
mluis | 0:91d1a7783bb9 | 188 | MOTE_MAC_NEW_CHANNEL_ANS = 0x07, |
mluis | 0:91d1a7783bb9 | 189 | MOTE_MAC_RX_TIMING_SETUP_ANS = 0x08, |
mluis | 0:91d1a7783bb9 | 190 | }LoRaMacMoteCmd_t; |
mluis | 0:91d1a7783bb9 | 191 | |
mluis | 0:91d1a7783bb9 | 192 | /*! |
mluis | 0:91d1a7783bb9 | 193 | * LoRaMAC server MAC commands |
mluis | 0:91d1a7783bb9 | 194 | */ |
mluis | 0:91d1a7783bb9 | 195 | typedef enum |
mluis | 0:91d1a7783bb9 | 196 | { |
mluis | 0:91d1a7783bb9 | 197 | SRV_MAC_LINK_CHECK_ANS = 0x02, |
mluis | 0:91d1a7783bb9 | 198 | SRV_MAC_LINK_ADR_REQ = 0x03, |
mluis | 0:91d1a7783bb9 | 199 | SRV_MAC_DUTY_CYCLE_REQ = 0x04, |
mluis | 0:91d1a7783bb9 | 200 | SRV_MAC_RX_PARAM_SETUP_REQ = 0x05, |
mluis | 0:91d1a7783bb9 | 201 | SRV_MAC_DEV_STATUS_REQ = 0x06, |
mluis | 0:91d1a7783bb9 | 202 | SRV_MAC_NEW_CHANNEL_REQ = 0x07, |
mluis | 0:91d1a7783bb9 | 203 | SRV_MAC_RX_TIMING_SETUP_REQ = 0x08, |
mluis | 0:91d1a7783bb9 | 204 | }LoRaMacSrvCmd_t; |
mluis | 0:91d1a7783bb9 | 205 | |
mluis | 0:91d1a7783bb9 | 206 | /*! |
mluis | 0:91d1a7783bb9 | 207 | * LoRaMAC Battery level indicator |
mluis | 0:91d1a7783bb9 | 208 | */ |
mluis | 0:91d1a7783bb9 | 209 | typedef enum |
mluis | 0:91d1a7783bb9 | 210 | { |
mluis | 0:91d1a7783bb9 | 211 | BAT_LEVEL_EXT_SRC = 0x00, |
mluis | 0:91d1a7783bb9 | 212 | BAT_LEVEL_EMPTY = 0x01, |
mluis | 0:91d1a7783bb9 | 213 | BAT_LEVEL_FULL = 0xFE, |
mluis | 0:91d1a7783bb9 | 214 | BAT_LEVEL_NO_MEASURE = 0xFF, |
mluis | 0:91d1a7783bb9 | 215 | }LoRaMacBatteryLevel_t; |
mluis | 0:91d1a7783bb9 | 216 | |
mluis | 0:91d1a7783bb9 | 217 | /*! |
mluis | 0:91d1a7783bb9 | 218 | * LoRaMAC header field definition |
mluis | 0:91d1a7783bb9 | 219 | */ |
mluis | 0:91d1a7783bb9 | 220 | typedef union |
mluis | 0:91d1a7783bb9 | 221 | { |
mluis | 0:91d1a7783bb9 | 222 | uint8_t Value; |
mluis | 0:91d1a7783bb9 | 223 | struct |
mluis | 0:91d1a7783bb9 | 224 | { |
mluis | 0:91d1a7783bb9 | 225 | uint8_t Major : 2; |
mluis | 0:91d1a7783bb9 | 226 | uint8_t RFU : 3; |
mluis | 0:91d1a7783bb9 | 227 | uint8_t MType : 3; |
mluis | 0:91d1a7783bb9 | 228 | }Bits; |
mluis | 0:91d1a7783bb9 | 229 | }LoRaMacHeader_t; |
mluis | 0:91d1a7783bb9 | 230 | |
mluis | 0:91d1a7783bb9 | 231 | /*! |
mluis | 0:91d1a7783bb9 | 232 | * LoRaMAC frame header field definition |
mluis | 0:91d1a7783bb9 | 233 | */ |
mluis | 0:91d1a7783bb9 | 234 | typedef union |
mluis | 0:91d1a7783bb9 | 235 | { |
mluis | 0:91d1a7783bb9 | 236 | uint8_t Value; |
mluis | 0:91d1a7783bb9 | 237 | struct |
mluis | 0:91d1a7783bb9 | 238 | { |
mluis | 0:91d1a7783bb9 | 239 | uint8_t FOptsLen : 4; |
mluis | 0:91d1a7783bb9 | 240 | uint8_t FPending : 1; |
mluis | 0:91d1a7783bb9 | 241 | uint8_t Ack : 1; |
mluis | 0:91d1a7783bb9 | 242 | uint8_t AdrAckReq : 1; |
mluis | 0:91d1a7783bb9 | 243 | uint8_t Adr : 1; |
mluis | 0:91d1a7783bb9 | 244 | }Bits; |
mluis | 0:91d1a7783bb9 | 245 | }LoRaMacFrameCtrl_t; |
mluis | 0:91d1a7783bb9 | 246 | |
mluis | 0:91d1a7783bb9 | 247 | /*! |
mluis | 0:91d1a7783bb9 | 248 | * LoRaMAC event flags |
mluis | 0:91d1a7783bb9 | 249 | */ |
mluis | 0:91d1a7783bb9 | 250 | typedef union |
mluis | 0:91d1a7783bb9 | 251 | { |
mluis | 0:91d1a7783bb9 | 252 | uint8_t Value; |
mluis | 0:91d1a7783bb9 | 253 | struct |
mluis | 0:91d1a7783bb9 | 254 | { |
mluis | 0:91d1a7783bb9 | 255 | uint8_t Tx : 1; |
mluis | 0:91d1a7783bb9 | 256 | uint8_t Rx : 1; |
mluis | 0:91d1a7783bb9 | 257 | uint8_t RxData : 1; |
mluis | 0:91d1a7783bb9 | 258 | uint8_t Multicast : 1; |
mluis | 0:91d1a7783bb9 | 259 | uint8_t RxSlot : 2; |
mluis | 0:91d1a7783bb9 | 260 | uint8_t LinkCheck : 1; |
mluis | 0:91d1a7783bb9 | 261 | uint8_t JoinAccept : 1; |
mluis | 0:91d1a7783bb9 | 262 | }Bits; |
mluis | 0:91d1a7783bb9 | 263 | }LoRaMacEventFlags_t; |
mluis | 0:91d1a7783bb9 | 264 | |
mluis | 0:91d1a7783bb9 | 265 | typedef enum |
mluis | 0:91d1a7783bb9 | 266 | { |
mluis | 0:91d1a7783bb9 | 267 | LORAMAC_EVENT_INFO_STATUS_OK = 0, |
mluis | 0:91d1a7783bb9 | 268 | LORAMAC_EVENT_INFO_STATUS_ERROR, |
mluis | 0:91d1a7783bb9 | 269 | LORAMAC_EVENT_INFO_STATUS_TX_TIMEOUT, |
mluis | 0:91d1a7783bb9 | 270 | LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT, |
mluis | 0:91d1a7783bb9 | 271 | LORAMAC_EVENT_INFO_STATUS_RX2_ERROR, |
mluis | 0:91d1a7783bb9 | 272 | LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL, |
mluis | 0:91d1a7783bb9 | 273 | LORAMAC_EVENT_INFO_STATUS_DOWNLINK_FAIL, |
mluis | 0:91d1a7783bb9 | 274 | LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL, |
mluis | 0:91d1a7783bb9 | 275 | LORAMAC_EVENT_INFO_STATUS_MIC_FAIL, |
mluis | 0:91d1a7783bb9 | 276 | }LoRaMacEventInfoStatus_t; |
mluis | 0:91d1a7783bb9 | 277 | |
mluis | 0:91d1a7783bb9 | 278 | /*! |
mluis | 0:91d1a7783bb9 | 279 | * LoRaMAC event information |
mluis | 0:91d1a7783bb9 | 280 | */ |
mluis | 0:91d1a7783bb9 | 281 | typedef struct |
mluis | 0:91d1a7783bb9 | 282 | { |
mluis | 0:91d1a7783bb9 | 283 | LoRaMacEventInfoStatus_t Status; |
mluis | 0:91d1a7783bb9 | 284 | bool TxAckReceived; |
mluis | 0:91d1a7783bb9 | 285 | uint8_t TxNbRetries; |
mluis | 0:91d1a7783bb9 | 286 | uint8_t TxDatarate; |
mluis | 0:91d1a7783bb9 | 287 | uint8_t RxPort; |
mluis | 0:91d1a7783bb9 | 288 | uint8_t *RxBuffer; |
mluis | 0:91d1a7783bb9 | 289 | uint8_t RxBufferSize; |
mluis | 0:91d1a7783bb9 | 290 | int16_t RxRssi; |
mluis | 0:91d1a7783bb9 | 291 | uint8_t RxSnr; |
mluis | 0:91d1a7783bb9 | 292 | uint16_t Energy; |
mluis | 0:91d1a7783bb9 | 293 | uint8_t DemodMargin; |
mluis | 0:91d1a7783bb9 | 294 | uint8_t NbGateways; |
mluis | 0:91d1a7783bb9 | 295 | }LoRaMacEventInfo_t; |
mluis | 0:91d1a7783bb9 | 296 | |
mluis | 0:91d1a7783bb9 | 297 | /*! |
mluis | 0:91d1a7783bb9 | 298 | * LoRaMAC events structure |
mluis | 0:91d1a7783bb9 | 299 | * Used to notify upper layers of MAC events |
mluis | 0:91d1a7783bb9 | 300 | */ |
mluis | 1:91e4e6c60d1e | 301 | typedef struct sLoRaMacCallbacks |
mluis | 0:91d1a7783bb9 | 302 | { |
mluis | 0:91d1a7783bb9 | 303 | /*! |
mluis | 0:91d1a7783bb9 | 304 | * MAC layer event callback prototype. |
mluis | 0:91d1a7783bb9 | 305 | * |
mluis | 0:91d1a7783bb9 | 306 | * \param [IN] flags Bit field indicating the MAC events occurred |
mluis | 0:91d1a7783bb9 | 307 | * \param [IN] info Details about MAC events occurred |
mluis | 0:91d1a7783bb9 | 308 | */ |
mluis | 0:91d1a7783bb9 | 309 | void ( *MacEvent )( LoRaMacEventFlags_t *flags, LoRaMacEventInfo_t *info ); |
mluis | 1:91e4e6c60d1e | 310 | /*! |
mluis | 1:91e4e6c60d1e | 311 | * Function callback to get the current battery level |
mluis | 1:91e4e6c60d1e | 312 | * |
mluis | 1:91e4e6c60d1e | 313 | * \retval batteryLevel Current battery level |
mluis | 1:91e4e6c60d1e | 314 | */ |
mluis | 1:91e4e6c60d1e | 315 | uint8_t ( *GetBatteryLevel )( void ); |
mluis | 1:91e4e6c60d1e | 316 | }LoRaMacCallbacks_t; |
mluis | 0:91d1a7783bb9 | 317 | |
mluis | 0:91d1a7783bb9 | 318 | /*! |
mluis | 0:91d1a7783bb9 | 319 | * LoRaMAC layer initialization |
mluis | 0:91d1a7783bb9 | 320 | * |
mluis | 1:91e4e6c60d1e | 321 | * \param [IN] callabcks Pointer to a structure defining the LoRaMAC |
mluis | 0:91d1a7783bb9 | 322 | * callback functions. |
mluis | 0:91d1a7783bb9 | 323 | */ |
mluis | 1:91e4e6c60d1e | 324 | void LoRaMacInit( LoRaMacCallbacks_t *callabcks ); |
mluis | 0:91d1a7783bb9 | 325 | |
mluis | 0:91d1a7783bb9 | 326 | /*! |
mluis | 0:91d1a7783bb9 | 327 | * Enables/Disables the ADR (Adaptive Data Rate) |
mluis | 0:91d1a7783bb9 | 328 | * |
mluis | 0:91d1a7783bb9 | 329 | * \param [IN] enable [true: ADR ON, false: ADR OFF] |
mluis | 0:91d1a7783bb9 | 330 | */ |
mluis | 0:91d1a7783bb9 | 331 | void LoRaMacSetAdrOn( bool enable ); |
mluis | 0:91d1a7783bb9 | 332 | |
mluis | 0:91d1a7783bb9 | 333 | /*! |
mluis | 0:91d1a7783bb9 | 334 | * Initializes the network IDs. Device address, |
mluis | 0:91d1a7783bb9 | 335 | * network session AES128 key and application session AES128 key. |
mluis | 0:91d1a7783bb9 | 336 | * |
mluis | 0:91d1a7783bb9 | 337 | * \remark To be only used when Over-the-Air activation isn't used. |
mluis | 0:91d1a7783bb9 | 338 | * |
mluis | 0:91d1a7783bb9 | 339 | * \param [IN] netID 24 bits network identifier |
mluis | 0:91d1a7783bb9 | 340 | * ( provided by network operator ) |
mluis | 0:91d1a7783bb9 | 341 | * \param [IN] devAddr 32 bits device address on the network |
mluis | 0:91d1a7783bb9 | 342 | * (must be unique to the network) |
mluis | 0:91d1a7783bb9 | 343 | * \param [IN] nwkSKey Pointer to the network session AES128 key array |
mluis | 0:91d1a7783bb9 | 344 | * ( 16 bytes ) |
mluis | 0:91d1a7783bb9 | 345 | * \param [IN] appSKey Pointer to the application session AES128 key array |
mluis | 0:91d1a7783bb9 | 346 | * ( 16 bytes ) |
mluis | 0:91d1a7783bb9 | 347 | */ |
mluis | 0:91d1a7783bb9 | 348 | void LoRaMacInitNwkIds( uint32_t netID, uint32_t devAddr, uint8_t *nwkSKey, uint8_t *appSKey ); |
mluis | 0:91d1a7783bb9 | 349 | |
mluis | 0:91d1a7783bb9 | 350 | /* |
mluis | 0:91d1a7783bb9 | 351 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 352 | */ |
mluis | 0:91d1a7783bb9 | 353 | void LoRaMacMulticastChannelAdd( MulticastParams_t *channelParam ); |
mluis | 0:91d1a7783bb9 | 354 | |
mluis | 0:91d1a7783bb9 | 355 | /* |
mluis | 0:91d1a7783bb9 | 356 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 357 | */ |
mluis | 0:91d1a7783bb9 | 358 | void LoRaMacMulticastChannelRemove( MulticastParams_t *channelParam ); |
mluis | 0:91d1a7783bb9 | 359 | |
mluis | 0:91d1a7783bb9 | 360 | /*! |
mluis | 0:91d1a7783bb9 | 361 | * Initiates the Over-the-Air activation |
mluis | 0:91d1a7783bb9 | 362 | * |
mluis | 0:91d1a7783bb9 | 363 | * \param [IN] devEui Pointer to the device EUI array ( 8 bytes ) |
mluis | 0:91d1a7783bb9 | 364 | * \param [IN] appEui Pointer to the application EUI array ( 8 bytes ) |
mluis | 0:91d1a7783bb9 | 365 | * \param [IN] appKey Pointer to the application AES128 key array ( 16 bytes ) |
mluis | 0:91d1a7783bb9 | 366 | * |
mluis | 0:91d1a7783bb9 | 367 | * \retval status [0: OK, 1: Tx error, 2: Already joined a network] |
mluis | 0:91d1a7783bb9 | 368 | */ |
mluis | 0:91d1a7783bb9 | 369 | uint8_t LoRaMacJoinReq( uint8_t *devEui, uint8_t *appEui, uint8_t *appKey ); |
mluis | 0:91d1a7783bb9 | 370 | |
mluis | 0:91d1a7783bb9 | 371 | /*! |
mluis | 0:91d1a7783bb9 | 372 | * Sends a LinkCheckReq MAC command on the next uplink frame |
mluis | 0:91d1a7783bb9 | 373 | * |
mluis | 0:91d1a7783bb9 | 374 | * \retval status Function status [0: OK, 1: Busy] |
mluis | 0:91d1a7783bb9 | 375 | */ |
mluis | 0:91d1a7783bb9 | 376 | uint8_t LoRaMacLinkCheckReq( void ); |
mluis | 0:91d1a7783bb9 | 377 | |
mluis | 0:91d1a7783bb9 | 378 | /*! |
mluis | 0:91d1a7783bb9 | 379 | * LoRaMAC layer send frame |
mluis | 0:91d1a7783bb9 | 380 | * |
mluis | 0:91d1a7783bb9 | 381 | * \param [IN] fPort MAC payload port (must be > 0) |
mluis | 0:91d1a7783bb9 | 382 | * \param [IN] fBuffer MAC data buffer to be sent |
mluis | 0:91d1a7783bb9 | 383 | * \param [IN] fBufferSize MAC data buffer size |
mluis | 0:91d1a7783bb9 | 384 | * |
mluis | 0:91d1a7783bb9 | 385 | * \retval status [0: OK, 1: Busy, 2: No network joined, |
mluis | 0:91d1a7783bb9 | 386 | * 3: Length or port error, 4: Unknown MAC command |
mluis | 0:91d1a7783bb9 | 387 | * 5: Unable to find a free channel |
mluis | 0:91d1a7783bb9 | 388 | * 6: Device switched off] |
mluis | 0:91d1a7783bb9 | 389 | */ |
mluis | 0:91d1a7783bb9 | 390 | uint8_t LoRaMacSendFrame( uint8_t fPort, void *fBuffer, uint16_t fBufferSize ); |
mluis | 0:91d1a7783bb9 | 391 | |
mluis | 0:91d1a7783bb9 | 392 | /*! |
mluis | 0:91d1a7783bb9 | 393 | * LoRaMAC layer send frame |
mluis | 0:91d1a7783bb9 | 394 | * |
mluis | 0:91d1a7783bb9 | 395 | * \param [IN] fPort MAC payload port (must be > 0) |
mluis | 0:91d1a7783bb9 | 396 | * \param [IN] fBuffer MAC data buffer to be sent |
mluis | 0:91d1a7783bb9 | 397 | * \param [IN] fBufferSize MAC data buffer size |
mluis | 0:91d1a7783bb9 | 398 | * \param [IN] fBufferSize MAC data buffer size |
mluis | 0:91d1a7783bb9 | 399 | * \param [IN] nbRetries Number of retries to receive the acknowledgement |
mluis | 0:91d1a7783bb9 | 400 | * |
mluis | 0:91d1a7783bb9 | 401 | * \retval status [0: OK, 1: Busy, 2: No network joined, |
mluis | 0:91d1a7783bb9 | 402 | * 3: Length or port error, 4: Unknown MAC command |
mluis | 0:91d1a7783bb9 | 403 | * 5: Unable to find a free channel |
mluis | 0:91d1a7783bb9 | 404 | * 6: Device switched off] |
mluis | 0:91d1a7783bb9 | 405 | */ |
mluis | 0:91d1a7783bb9 | 406 | uint8_t LoRaMacSendConfirmedFrame( uint8_t fPort, void *fBuffer, uint16_t fBufferSize, uint8_t nbRetries ); |
mluis | 0:91d1a7783bb9 | 407 | |
mluis | 0:91d1a7783bb9 | 408 | /*! |
mluis | 0:91d1a7783bb9 | 409 | * ============================================================================ |
mluis | 0:91d1a7783bb9 | 410 | * = LoRaMac test functions = |
mluis | 0:91d1a7783bb9 | 411 | * ============================================================================ |
mluis | 0:91d1a7783bb9 | 412 | */ |
mluis | 0:91d1a7783bb9 | 413 | |
mluis | 0:91d1a7783bb9 | 414 | /*! |
mluis | 0:91d1a7783bb9 | 415 | * LoRaMAC layer generic send frame |
mluis | 0:91d1a7783bb9 | 416 | * |
mluis | 0:91d1a7783bb9 | 417 | * \param [IN] macHdr MAC header field |
mluis | 0:91d1a7783bb9 | 418 | * \param [IN] fOpts MAC commands buffer |
mluis | 0:91d1a7783bb9 | 419 | * \param [IN] fPort MAC payload port |
mluis | 0:91d1a7783bb9 | 420 | * \param [IN] fBuffer MAC data buffer to be sent |
mluis | 0:91d1a7783bb9 | 421 | * \param [IN] fBufferSize MAC data buffer size |
mluis | 0:91d1a7783bb9 | 422 | * \retval status [0: OK, 1: Busy, 2: No network joined, |
mluis | 0:91d1a7783bb9 | 423 | * 3: Length or port error, 4: Unknown MAC command |
mluis | 0:91d1a7783bb9 | 424 | * 5: Unable to find a free channel |
mluis | 0:91d1a7783bb9 | 425 | * 6: Device switched off] |
mluis | 0:91d1a7783bb9 | 426 | */ |
mluis | 0:91d1a7783bb9 | 427 | uint8_t LoRaMacSend( LoRaMacHeader_t *macHdr, uint8_t *fOpts, uint8_t fPort, void *fBuffer, uint16_t fBufferSize ); |
mluis | 0:91d1a7783bb9 | 428 | |
mluis | 0:91d1a7783bb9 | 429 | /*! |
mluis | 0:91d1a7783bb9 | 430 | * LoRaMAC layer frame buffer initialization. |
mluis | 0:91d1a7783bb9 | 431 | * |
mluis | 0:91d1a7783bb9 | 432 | * \param [IN] channel Channel parameters |
mluis | 0:91d1a7783bb9 | 433 | * \param [IN] macHdr MAC header field |
mluis | 0:91d1a7783bb9 | 434 | * \param [IN] fCtrl MAC frame control field |
mluis | 0:91d1a7783bb9 | 435 | * \param [IN] fOpts MAC commands buffer |
mluis | 0:91d1a7783bb9 | 436 | * \param [IN] fPort MAC payload port |
mluis | 0:91d1a7783bb9 | 437 | * \param [IN] fBuffer MAC data buffer to be sent |
mluis | 0:91d1a7783bb9 | 438 | * \param [IN] fBufferSize MAC data buffer size |
mluis | 0:91d1a7783bb9 | 439 | * \retval status [0: OK, 1: N/A, 2: No network joined, |
mluis | 0:91d1a7783bb9 | 440 | * 3: Length or port error, 4: Unknown MAC command] |
mluis | 0:91d1a7783bb9 | 441 | */ |
mluis | 0:91d1a7783bb9 | 442 | uint8_t LoRaMacPrepareFrame( ChannelParams_t channel,LoRaMacHeader_t *macHdr, LoRaMacFrameCtrl_t *fCtrl, uint8_t *fOpts, uint8_t fPort, void *fBuffer, uint16_t fBufferSize ); |
mluis | 0:91d1a7783bb9 | 443 | |
mluis | 0:91d1a7783bb9 | 444 | /*! |
mluis | 0:91d1a7783bb9 | 445 | * LoRaMAC layer prepared frame buffer transmission with channel specification |
mluis | 0:91d1a7783bb9 | 446 | * |
mluis | 0:91d1a7783bb9 | 447 | * \remark LoRaMacPrepareFrame must be called at least once before calling this |
mluis | 0:91d1a7783bb9 | 448 | * function. |
mluis | 0:91d1a7783bb9 | 449 | * |
mluis | 0:91d1a7783bb9 | 450 | * \param [IN] channel Channel parameters |
mluis | 0:91d1a7783bb9 | 451 | * \retval status [0: OK, 1: Busy] |
mluis | 0:91d1a7783bb9 | 452 | */ |
mluis | 0:91d1a7783bb9 | 453 | uint8_t LoRaMacSendFrameOnChannel( ChannelParams_t channel ); |
mluis | 0:91d1a7783bb9 | 454 | |
mluis | 0:91d1a7783bb9 | 455 | /*! |
mluis | 0:91d1a7783bb9 | 456 | * LoRaMAC layer generic send frame with channel specification |
mluis | 0:91d1a7783bb9 | 457 | * |
mluis | 0:91d1a7783bb9 | 458 | * \param [IN] channel Channel parameters |
mluis | 0:91d1a7783bb9 | 459 | * \param [IN] macHdr MAC header field |
mluis | 0:91d1a7783bb9 | 460 | * \param [IN] fCtrl MAC frame control field |
mluis | 0:91d1a7783bb9 | 461 | * \param [IN] fOpts MAC commands buffer |
mluis | 0:91d1a7783bb9 | 462 | * \param [IN] fPort MAC payload port |
mluis | 0:91d1a7783bb9 | 463 | * \param [IN] fBuffer MAC data buffer to be sent |
mluis | 0:91d1a7783bb9 | 464 | * \param [IN] fBufferSize MAC data buffer size |
mluis | 0:91d1a7783bb9 | 465 | * \retval status [0: OK, 1: Busy, 2: No network joined, |
mluis | 0:91d1a7783bb9 | 466 | * 3: Length or port error, 4: Unknown MAC command] |
mluis | 0:91d1a7783bb9 | 467 | */ |
mluis | 0:91d1a7783bb9 | 468 | uint8_t LoRaMacSendOnChannel( ChannelParams_t channel, LoRaMacHeader_t *macHdr, LoRaMacFrameCtrl_t *fCtrl, uint8_t *fOpts, uint8_t fPort, void *fBuffer, uint16_t fBufferSize ); |
mluis | 0:91d1a7783bb9 | 469 | |
mluis | 0:91d1a7783bb9 | 470 | /*! |
mluis | 0:91d1a7783bb9 | 471 | * ============================================================================ |
mluis | 0:91d1a7783bb9 | 472 | * = LoRaMac setup functions = |
mluis | 0:91d1a7783bb9 | 473 | * ============================================================================ |
mluis | 0:91d1a7783bb9 | 474 | */ |
mluis | 0:91d1a7783bb9 | 475 | |
mluis | 0:91d1a7783bb9 | 476 | /* |
mluis | 0:91d1a7783bb9 | 477 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 478 | */ |
mluis | 0:91d1a7783bb9 | 479 | void LoRaMacSetDeviceClass( DeviceClass_t deviceClass ); |
mluis | 0:91d1a7783bb9 | 480 | |
mluis | 0:91d1a7783bb9 | 481 | /* |
mluis | 0:91d1a7783bb9 | 482 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 483 | */ |
mluis | 0:91d1a7783bb9 | 484 | void LoRaMacSetPublicNetwork( bool enable ); |
mluis | 0:91d1a7783bb9 | 485 | |
mluis | 0:91d1a7783bb9 | 486 | /* |
mluis | 0:91d1a7783bb9 | 487 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 488 | */ |
mluis | 0:91d1a7783bb9 | 489 | void LoRaMacSetChannel( uint8_t id, ChannelParams_t params ); |
mluis | 0:91d1a7783bb9 | 490 | |
mluis | 0:91d1a7783bb9 | 491 | /* |
mluis | 0:91d1a7783bb9 | 492 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 493 | */ |
mluis | 0:91d1a7783bb9 | 494 | void LoRaMacSetRx2Channel( Rx2ChannelParams_t param ); |
mluis | 0:91d1a7783bb9 | 495 | |
mluis | 0:91d1a7783bb9 | 496 | /*! |
mluis | 0:91d1a7783bb9 | 497 | * Sets channels tx output power |
mluis | 0:91d1a7783bb9 | 498 | * |
mluis | 0:91d1a7783bb9 | 499 | * \param [IN] txPower [TX_POWER_20_DBM, TX_POWER_14_DBM, |
mluis | 0:91d1a7783bb9 | 500 | TX_POWER_11_DBM, TX_POWER_08_DBM, |
mluis | 0:91d1a7783bb9 | 501 | TX_POWER_05_DBM, TX_POWER_02_DBM] |
mluis | 0:91d1a7783bb9 | 502 | */ |
mluis | 0:91d1a7783bb9 | 503 | void LoRaMacSetChannelsTxPower( int8_t txPower ); |
mluis | 0:91d1a7783bb9 | 504 | |
mluis | 0:91d1a7783bb9 | 505 | /*! |
mluis | 0:91d1a7783bb9 | 506 | * Sets channels datarate |
mluis | 0:91d1a7783bb9 | 507 | * |
mluis | 0:91d1a7783bb9 | 508 | * \param [IN] datarate eu868 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_5, DR_6, DR_7] |
mluis | 0:91d1a7783bb9 | 509 | * us915 - [DR_0, DR_1, DR_2, DR_3, DR_4] |
mluis | 0:91d1a7783bb9 | 510 | */ |
mluis | 0:91d1a7783bb9 | 511 | void LoRaMacSetChannelsDatarate( int8_t datarate ); |
mluis | 0:91d1a7783bb9 | 512 | |
mluis | 0:91d1a7783bb9 | 513 | /* |
mluis | 0:91d1a7783bb9 | 514 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 515 | */ |
mluis | 0:91d1a7783bb9 | 516 | void LoRaMacSetChannelsMask( uint16_t *mask ); |
mluis | 0:91d1a7783bb9 | 517 | |
mluis | 0:91d1a7783bb9 | 518 | /* |
mluis | 0:91d1a7783bb9 | 519 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 520 | */ |
mluis | 0:91d1a7783bb9 | 521 | void LoRaMacSetChannelsNbRep( uint8_t nbRep ); |
mluis | 0:91d1a7783bb9 | 522 | |
mluis | 0:91d1a7783bb9 | 523 | /* |
mluis | 0:91d1a7783bb9 | 524 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 525 | */ |
mluis | 0:91d1a7783bb9 | 526 | void LoRaMacSetMaxRxWindow( uint32_t delay ); |
mluis | 0:91d1a7783bb9 | 527 | |
mluis | 0:91d1a7783bb9 | 528 | /* |
mluis | 0:91d1a7783bb9 | 529 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 530 | */ |
mluis | 0:91d1a7783bb9 | 531 | void LoRaMacSetReceiveDelay1( uint32_t delay ); |
mluis | 0:91d1a7783bb9 | 532 | |
mluis | 0:91d1a7783bb9 | 533 | /* |
mluis | 0:91d1a7783bb9 | 534 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 535 | */ |
mluis | 0:91d1a7783bb9 | 536 | void LoRaMacSetReceiveDelay2( uint32_t delay ); |
mluis | 0:91d1a7783bb9 | 537 | |
mluis | 0:91d1a7783bb9 | 538 | /* |
mluis | 0:91d1a7783bb9 | 539 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 540 | */ |
mluis | 0:91d1a7783bb9 | 541 | void LoRaMacSetJoinAcceptDelay1( uint32_t delay ); |
mluis | 0:91d1a7783bb9 | 542 | |
mluis | 0:91d1a7783bb9 | 543 | /* |
mluis | 0:91d1a7783bb9 | 544 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 545 | */ |
mluis | 0:91d1a7783bb9 | 546 | void LoRaMacSetJoinAcceptDelay2( uint32_t delay ); |
mluis | 0:91d1a7783bb9 | 547 | |
mluis | 0:91d1a7783bb9 | 548 | /* |
mluis | 0:91d1a7783bb9 | 549 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 550 | */ |
mluis | 0:91d1a7783bb9 | 551 | uint32_t LoRaMacGetUpLinkCounter( void ); |
mluis | 0:91d1a7783bb9 | 552 | |
mluis | 0:91d1a7783bb9 | 553 | /* |
mluis | 0:91d1a7783bb9 | 554 | * TODO: Add documentation |
mluis | 0:91d1a7783bb9 | 555 | */ |
mluis | 0:91d1a7783bb9 | 556 | uint32_t LoRaMacGetDownLinkCounter( void ); |
mluis | 0:91d1a7783bb9 | 557 | |
mluis | 0:91d1a7783bb9 | 558 | /* |
mluis | 0:91d1a7783bb9 | 559 | * ============================================================================ |
mluis | 0:91d1a7783bb9 | 560 | * = LoRaMac test functions = |
mluis | 0:91d1a7783bb9 | 561 | * ============================================================================ |
mluis | 0:91d1a7783bb9 | 562 | */ |
mluis | 0:91d1a7783bb9 | 563 | |
mluis | 0:91d1a7783bb9 | 564 | /*! |
mluis | 0:91d1a7783bb9 | 565 | * Disables/Enables the duty cycle enforcement (EU868) |
mluis | 0:91d1a7783bb9 | 566 | * |
mluis | 0:91d1a7783bb9 | 567 | * \param [IN] enable - Enabled or disables the duty cycle |
mluis | 0:91d1a7783bb9 | 568 | */ |
mluis | 0:91d1a7783bb9 | 569 | void LoRaMacTestSetDutyCycleOn( bool enable ); |
mluis | 0:91d1a7783bb9 | 570 | |
mluis | 0:91d1a7783bb9 | 571 | /*! |
mluis | 0:91d1a7783bb9 | 572 | * Disables/Enables the reception windows opening |
mluis | 0:91d1a7783bb9 | 573 | * |
mluis | 0:91d1a7783bb9 | 574 | * \param [IN] enable [true: enable, false: disable] |
mluis | 0:91d1a7783bb9 | 575 | */ |
mluis | 0:91d1a7783bb9 | 576 | void LoRaMacTestRxWindowsOn( bool enable ); |
mluis | 0:91d1a7783bb9 | 577 | |
mluis | 0:91d1a7783bb9 | 578 | /*! |
mluis | 0:91d1a7783bb9 | 579 | * Enables the MIC field test |
mluis | 0:91d1a7783bb9 | 580 | * |
mluis | 0:91d1a7783bb9 | 581 | * \param [IN] upLinkCounter Fixed Tx packet counter value |
mluis | 0:91d1a7783bb9 | 582 | */ |
mluis | 0:91d1a7783bb9 | 583 | void LoRaMacTestSetMic( uint16_t upLinkCounter ); |
mluis | 0:91d1a7783bb9 | 584 | |
mluis | 0:91d1a7783bb9 | 585 | #endif // __LORAMAC_H__ |