Onethinx LoRaWAN module
Functions

Onethinx LoRaWAN Functions. More...

Functions

coreStatus_t LoRaWAN_Reset (void)
 This function forces the current non-blocking function to stop. More...
 
coreStatus_t LoRaWAN_Init (coreConfiguration_t *coreConfigurationPtr)
 Initializes the LoRaWAN stack and points the stack to the location of the settings. More...
 
coreStatus_t LoRaWAN_GetInfo (coreInfo_t *coreInfo)
 This function gives the stack information which were saved at the time of the programming. More...
 
coreStatus_t LoRaWAN_Join (WaitMode_e waitMode)
 Joins the LoRaWAN network, taking the parameters from the coreConfiguration structure which was passed to LoRaWAN_Init. More...
 
coreStatus_t LoRaWAN_FlashRead (uint8_t *buffer, uint8_t block, uint8_t length)
 This function reads the buffer that was previously saved to flash. More...
 
coreStatus_t LoRaWAN_FlashWrite (uint8_t *buffer, uint8_t block, uint8_t length)
 This function saves a buffer to flash. More...
 
coreStatus_t LoRaWAN_SetDateTime (dateTime_t *dt)
 This function allows the user to set the current date and time. More...
 
coreStatus_t LoRaWAN_GetDateTime (dateTime_t *dt)
 This function allows the user to get the current date and time. More...
 
coreStatus_t LoRaWAN_GetRXdata (uint8_t *RXdata, uint8_t length)
 This function retrieves the specified length of data reveived via downlink from a gateway and saves it to a buffer. More...
 
coreStatus_t LoRaWAN_Send (uint8_t *buffer, uint8_t length, WaitMode_e waitMode)
 This function sends your buffer of data to the LoRaWAN network. More...
 
coreStatus_t LoRaWAN_SendMac (uint8_t *buffer, uint8_t length, WaitMode_e waitMode, MACcmd_e MACcmd)
 This function sends your buffer of data and a MAC command to the LoRaWAN network. More...
 
coreStatus_t LoRaWAN_Sleep (sleepConfig_t *sleepConfig)
 This function allows you to enter a sleep mode. More...
 
coreStatus_t LoRaWAN_GetStatus ()
 This function returns the current error /status. More...
 
errorStatus_t LoRaWAN_GetError ()
 This function returns the current error /status. More...
 

Detailed Description

Onethinx LoRaWAN Functions.

Function Documentation

◆ LoRaWAN_FlashRead()

coreStatus_t LoRaWAN_FlashRead ( uint8_t *  buffer,
uint8_t  block,
uint8_t  length 
)

This function reads the buffer that was previously saved to flash.

This allows user to access the buffer even if reset or power off occures.

Block Data
0 Max 256 bytes
1 Max 256 bytes
2 Max 256 bytes
3 Max 256 bytes
4 Max 256 bytes
5 Max 256 bytes
6 Max 256 bytes
7 Max 256 bytes
Parameters
bufferPointer to the buffer where the data read from flash will be saved to.
blockBlock from which the data is read from. Available blocks: 0 to 7
lengthLength of data which you wish to read. Maximum 255 bytes.
Returns
Returns error / status code.
See also
LoRaWAN_FlashWrite and coreStatus_t

◆ LoRaWAN_FlashWrite()

coreStatus_t LoRaWAN_FlashWrite ( uint8_t *  buffer,
uint8_t  block,
uint8_t  length 
)

This function saves a buffer to flash.

This allows user to access the buffer even if reset or power off occures.

Block Data
0 Max 256 bytes
1 Max 256 bytes
2 Max 256 bytes
3 Max 256 bytes
4 Max 256 bytes
5 Max 256 bytes
6 Max 256 bytes
7 Max 256 bytes
Parameters
bufferPointer to the data which needs to be saved.
blockBlock to which the data should be saved to. Available blocks: 0 to 7
lengthLength of data which you wish saved. Maximum 255 bytes.
Returns
Returns error / status code.
See also
LoRaWAN_FlashRead and coreStatus_t

◆ LoRaWAN_GetDateTime()

coreStatus_t LoRaWAN_GetDateTime ( dateTime_t dt)

This function allows the user to get the current date and time.

Parameters
dtPoint to the location where date and time data is saved.
Returns
Returns error / status code.
See also
dateTime_t and coreStatus_t

◆ LoRaWAN_GetError()

errorStatus_t LoRaWAN_GetError ( )

This function returns the current error /status.

Returns
Returns error codes.
See also
errorStatus_t

◆ LoRaWAN_GetInfo()

coreStatus_t LoRaWAN_GetInfo ( coreInfo_t coreInfo)

This function gives the stack information which were saved at the time of the programming.

Parameters
coreInfoPointer to the location where info will be saved.
Returns
Returns error / status code. (coreStatus_t)

◆ LoRaWAN_GetRXdata()

coreStatus_t LoRaWAN_GetRXdata ( uint8_t *  RXdata,
uint8_t  length 
)

This function retrieves the specified length of data reveived via downlink from a gateway and saves it to a buffer.

The lenght of data can be retrieved after a succesful LoRaWAN_Send, through the status structure it returns

Parameters
RXdataPointer to the byte buffer to which the data is retrieved to.
lengthLength of data which you wish saved. The length of data received can be seen after LoRaWAN_Send in coreStatus.mac.bytesToRead
Returns
Returns error / status code.
See also
LoRaWAN_Send and coreStatus_t

◆ LoRaWAN_GetStatus()

coreStatus_t LoRaWAN_GetStatus ( )

This function returns the current error /status.

Returns
Returns error / status code. (coreStatus_t)

◆ LoRaWAN_Init()

coreStatus_t LoRaWAN_Init ( coreConfiguration_t coreConfigurationPtr)

Initializes the LoRaWAN stack and points the stack to the location of the settings.

Parameters
coreConfigurationPtrPointer to the structure where LoRaWAN parameters are set.
Returns
Returns error / status code. (coreStatus_t)

◆ LoRaWAN_Join()

coreStatus_t LoRaWAN_Join ( WaitMode_e  waitMode)

Joins the LoRaWAN network, taking the parameters from the coreConfiguration structure which was passed to LoRaWAN_Init.

Parameters
waitModeType of wait mode that the microcontroller core should wait in.
Mode Description
M4_NoWait Non-blocking. Do not wait untill stack is finished, M4 continues with operation.
M4_WaitActive Blocking. Wait while stack busy, M4 stays in Active mode.
M4_WaitSleep Blocking. Wait while stack busy, M4 goes into Sleep while is stack busy.
M4_WaitDeepSleep Blocking. Wait while stack busy, M4 goes into DeepSleep while is stack busy.
Returns
Returns error / status code.
See also
WaitMode_e and coreStatus_t

◆ LoRaWAN_Reset()

coreStatus_t LoRaWAN_Reset ( void  )

This function forces the current non-blocking function to stop.

Functions which receive waitMode_t can be set at both blocking and non-blocking.

Returns
Returns error / status code. (coreStatus_t)

◆ LoRaWAN_Send()

coreStatus_t LoRaWAN_Send ( uint8_t *  buffer,
uint8_t  length,
WaitMode_e  waitMode 
)

This function sends your buffer of data to the LoRaWAN network.

Parameters
bufferPointer to the data which needs to be sent.
lengthLength of data which you wish to send.
waitModeType of wait mode that the microcontroller core should wait in.
Returns
Returns error / status code. (coreStatus_t)
See also
WaitMode_e and coreStatus_t

◆ LoRaWAN_SendMac()

coreStatus_t LoRaWAN_SendMac ( uint8_t *  buffer,
uint8_t  length,
WaitMode_e  waitMode,
MACcmd_e  MACcmd 
)

This function sends your buffer of data and a MAC command to the LoRaWAN network.

It is similar to LoRaWAN_Send, but this also sends a MAC command.

Parameters
bufferPointer to the data which needs to be sent.
lengthLength of data which you wish to send.
waitModeType of wait mode that the microcontroller core should wait in.
MACcmdMAC command to be sent to the LoRaWAN network.
See also
WaitMode_e, MACcmd_e and coreStatus_t

◆ LoRaWAN_SetDateTime()

coreStatus_t LoRaWAN_SetDateTime ( dateTime_t dt)

This function allows the user to set the current date and time.

Parameters
dtPoint to the location where date and time data is saved.
Returns
Returns error / status code.
See also
dateTime_t and coreStatus_t

◆ LoRaWAN_Sleep()

coreStatus_t LoRaWAN_Sleep ( sleepConfig_t sleepConfig)

This function allows you to enter a sleep mode.

Parameters
sleepConfigPointer to the sleep configuration structure.
Returns
Returns error / status code.
See also
sleepConfig_t and coreStatus_t