lr5 2.0.0.0
Public function

Functions

void lr5_cfg_setup (lr5_cfg_t *cfg)
 Config Object Initialization function.
 
LR5_RETVAL lr5_init (lr5_t *ctx, lr5_cfg_t *cfg)
 Initialization function.
 
int32_t lr5_generic_read (lr5_t *ctx, char *data_buf, uint16_t max_len)
 Generic read function.
 
void lr5_response_handler_set (lr5_t *ctx, void(*handler)(uint8_t *, uint8_t *, uint8_t *))
 Set Handler function.
 
void lr5_uart_isr (lr5_t *ctx)
 UART ISR function.
 
LR5_RETVAL lr5_response_ready (lr5_t *ctx)
 Response Ready function.
 
LR5_RETVAL lr5_task (lr5_t *ctx)
 Parser Task function.
 
void lr5_hw_reset (lr5_t *ctx)
 HW Reset function.
 
LR5_RETVAL lr5_data_indication (lr5_t *ctx)
 Data Indication function.
 
void lr5_reset_cmd (lr5_t *ctx)
 SW Reset Command.
 
void lr5_factory_reset_cmd (lr5_t *ctx)
 Factory Reset Command.
 
LR5_RETVAL lr5_eeprom_write_cmd (lr5_t *ctx, uint8_t start_addr, uint8_t *data_in, uint8_t n_bytes)
 EEPROM Write Command.
 
LR5_RETVAL lr5_eeprom_read_cmd (lr5_t *ctx, uint8_t start_addr, uint8_t n_bytes)
 EEPROM Read Command.
 
void lr5_get_fw_version_cmd (lr5_t *ctx)
 Get FW Version Command.
 
void lr5_get_serial_no_cmd (lr5_t *ctx)
 Get Mipot Serial Number Command.
 
void lr5_get_dev_eui_cmd (lr5_t *ctx)
 Get DevEUI Command.
 
void lr5_join_cmd (lr5_t *ctx, uint8_t mode)
 Join Network Command.
 
void lr5_get_activation_status_cmd (lr5_t *ctx)
 Get Activation Status Command.
 
void lr5_set_app_key_cmd (lr5_t *ctx, uint8_t *app_key)
 Set App Key Command.
 
void lr5_set_app_session_key_cmd (lr5_t *ctx, uint8_t *app_s_key)
 Set App Session Key Command.
 
void lr5_set_nwk_session_key_cmd (lr5_t *ctx, uint8_t *nwk_s_key)
 Set Nwk Session Key Command.
 
LR5_RETVAL lr5_tx_msg_cmd (lr5_t *ctx, lr5_msg_t *msg)
 TX Message Command.
 
void lr5_get_session_status_cmd (lr5_t *ctx)
 Get Session Status Command.
 
void lr5_set_next_dr_cmd (lr5_t *ctx, uint8_t data_rate)
 Set Next TX Data Rate Command.
 
void lr5_set_battery_level_cmd (lr5_t *ctx, uint8_t battery_level)
 Set Battery Level Command.
 
void lr5_get_battery_level_cmd (lr5_t *ctx)
 Get Battery Level Command.
 
void lr5_set_uplink_cnt_cmd (lr5_t *ctx, uint32_t uplink_cnt)
 Set Uplink Counter Command.
 
void lr5_get_uplink_cnt_cmd (lr5_t *ctx)
 Get Uplink Counter Command.
 
void lr5_set_downlink_cnt_cmd (lr5_t *ctx, uint32_t downlink_cnt)
 Set Downlink Counter Command.
 
void lr5_get_downlink_cnt_cmd (lr5_t *ctx)
 Get Downlink Counter Command.
 
void lr5_set_ch_mask_cmd (lr5_t *ctx, uint8_t *ch_mask)
 Set Channels Mask Command.
 
LR5_RETVAL lr5_get_ch_param_cmd (lr5_t *ctx, uint8_t ch_idx)
 Get Channel Parameters Command.
 

Detailed Description

Function Documentation

◆ lr5_cfg_setup()

void lr5_cfg_setup ( lr5_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.

◆ lr5_data_indication()

LR5_RETVAL lr5_data_indication ( lr5_t * ctx)

Data Indication function.

Parameters
ctxClick object.

@description This function returns 0 when received radio frame transfer from the module to the host is started, or returns 1 if is not started.

◆ lr5_eeprom_read_cmd()

LR5_RETVAL lr5_eeprom_read_cmd ( lr5_t * ctx,
uint8_t start_addr,
uint8_t n_bytes )

EEPROM Read Command.

Parameters
ctxClick object.
start_addrAddress which from a data reading be started
n_bytesNumber of bytes to be read
Returns
0x00 - OK, 0xFC - Invalid number of bytes

@description This command performs an EEPROM data reading.

◆ lr5_eeprom_write_cmd()

LR5_RETVAL lr5_eeprom_write_cmd ( lr5_t * ctx,
uint8_t start_addr,
uint8_t * data_in,
uint8_t n_bytes )

EEPROM Write Command.

Parameters
ctxClick object.
start_addrAddress which from a data writing be started
data_inData to be written
n_bytesNumber of bytes to be written
Returns
0x00 - OK, 0xFC - Invalid number of bytes

@description This command performs an EEPROM data writing.

Note
This command is allowed only when the module is in idle state.

◆ lr5_factory_reset_cmd()

void lr5_factory_reset_cmd ( lr5_t * ctx)

Factory Reset Command.

Parameters
ctxClick object.

@description This command performs an EEPROM recovery to default values.

Note
This command is allowed only when the module is in idle state.

◆ lr5_generic_read()

int32_t lr5_generic_read ( lr5_t * ctx,
char * data_buf,
uint16_t max_len )

Generic read function.

Parameters
ctxClick object.
data_bufBuffer to be read.
max_lenNumber of maximum bytes that can be read.

@description This function reads buffer of data using uart_read function.

◆ lr5_get_activation_status_cmd()

void lr5_get_activation_status_cmd ( lr5_t * ctx)

Get Activation Status Command.

Parameters
ctxClick object.

@description This command allows user to get the module activation status.

◆ lr5_get_battery_level_cmd()

void lr5_get_battery_level_cmd ( lr5_t * ctx)

Get Battery Level Command.

Parameters
ctxClick object.

@description This command allows user to get the battery level value.

◆ lr5_get_ch_param_cmd()

LR5_RETVAL lr5_get_ch_param_cmd ( lr5_t * ctx,
uint8_t ch_idx )

Get Channel Parameters Command.

Parameters
ctxClick object.
ch_idxChannel index from 0 to 15
Returns
0x00 - OK, 0xFB - Invalid channel index

@description This command allows user to get the parameters for desired channel.

◆ lr5_get_dev_eui_cmd()

void lr5_get_dev_eui_cmd ( lr5_t * ctx)

Get DevEUI Command.

Parameters
ctxClick object.

@description This command allows user to get DevEUI provided by Mipot.

◆ lr5_get_downlink_cnt_cmd()

void lr5_get_downlink_cnt_cmd ( lr5_t * ctx)

Get Downlink Counter Command.

Parameters
ctxClick object.

@description This command allows user to get the downlink counter from RAM memory.

◆ lr5_get_fw_version_cmd()

void lr5_get_fw_version_cmd ( lr5_t * ctx)

Get FW Version Command.

Parameters
ctxClick object.

@description This command allows user to get the 32bit firmware version.

◆ lr5_get_serial_no_cmd()

void lr5_get_serial_no_cmd ( lr5_t * ctx)

Get Mipot Serial Number Command.

Parameters
ctxClick object.

@description This command allows user to get the 32bit Mipot serial number.

◆ lr5_get_session_status_cmd()

void lr5_get_session_status_cmd ( lr5_t * ctx)

Get Session Status Command.

Parameters
ctxClick object.

@description This command allows user to get the module current status.

◆ lr5_get_uplink_cnt_cmd()

void lr5_get_uplink_cnt_cmd ( lr5_t * ctx)

Get Uplink Counter Command.

Parameters
ctxClick object.

@description This command allows user to get the uplink counter from RAM memory.

◆ lr5_hw_reset()

void lr5_hw_reset ( lr5_t * ctx)

HW Reset function.

Parameters
ctxClick object.

@description This function performs a HW reset and puts a device back to the normal mode by using RST pin.

◆ lr5_init()

LR5_RETVAL lr5_init ( lr5_t * ctx,
lr5_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ lr5_join_cmd()

void lr5_join_cmd ( lr5_t * ctx,
uint8_t mode )

Join Network Command.

Parameters
ctxClick object.
mode0 - ABP, 1 - OTAA

@description This command performs a joining to the network.

◆ lr5_reset_cmd()

void lr5_reset_cmd ( lr5_t * ctx)

SW Reset Command.

Parameters
ctxClick object.

@description This command performs a SW reset of the module.

Note
The response on this command will be sent immediately, but the reset will be performed after about 1 second.

◆ lr5_response_handler_set()

void lr5_response_handler_set ( lr5_t * ctx,
void(*)(uint8_t *, uint8_t *, uint8_t *) handler )

Set Handler function.

Parameters
ctxClick object.
handlerPointer on the function that should be performed

@description This function sets handler on the function that should be performed.

◆ lr5_response_ready()

LR5_RETVAL lr5_response_ready ( lr5_t * ctx)

Response Ready function.

Parameters
ctxClick object.

@description This function returns 1 if entire response from the module is received, or returns 0 if is not received. Also clears the response ready flag.

◆ lr5_set_app_key_cmd()

void lr5_set_app_key_cmd ( lr5_t * ctx,
uint8_t * app_key )

Set App Key Command.

Parameters
ctxClick object.
app_keyData to be written

@description This command performs the app key data writing to the EEPROM.

Note
app_key - 16 bytes in Little Endian Order, needed for OTAA procedure.

◆ lr5_set_app_session_key_cmd()

void lr5_set_app_session_key_cmd ( lr5_t * ctx,
uint8_t * app_s_key )

Set App Session Key Command.

Parameters
ctxClick object.
app_s_keyData to be written

@description This command performs the app session key data writing to the EEPROM.

Note
app_s_key - 16 bytes in Little Endian Order, needed for ABP procedure.

◆ lr5_set_battery_level_cmd()

void lr5_set_battery_level_cmd ( lr5_t * ctx,
uint8_t battery_level )

Set Battery Level Command.

Parameters
ctxClick object.
battery_level0 - The end-device is connected to an external power source 1...254 - The battery level 255 - The end-device was not able to measure battery level

@description This command allows user to set the battery level.

◆ lr5_set_ch_mask_cmd()

void lr5_set_ch_mask_cmd ( lr5_t * ctx,
uint8_t * ch_mask )

Set Channels Mask Command.

Parameters
ctxClick object.
ch_maskThe 9 bytes mask for all channels between 0 and 71 The first byte is mask for channels between 0 and 7 The MSB of each byte is the lowest channel index

@description This command allows user to set the channels mask to enable or disable a group of channels.

Note
These settings will be stored in RAM memory.

◆ lr5_set_downlink_cnt_cmd()

void lr5_set_downlink_cnt_cmd ( lr5_t * ctx,
uint32_t downlink_cnt )

Set Downlink Counter Command.

Parameters
ctxClick object.
downlink_cntThe 32bit downlink counter

@description This command allows user to set the downlink counter in RAM memory.

◆ lr5_set_next_dr_cmd()

void lr5_set_next_dr_cmd ( lr5_t * ctx,
uint8_t data_rate )

Set Next TX Data Rate Command.

Parameters
ctxClick object.
data_rateData Rate selection, from 0 to 4

@description This command allows user to set next transmission data rate.

Note
The value is stored in RAM memory.

◆ lr5_set_nwk_session_key_cmd()

void lr5_set_nwk_session_key_cmd ( lr5_t * ctx,
uint8_t * nwk_s_key )

Set Nwk Session Key Command.

Parameters
ctxClick object.
nwk_s_keyData to be written

@description This command performs the nwk session key data writing to the EEPROM.

Note
nwk_s_key - 16 bytes in Little Endian Order, needed for ABP procedure.

◆ lr5_set_uplink_cnt_cmd()

void lr5_set_uplink_cnt_cmd ( lr5_t * ctx,
uint32_t uplink_cnt )

Set Uplink Counter Command.

Parameters
ctxClick object.
uplink_cntThe 32bit uplink counter

@description This command allows user to set the uplink counter in RAM memory.

◆ lr5_task()

LR5_RETVAL lr5_task ( lr5_t * ctx)

Parser Task function.

Parameters
ctxClick object.
Returns
1 - Command response ready, 2 - Indication response ready, or determined error code

@description This function makes a response from the MIPOT 32001409 module.

Note
The checksum and frame header checking will be included in this function.

◆ lr5_tx_msg_cmd()

LR5_RETVAL lr5_tx_msg_cmd ( lr5_t * ctx,
lr5_msg_t * msg )

TX Message Command.

Parameters
ctxClick object.
msgTX Message object.
Msg structure arguments:
 - options        0 - Unreliable data transmission, 1 - Reliable data transmission
 - port           Port number, from 1 to 223
 - msg_data       Data to transmit
 - msg_length     The maximum allowed data length depends upon set data rate
Returns
0x00 - OK, 0xFC - Invalid number of bytes

@description This command performs the transmission of radio frame.

◆ lr5_uart_isr()

void lr5_uart_isr ( lr5_t * ctx)

UART ISR function.

Parameters
ctxClick object.

@description This function sets the flag when entire response packet is received using lr5_process function in main.