lr3  2.0.0.0
Functions
Public function

Functions

void lr3_cfg_setup (lr3_cfg_t *cfg)
 Config Object Initialization function. More...
 
LR3_RETVAL lr3_init (lr3_t *ctx, lr3_cfg_t *cfg)
 Initialization function. More...
 
uint8_t lr3_chk_sum (lr3_message_t *cmd)
 Check sum function. More...
 
int32_t lr3_generic_read (lr3_t *ctx, char *data_buf, uint16_t max_len)
 Generic read function. More...
 
void lr3_generic_write (lr3_t *ctx, char *data_buf, uint16_t len)
 Generic write function. More...
 
void lr3_hard_reset (lr3_t *ctx)
 Hardware reset function. More...
 
void lr3_wake_up (lr3_t *ctx, uint8_t state)
 Wake Up function. More...
 
void lr3_set_ind_handler (lr3_t *ctx, lr3_ind_hdl_t hdl)
 Set indication handler function. More...
 
uint8_t lr3_command (lr3_t *ctx, lr3_message_t *msg, lr3_message_t *rsp)
 Command function. More...
 
uint8_t lr3_read_message_process (lr3_t *ctx)
 Process function. More...
 
LR3_RETVAL lr3_soft_reset (lr3_t *ctx)
 Software reset function. More...
 
LR3_RETVAL lr3_factory_reset (lr3_t *ctx)
 Factory reset function. More...
 
LR3_RETVAL lr3_write_eeprom (lr3_t *ctx, uint8_t address, uint8_t n_bytes, uint8_t *data_in)
 EEPROM write function. More...
 
LR3_RETVAL lr3_read_eeprom (lr3_t *ctx, uint8_t address, uint8_t n_bytes, uint8_t *data_out)
 EEPROM read function. More...
 
LR3_RETVAL lr3_get_fw_version (lr3_t *ctx, uint32_t *fw_version)
 Get FW Version function. More...
 
LR3_RETVAL lr3_get_serial_no (lr3_t *ctx, uint32_t *serial_no)
 Get Serial Number function. More...
 
LR3_RETVAL lr3_enable_pairing (lr3_t *ctx, uint8_t state)
 Enable Pairing function. More...
 
LR3_RETVAL lr3_get_network_table_size (lr3_t *ctx)
 Get Network Table Size function. More...
 
LR3_RETVAL lr3_get_network_table_row (lr3_t *ctx, uint8_t index, uint8_t *data_out)
 Get Network Table Row function. More...
 
LR3_RETVAL lr3_delete_network_table_row (lr3_t *ctx, uint8_t *device_id)
 Delete Network Table Row function. More...
 
LR3_RETVAL lr3_delete_all_network_table (lr3_t *ctx)
 Delete All Network Table function. More...
 
LR3_RETVAL lr3_tx_message (lr3_t *ctx, lr3_tx_msg_t *tx_msg)
 Radio frame Transmission function. More...
 
LR3_RETVAL lr3_get_pairing_request (lr3_t *ctx)
 Get Pairing Request function. More...
 
LR3_RETVAL lr3_get_activation_status (lr3_t *ctx, uint8_t *data_out)
 Get Activation Status function. More...
 
LR3_RETVAL lr3_check_link_request (lr3_t *ctx, uint8_t power, uint8_t message_num, uint8_t message_th)
 Radio frame Transmission function. More...
 
LR3_RETVAL lr3_set_app_key (lr3_t *ctx, uint8_t *app_key)
 Set App Key function. More...
 

Detailed Description

Function Documentation

◆ lr3_cfg_setup()

void lr3_cfg_setup ( lr3_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ lr3_check_link_request()

LR3_RETVAL lr3_check_link_request ( lr3_t ctx,
uint8_t  power,
uint8_t  message_num,
uint8_t  message_th 
)

Radio frame Transmission function.

Parameters
ctxClick object.
powerDefines the power, from 2 to 14 dBm (suggested value is 11 dBm)
message_numDefines the number of messages to be transmitted, from 4 to 20 (suggested value is 5)
message_thDefines pass/fail criteria treshold as the number of received messages, from 1 to message_num (suggested value is 4)
Returns
0 - OK, 1 - Device busy, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error

@description Function initiates from END NODE a link check procedure between END NODE and MASTER.

◆ lr3_chk_sum()

uint8_t lr3_chk_sum ( lr3_message_t cmd)

Check sum function.

Parameters
ctxClick object.
cmdCommand structure.
Returns
Sum

@description This function returns sum of all elements in Command structure.

◆ lr3_command()

uint8_t lr3_command ( lr3_t ctx,
lr3_message_t msg,
lr3_message_t rsp 
)

Command function.

Parameters
ctxClick object.
msgPointer to command witch be sent
rspPointer to output where response be placed
Returns
0 - OK, 1 - Check Sum Error

@description Function executes commands and reads response on executed commands. Also checks CRC error report.

◆ lr3_delete_all_network_table()

LR3_RETVAL lr3_delete_all_network_table ( lr3_t ctx)

Delete All Network Table function.

Parameters
ctxClick object.
Returns
0 - OK, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error or Failure

@description Function deletes whole Network Table.

◆ lr3_delete_network_table_row()

LR3_RETVAL lr3_delete_network_table_row ( lr3_t ctx,
uint8_t *  device_id 
)

Delete Network Table Row function.

Parameters
ctxClick object.
device_idPointer to buffer where device ID is placed
Returns
0 - OK, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error or Device not found

@description Function deletes a Network Table row from module Serial Number.

◆ lr3_enable_pairing()

LR3_RETVAL lr3_enable_pairing ( lr3_t ctx,
uint8_t  state 
)

Enable Pairing function.

Parameters
ctxClick object.
state
 
     state = 0 - disable pairing procedure
     state != 0 - enable pairing procedure
Returns
0 - OK, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error

@description Function enables or disables network the pairing procedure.

◆ lr3_factory_reset()

LR3_RETVAL lr3_factory_reset ( lr3_t ctx)

Factory reset function.

Parameters
ctxClick object.
Returns
0 - OK, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error A value different from 0 is ERROR

@description Function performs the recovery of EEPROM default values.

◆ lr3_generic_read()

int32_t lr3_generic_read ( lr3_t ctx,
char *  data_buf,
uint16_t  max_len 
)

Generic read function.

Parameters
ctxClick object.
data_bufData buffer for read data.
max_lenThe maximum length of data that can be read.
Returns
Number of read data.

@description This function read maximum length of data.

◆ lr3_generic_write()

void lr3_generic_write ( lr3_t ctx,
char *  data_buf,
uint16_t  len 
)

Generic write function.

Parameters
lr3Click object.
data_bufData buffer for sends.
lenNumber of bytes for sends.

◆ lr3_get_activation_status()

LR3_RETVAL lr3_get_activation_status ( lr3_t ctx,
uint8_t *  data_out 
)

Get Activation Status function.

Parameters
ctxClick object.
data_outPointer to buffer where MASTER Serial Number (4 bytes) be placed
Returns
0 - Not activated, 1 - Paired to a network, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error

@description Function gets the module activation status.

◆ lr3_get_fw_version()

LR3_RETVAL lr3_get_fw_version ( lr3_t ctx,
uint32_t *  fw_version 
)

Get FW Version function.

Parameters
ctxClick object.
fw_versionPointer to buffer where FW Version be stored
Returns
0 - OK, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error

@description Function gets 32-bit FW version.

◆ lr3_get_network_table_row()

LR3_RETVAL lr3_get_network_table_row ( lr3_t ctx,
uint8_t  index,
uint8_t *  data_out 
)

Get Network Table Row function.

Parameters
ctxClick object.
indexindex of Network Table row and must be between 0 to Table size - 1
data_outPointer to buffer where Network Table row data be stored
Returns
0 - OK, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error

@description Function gets a Network Table row from index. The first 4 bytes is device ID and the fifth byte is the byte received at pairing phase.

◆ lr3_get_network_table_size()

LR3_RETVAL lr3_get_network_table_size ( lr3_t ctx)

Get Network Table Size function.

Parameters
ctxClick object.
Returns
253 - Check Sum Error, 254 - Response Error, 255 - Header Error, or return a Network Table size

@description Function gets from MASTER module the size of Network Table.

◆ lr3_get_pairing_request()

LR3_RETVAL lr3_get_pairing_request ( lr3_t ctx)

Get Pairing Request function.

Parameters
ctxClick object.
Returns
0 - OK, 1 - Busy, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error

@description Function requests a pairing to a network.

◆ lr3_get_serial_no()

LR3_RETVAL lr3_get_serial_no ( lr3_t ctx,
uint32_t *  serial_no 
)

Get Serial Number function.

Parameters
ctxClick object.
serial_noPointer to buffer where Serial Number be stored
Returns
0 - OK, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error

@description Function gets 32-bit Serial Number.

◆ lr3_hard_reset()

void lr3_hard_reset ( lr3_t ctx)

Hardware reset function.

Parameters
ctxClick object.

@description Resets device by setting pin and after that puts device back in normal operation mode.

◆ lr3_init()

LR3_RETVAL lr3_init ( lr3_t ctx,
lr3_cfg_t cfg 
)

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ lr3_read_eeprom()

LR3_RETVAL lr3_read_eeprom ( lr3_t ctx,
uint8_t  address,
uint8_t  n_bytes,
uint8_t *  data_out 
)

EEPROM read function.

Parameters
ctxClick object.
addressEEPROM Address witch from data be read
n_bytesNumber of bytes witch be read (max 254)
data_outPointer to buffer where data be stored
Returns
0 - OK, 252 - Payload Length Error, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error or Data is empty

@description Function reads data from EEPROM.

◆ lr3_read_message_process()

uint8_t lr3_read_message_process ( lr3_t ctx)

Process function.

Parameters
ctxClick object.
Returns
0 - OK, other - ERROR

@description Function executes reading indications and forwards indications to handler.

◆ lr3_set_app_key()

LR3_RETVAL lr3_set_app_key ( lr3_t ctx,
uint8_t *  app_key 
)

Set App Key function.

Parameters
ctxClick object.
app_keyPointer to buffer witch from 16 byte AppKey data be written
Returns
0 - OK, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error

@description Function performs an EEPROM data write 16 byte AppKey data in Little Endian Order, needed for Application encryption customization.

◆ lr3_set_ind_handler()

void lr3_set_ind_handler ( lr3_t ctx,
lr3_ind_hdl_t  hdl 
)

Set indication handler function.

Parameters
ctxClick object.
hdlPointer to void handler function

@description Function reads indications (response) to determined command.

◆ lr3_soft_reset()

LR3_RETVAL lr3_soft_reset ( lr3_t ctx)

Software reset function.

Parameters
ctxClick object.
Returns
0 - OK, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error

@description Function resets module by sending command.

◆ lr3_tx_message()

LR3_RETVAL lr3_tx_message ( lr3_t ctx,
lr3_tx_msg_t tx_msg 
)

Radio frame Transmission function.

Parameters
ctxClick object.
tx_msg
Structure arguments:
  • data_in Pointer to buffer witch from data be sent
  • n_bytes Number of bytes witch be sent (max 253)
  • destination_id Destination device Serial Number (4 bytes)
  • option 0bxxxxxxx0 - Unconfirmed Data Transmission 0bxxxxxxx1 - Confirmed Data Transmission
Returns
 0 - OK, 1 - Device busy, 2 - Device not activated, 252 - Payload Length Error,  

253 - Check Sum Error, 254 - Response Error, 255 - Header Error

@description Function performs the transmission of radio frames.

◆ lr3_wake_up()

void lr3_wake_up ( lr3_t ctx,
uint8_t  state 
)

Wake Up function.

Parameters
ctxClick object.
state0 - wake up, 1 - shutdown

@description Puts device in shutdown mode or wake up device depending on state.

◆ lr3_write_eeprom()

LR3_RETVAL lr3_write_eeprom ( lr3_t ctx,
uint8_t  address,
uint8_t  n_bytes,
uint8_t *  data_in 
)

EEPROM write function.

Parameters
ctxClick object.
addressEEPROM Address where data be written
n_bytesNumber of bytes witch be written (max 254)
data_inPointer to buffer witch from data be written
Returns
0 - OK, 1 - Invalid address, 252 - Payload Length Error, 253 - Check Sum Error, 254 - Response Error, 255 - Header Error

@description Function writes data to EEPROM.