IoT Drivers  v3.3.0 (S2022)
Engineering in Software Technology
lora_driver.h File Reference

Driver to MicroChip RN2483 LoRaWAN module. More...

#include <stdbool.h>
#include <ATMEGA_FreeRTOS.h>
#include <message_buffer.h>
#include <serial.h>
Include dependency graph for lora_driver.h:

Go to the source code of this file.

Data Structures

struct  lora_driver_payload
 Payload data structure. More...
 

Macros

#define LORA_MAX_PAYLOAD_LENGTH   20 /* bytes - Must newer be changed!!!*/
 

Typedefs

typedef struct lora_driver_payload lora_driver_payload_t
 Payload data structure. More...
 
typedef enum Lora_driver_returnCodes lora_driver_returnCode_t
 LoRA Driver return codes. More...
 
typedef enum lora_driver_joinModes lora_driver_joinMode_t
 Join modes. More...
 
typedef enum lora_driver_adaptiveDataRateModes lora_driver_adaptiveDataRate_t
 Adaptive data rates (ADR) modes. More...
 
typedef enum lora_driver_automaticReplyModes lora_driver_automaticReplyMode_t
 Automatic Reply (AR) modes. More...
 

Enumerations

enum  Lora_driver_returnCodes {
  LORA_OK, LORA_ERROR, LORA_KEYS_NOT_INIT, LORA_NO_FREE_CH,
  LORA_SILENT, LORA_BUSY, LORA_MAC_PAUSED, LORA_DENIED,
  LORA_ACCEPTED, LORA_INVALID_PARAM, LORA_NOT_JOINED, LORA_INVALID_DATA_LEN,
  LORA_FRAME_COUNTER_ERR_REJOIN_NEEDED, LORA_MAC_TX_OK, LORA_MAC_RX, LORA_MAC_ERROR,
  LORA_UNKNOWN
}
 LoRA Driver return codes. More...
 
enum  lora_driver_joinModes { LORA_OTAA = 0, LORA_ABP }
 Join modes. More...
 
enum  lora_driver_adaptiveDataRateModes { LORA_OFF = 0, LORA_ON }
 Adaptive data rates (ADR) modes. More...
 
enum  lora_driver_automaticReplyModes { LORA_AR_ON, LORA_AR_OFF }
 Automatic Reply (AR) modes. More...
 

Functions

uint8_t lora_driver_getMaxPayloadSize (void)
 Get max payload size in bytes. More...
 
void lora_driver_initialise (serial_comPort_t comPort, MessageBufferHandle_t downlinkMessageBuffer)
 Initialise the LoRa driver.. More...
 
lora_driver_returnCode_t lora_driver_setOtaaIdentity (char appEUI[17], char appKEY[33], char devEUI[17])
 Set identifiers and keys for a OTAA join. More...
 
lora_driver_returnCode_t lora_driver_configureToEu868 (void)
 Set the driver up to using EU868 standard. More...
 
char * lora_driver_mapReturnCodeToText (lora_driver_returnCode_t returnCode)
 Map a LoRa Driver return code into corresponding text. More...
 
lora_driver_returnCode_t lora_driver_setAbpIdentity (char nwkSKEY[33], char appSKEY[33], char devADD[9])
 Set identifiers and keys for a ABP join. More...
 
lora_driver_returnCode_t lora_driver_join (lora_driver_joinMode_t mode)
 Joins a LoRaWAN either with ABP or OTAA. More...
 
lora_driver_returnCode_t lora_driver_sendUploadMessage (bool confirmed, lora_driver_payload_t *payload)
 Send a upload message to the LoRaWAN. More...
 
lora_driver_returnCode_t lora_driver_setDeviceIdentifier (const char devEUI[17])
 Set the device EUI. More...
 
lora_driver_returnCode_t lora_driver_setApplicationIdentifier (const char appEUI[17])
 Set the Application EUI. More...
 
lora_driver_returnCode_t lora_driver_setApplicationKey (const char appKey[33])
 Set the Application Key. More...
 
lora_driver_returnCode_t lora_driver_setNetworkSessionKey (const char nwkSKey[33])
 Set the Network Session Key. More...
 
lora_driver_returnCode_t lora_driver_setApplicationSessionKey (const char appSKey[33])
 Set the Application Session Key. More...
 
lora_driver_returnCode_t lora_driver_setDeviceAddress (const char devAddr[9])
 Set the Device address. More...
 
lora_driver_returnCode_t lora_driver_setDataRate (uint8_t dr)
 Set data rate. More...
 
lora_driver_returnCode_t lora_driver_getDataRate (uint8_t *dr)
 Get data rate. More...
 
lora_driver_returnCode_t lora_driver_setAdaptiveDataRate (lora_driver_adaptiveDataRate_t state)
 Set adaptive data rate (ADR). More...
 
lora_driver_returnCode_t lora_driver_getAdaptiveDataRate (lora_driver_adaptiveDataRate_t *state)
 Get adaptive data rate (ADR). More...
 
lora_driver_returnCode_t lora_driver_setReceiveDelay (uint16_t rxDelay1)
 Set the delay between a transmission and the first receiver window. More...
 
lora_driver_returnCode_t lora_driver_setAutomaticReply (lora_driver_automaticReplyMode_t ar)
 Set automatic reply on down link messages. More...
 
lora_driver_returnCode_t lora_driver_getAutomaticReply (lora_driver_automaticReplyMode_t *ar)
 Get automatic reply setting for down link messages. More...
 
lora_driver_returnCode_t lora_driver_setLinkCheckInterval (uint16_t sec)
 Set the delay each link check is performed. More...
 
lora_driver_returnCode_t lora_driver_getLinkCheckResult (uint8_t *no_gwys, uint8_t *margin)
 Get the results of the latest received Link Check. More...
 
lora_driver_returnCode_t lora_driver_setSpreadingFactor (uint8_t sf)
 Set the spreading factor for the communication. More...
 
void lora_driver_resetRn2483 (uint8_t state)
 Controls the reset pin on the RN2483 Module. More...
 
void lora_driver_flushBuffers (void)
 Flush the internal buffers in the driver. More...
 
lora_driver_returnCode_t lora_driver_getRn2483Hweui (char hwDevEUI[17])
 Get the RN2483 factory set devEUI. More...
 
lora_driver_returnCode_t lora_driver_rn2483GetVdd (char mv[5])
 Get the RN2483 modules supply voltage VDD. More...
 
lora_driver_returnCode_t lora_driver_rn2483Reboot (void)
 Reset the RN2483 module. More...
 
lora_driver_returnCode_t lora_driver_rn2483FactoryReset (void)
 Reset the RN2483 module. More...
 
lora_driver_returnCode_t lora_driver_sleep (uint32_t ms)
 Set the RN2384 module in sleep mode for a given periode. More...
 
lora_driver_returnCode_t lora_driver_saveMac (void)
 Save the set parameters into the EEPROM of the RN2483 module. More...
 
lora_driver_returnCode_t lora_driver_pauseMac (void)
 Pause the MAC layer in the RN2483 module. More...
 
lora_driver_returnCode_t lora_driver_resumeMac (void)
 Resume the MAC layer in the RN2483 module. More...
 

Detailed Description

Driver to MicroChip RN2483 LoRaWAN module.

Author
Ib Havn

Macro Definition Documentation

◆ LORA_MAX_PAYLOAD_LENGTH

#define LORA_MAX_PAYLOAD_LENGTH   20 /* bytes - Must newer be changed!!!*/