lr4 2.0.0.0
lr4.h File Reference

This file contains API for LR 4 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  lr4_t
 Click ctx object definition. More...
 
struct  lr4_cfg_t
 Click configuration structure definition. More...
 
struct  lr4_message_t
 
struct  lr4_tx_msg_t
 

Macros

#define LR4_MAP_MIKROBUS(cfg, mikrobus)
 
#define LR4_RETVAL   uint8_t
 
#define LR4_OK   0x00
 
#define LR4_INIT_ERROR   0xFF
 
#define LR4_FRAME_HEADER   0xAA
 
#define LR4_RESPONSE_BIT   0x80
 
#define LR4_CMD_RESET   0x30
 
#define LR4_CMD_FACTORY_RESET   0x31
 
#define LR4_CMD_EEPROM_WRITE   0x32
 
#define LR4_CMD_EEPROM_READ   0x33
 
#define LR4_CMD_GET_FW_VERSION   0x34
 
#define LR4_CMD_GET_SERIAL_NO   0x35
 
#define LR4_CMD_GET_DEV_EUI   0x36
 
#define LR4_CMD_JOIN   0x40
 
#define LR4_CMD_GET_ACTIVATION_STATUS   0x42
 
#define LR4_CMD_SET_APP_KEY   0x43
 
#define LR4_CMD_SET_APP_SESSION_KEY   0x44
 
#define LR4_CMD_SET_NWK_SESSION_KEY   0x45
 
#define LR4_CMD_TX_MSG   0x46
 
#define LR4_CMD_GET_SESSION_STATUS   0x4A
 
#define LR4_CMD_SET_NEXT_DR   0x4B
 
#define LR4_CMD_SET_BATTERY_LVL   0x50
 
#define LR4_CMD_GET_BATTERY_LVL   0x51
 
#define LR4_CMD_SET_UPLINK_CNT   0x52
 
#define LR4_CMD_GET_UPLINK_CNT   0x53
 
#define LR4_CMD_SET_DOWNLINK_CNT   0x54
 
#define LR4_CMD_GET_DOWNLINK_CNT   0x55
 
#define LR4_CMD_SET_CH_PARAMETERS   0x57
 
#define LR4_CMD_GET_CH_PARAMETERS   0x58
 
#define LR4_INDICATES_JOIN   0x41
 
#define LR4_INDICATES_TX_MSG_CONFIRMED   0x47
 
#define LR4_INDICATES_TX_MSG_UNCONFIRMED   0x48
 
#define LR4_INDICATES_RX_MSG   0x49
 
#define LR4_OK   0x00
 
#define LR4_ERR_ADDR_RANGE   0x01
 
#define LR4_ERR_NOT_IDLE   0x02
 
#define LR4_ERR_PL_LEN   0xFC
 
#define LR4_ERR_CHKSUM   0xFD
 
#define LR4_ERR_RESPONSE   0xFE
 
#define LR4_ERR_HEADER   0xFF
 
#define LR4_JOIN_ACTIVATION_BY_PERSONALIZATION_MODE   0x00
 
#define LR4_JOIN_OVER_THE_AIR_ACTIVATION_MODE   0x01
 
#define LR4_GET_ACTIVATION_MODE   0x00
 
#define LR4_GET_SESSION_STATUS_MODE   0x01
 
#define LR4_SET_APP_KEY_MODE   0x00
 
#define LR4_SET_NWK_SESSION_KEY_MODE   0x01
 
#define LR4_UPLINK_CNT   0x00
 
#define LR4_DOWNLINK_CNT   0x01
 
#define LR4_CHANNEL_DISABLED   0x00
 
#define LR4_CHANNEL_ENABLED   0x01
 
#define LR4_UNCONFIRMED_TRANSMISSION   0x00
 
#define LR4_CONFIRMED_TRANSMISSION   0x01
 
#define LR4_STATUS_IDLE   0x00
 
#define LR4_STATUS_BUSY   0x01
 
#define LR4_STATUS_DEV_NOT_ACTIVATED   0x02
 
#define LR4_STATUS_DELAYED   0x03
 
#define LR4_STATUS_NOT_ACTIVATED   0x00
 
#define LR4_STATUS_JOINING   0x01
 
#define LR4_STATUS_JOINED   0x02
 
#define LR4_STATUS_MAC_ERROR   0x03
 
#define LR4_MODULE_POWER_ON   1
 
#define LR4_MODULE_POWER_OFF   0
 
#define DRV_RX_BUFFER_SIZE   500
 

Typedefs

typedef void(* lr4_ind_hdl_t) (uint8_t *cmd, uint8_t *p_load_size, uint8_t *p_load)
 LR4_TYPES Types.
 

Functions

void lr4_cfg_setup (lr4_cfg_t *cfg)
 Config Object Initialization function.
 
LR4_RETVAL lr4_init (lr4_t *ctx, lr4_cfg_t *cfg)
 Initialization function.
 
int32_t lr4_generic_read (lr4_t *ctx, char *data_buf, uint16_t max_len)
 Generic read function.
 
void lr4_generic_write (lr4_t *ctx, char *data_buf, uint16_t len)
 Generic write function.
 
void lr4_hard_reset (lr4_t *ctx)
 Hardware reset function.
 
void lr4_wake_up (lr4_t *ctx, uint8_t state)
 Wake Up function.
 
void lr4_set_ind_handler (lr4_t *ctx, lr4_ind_hdl_t hdl)
 Set indication handler function.
 
uint8_t lr4_command (lr4_t *ctx, lr4_message_t *msg, lr4_message_t *rsp)
 Command function.
 
uint8_t lr4_read_message_process (lr4_t *ctx)
 Process function.
 
LR4_RETVAL lr4_soft_reset (lr4_t *ctx)
 Software reset function.
 
LR4_RETVAL lr4_factory_reset (lr4_t *ctx)
 Factory reset function.
 
LR4_RETVAL lr4_write_eeprom (lr4_t *ctx, uint8_t address, uint8_t n_bytes, uint8_t *data_in)
 EEPROM write function.
 
LR4_RETVAL lr4_read_eeprom (lr4_t *ctx, uint8_t address, uint8_t n_bytes, uint8_t *data_out)
 EEPROM read function.
 
LR4_RETVAL lr4_get_fw_version (lr4_t *ctx, uint32_t *fw_version)
 Get FW Version function.
 
LR4_RETVAL lr4_get_serial_no (lr4_t *ctx, uint32_t *serial_no)
 Get Serial Number function.
 
LR4_RETVAL lr4_get_dev_eui (lr4_t *ctx, uint8_t *dev_eui)
 Get DevEUI function.
 
LR4_RETVAL lr4_join_network (lr4_t *ctx, uint8_t mode)
 Join Network function.
 
LR4_RETVAL lr4_get_status (lr4_t *ctx, uint8_t status_mode)
 Get Status function.
 
LR4_RETVAL lr4_set_key (lr4_t *ctx, uint8_t *key_data, uint8_t key_mode)
 Set Key function.
 
LR4_RETVAL lr4_tx_message (lr4_t *ctx, lr4_tx_msg_t *tx_msg)
 Radio frame Transmission function.
 
LR4_RETVAL lr4_set_next_tx_data_rate (lr4_t *ctx, uint8_t data_rate)
 Set Next Data Rate function.
 
LR4_RETVAL lr4_set_battery_level (lr4_t *ctx, uint8_t battery_level)
 Set Battery Level function.
 
LR4_RETVAL lr4_get_battery_level (lr4_t *ctx)
 Get Battery Level function.
 
LR4_RETVAL lr4_set_counter (lr4_t *ctx, uint32_t cnt, uint8_t cnt_mode)
 Set Counter function.
 
LR4_RETVAL lr4_get_counter (lr4_t *ctx, uint32_t *cnt, uint8_t cnt_mode)
 Get Counter function.
 
LR4_RETVAL lr4_set_channel (lr4_t *ctx, uint8_t index, uint32_t freq, uint8_t data_rate_range, uint8_t status)
 Set Channel function.
 
uint8_t lr4_chk_sum (lr4_message_t *cmd)
 Check sum function.
 

Detailed Description

This file contains API for LR 4 Click driver.