lr5 2.0.0.0
lr5.h File Reference

This file contains API for LR 5 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_uart.h"

Go to the source code of this file.

Data Structures

struct  lr5_t
 Click ctx object definition. More...
 
struct  lr5_cmd_t
 Command structure definition. More...
 
struct  lr5_msg_t
 Message command definition. More...
 
struct  lr5_cfg_t
 Click configuration structure definition. More...
 

Macros

#define LR5_MAP_MIKROBUS(cfg, mikrobus)
 
#define LR5_RETVAL   uint8_t
 
#define LR5_OK   0x00
 
#define LR5_INIT_ERROR   0xFF
 
#define RESPONSE_BIT   0x80
 
#define FRAME_HEADER   0xAA
 
#define RESET_CMD   0x30
 
#define FACTORY_RESET_CMD   0x31
 
#define EEPROM_WRITE_CMD   0x32
 
#define EEPROM_READ_CMD   0x33
 
#define GET_FW_VERSION_CMD   0x34
 
#define GET_SERIALNO_CMD   0x35
 
#define GET_DEV_EUI_CMD   0x36
 
#define JOIN_CMD   0x40
 
#define JOIN_IND   0x41
 
#define GET_ACT_STATUS_CMD   0x42
 
#define SET_APP_KEY_CMD   0x43
 
#define SET_APP_SESSION_KEY_CMD   0x44
 
#define SET_NWK_SESSION_KEY_CMD   0x45
 
#define TX_MSG_CMD   0x46
 
#define TX_MSG_CONFIRMED_IND   0x47
 
#define TX_MSG_UNCONFIRMED_IND   0x48
 
#define RX_MSG_IND   0x49
 
#define GET_SESSION_STATUS_CMD   0x4A
 
#define SET_NEXT_DR_CMD   0x4B
 
#define SET_BATTERY_LVL_CMD   0x50
 
#define GET_BATTERY_LVL_CMD   0x51
 
#define SET_UPLINK_CNT_CMD   0x52
 
#define GET_UPLINK_CNT_CMD   0x53
 
#define SET_DOWNLINK_CNT_CMD   0x54
 
#define GET_DOWNLINK_CNT_CMD   0x55
 
#define SET_CH_MASK_CMD   0x57
 
#define GET_CH_PARAM_CMD   0x58
 
#define LR5_ABP   0x00
 
#define LR5_OTAA   0x01
 
#define LR5_UNRELIABLE_DATA_TX   0x00
 
#define LR5_RELIABLE_DATA_TX   0x01
 
#define LR5_SF10_125KHZ   0x00
 
#define LR5_SF9_125KHZ   0x01
 
#define LR5_SF8_125KHZ   0x02
 
#define LR5_SF7_125KHZ   0x03
 
#define LR5_SF8_500KHZ   0x04
 
#define LR5_CH_IDX_0   0x00
 
#define LR5_CH_IDX_1   0x01
 
#define LR5_CH_IDX_2   0x02
 
#define LR5_CH_IDX_3   0x03
 
#define LR5_CH_IDX_4   0x04
 
#define LR5_CH_IDX_5   0x05
 
#define LR5_CH_IDX_6   0x06
 
#define LR5_CH_IDX_7   0x07
 
#define LR5_CH_IDX_8   0x08
 
#define LR5_CH_IDX_9   0x09
 
#define LR5_CH_IDX_10   0x0A
 
#define LR5_CH_IDX_11   0x0B
 
#define LR5_CH_IDX_12   0x0C
 
#define LR5_CH_IDX_13   0x0D
 
#define LR5_CH_IDX_14   0x0E
 
#define LR5_CH_IDX_15   0x0F
 
#define LR5_FRAME_HEADER_ERR   0xFF
 
#define LR5_CMD_RESPONSE_ERR   0xFE
 
#define LR5_CHKSUM_ERR   0xFD
 
#define LR5_NBYTES_INVALID   0xFC
 
#define LR5_CH_IDX_INVALID   0xFB
 
#define LR5_OK   0x00
 
#define LR5_RESPONSE_NOT_RECEIVED   0x00
 
#define LR5_RESPONSE_RECEIVED   0x01
 
#define LR5_CMD_RESPONSE_READY   0x01
 
#define LR5_IND_RESPONSE_READY   0x02
 
#define LR5_DATA_READY   0x00
 
#define LR5_DATA_NOT_READY   0x01
 
#define DRV_RX_BUFFER_SIZE   500
 

Typedefs

typedef void(* lr5_hdl_t) (uint8_t *, uint8_t *, uint8_t *)
 Handler definition for data logging.
 

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

This file contains API for LR 5 Click driver.