nanolr 2.0.0.0
Public function

Functions

void nanolr_cfg_setup (nanolr_cfg_t *cfg)
 Config Object Initialization function.
 
NANOLR_RETVAL nanolr_init (nanolr_t *ctx, nanolr_cfg_t *cfg)
 Initialization function.
 
void nanolr_default_cfg (nanolr_t *ctx)
 Click Default Configuration function.
 
void nanolr_reset (nanolr_t *ctx)
 Reset module.
 
void nanolr_generic_write (nanolr_t *ctx, char *data_buf, uint16_t len)
 Generic write function.
 
int32_t nanolr_generic_read (nanolr_t *ctx, char *data_buf, uint16_t max_len)
 Generic read function.
 
uint8_t nanolr_request_2_send (nanolr_t *ctx)
 Request to Send function.
 
void nanolr_clear_2_send (nanolr_t *ctx, uint8_t state)
 Clear to Send function.
 
uint8_t nanolr_get_gp1_pin (nanolr_t *ctx)
 Get GP1 pin state function.
 
void nanolr_set_st_pin (nanolr_t *ctx, uint8_t state)
 Set ST pin state function.
 
void nanolr_get_device_info (nanolr_t *ctx)
 Get device information function.
 
void nanolr_get_device_state (nanolr_t *ctx)
 Get device state function.
 
void nanolr_sw_reset (nanolr_t *ctx)
 Software reset function.
 
void nanolr_get_fw_ver (nanolr_t *ctx)
 Get firmware version function.
 
void nanolr_restore_2_factory (nanolr_t *ctx)
 Restore to factory function.
 
void nanolr_save_settings (nanolr_t *ctx)
 Restore to factory function.
 
void nanolr_get_output_power (nanolr_t *ctx)
 Get output power function.
 
void nanolr_get_operating_channel (nanolr_t *ctx)
 Get operating channel function.
 
void nanolr_set_output_power (nanolr_t *ctx, uint8_t out_pwr)
 Set output power function.
 
void nanolr_set_operating_channel (nanolr_t *ctx, nanolr_network_t *net)
 Set operating channel function.
 
void nanolr_save_energy_always_on (nanolr_t *ctx)
 Save energy on function.
 
void nanolr_save_energy_rx_window (nanolr_t *ctx)
 Save energy rx window function.
 
void nanolr_save_energy_tx_only (nanolr_t *ctx)
 Save energy tx only function.
 
void nanolr_get_physical_address (nanolr_t *ctx)
 Get physical address function.
 
void nanolr_set_physical_address (nanolr_t *ctx, uint8_t *app_eui, uint8_t *dev_eui)
 Set physical address function.
 
void nanolr_get_network_address (nanolr_t *ctx)
 Get network address function.
 
void nanolr_set_network_address (nanolr_t *ctx, uint16_t ntw_addr)
 Set network address function.
 
void nanolr_get_network_id (nanolr_t *ctx)
 Get network identifiers function.
 
void nanolr_set_network_id (nanolr_t *ctx, uint16_t ntw_id)
 Set network identifiers function.
 
void nanolr_get_network_role (nanolr_t *ctx)
 Get network role function.
 
void nanolr_set_network_role (nanolr_t *ctx, uint8_t ntw_role)
 Set network role function.
 
void nanolr_get_network_auto_settings (nanolr_t *ctx)
 Get network automated settings function.
 
void nanolr_get_network_preference (nanolr_t *ctx)
 Get network preference function.
 
void nanolr_set_network_preference (nanolr_t *ctx, uint8_t prot, uint8_t auto_join, uint8_t adr)
 Set network preference function.
 
void nanolr_get_network_join_mode (nanolr_t *ctx)
 Get network join mode function.
 
void nanolr_set_network_join_mode (nanolr_t *ctx, uint8_t ntw_join_mode)
 Set network join mode function.
 
void nanolr_get_battery_level (nanolr_t *ctx)
 Get battery level function.
 
void nanolr_get_wan_network_type (nanolr_t *ctx)
 Get LRWAN network type function.
 
void nanolr_wan_network_public (nanolr_t *ctx)
 Set LRWAN network type public function.
 
void nanolr_wan_network_private (nanolr_t *ctx)
 Set LRWAN network type private function.
 
void nanolr_network_stop (nanolr_t *ctx)
 Network stop function.
 
void nanolr_network_start (nanolr_t *ctx)
 Network start function.
 
void nanolr_send_data (nanolr_t *ctx, uint8_t *tx_data, uint8_t length)
 Send data function.
 
uint8_t nanolr_rsp_rdy (nanolr_t *ctx)
 Check response ready function.
 
void nanolr_uart_isr (nanolr_t *ctx)
 UART ISR function.
 
nanolr_err_t nanolr_parser_rsp (nanolr_t *ctx, nanolr_rsp_t *response)
 Response parser function.
 

Detailed Description

Function Documentation

◆ nanolr_cfg_setup()

void nanolr_cfg_setup ( nanolr_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.

◆ nanolr_clear_2_send()

void nanolr_clear_2_send ( nanolr_t * ctx,
uint8_t state )

Clear to Send function.

Parameters
ctxClick object.
state0 : inactive, 1 : active

@description The function in response the DCE asserts CTS to grant permission.

◆ nanolr_default_cfg()

void nanolr_default_cfg ( nanolr_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for NanoLR click.

◆ nanolr_generic_read()

int32_t nanolr_generic_read ( nanolr_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 reads data.

@description The function read maximum length of data that is specified

◆ nanolr_generic_write()

void nanolr_generic_write ( nanolr_t * ctx,
char * data_buf,
uint16_t len )

Generic write function.

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

@description The function write specific number of data.

◆ nanolr_get_battery_level()

void nanolr_get_battery_level ( nanolr_t * ctx)

Get battery level function.

Parameters
ctxClick object.

@description The function the battery level of the module.

◆ nanolr_get_device_info()

void nanolr_get_device_info ( nanolr_t * ctx)

Get device information function.

Parameters
ctxClick object.

@description The function requires device information.

◆ nanolr_get_device_state()

void nanolr_get_device_state ( nanolr_t * ctx)

Get device state function.

Parameters
ctxClick object.

@description The function requires state information.

◆ nanolr_get_fw_ver()

void nanolr_get_fw_ver ( nanolr_t * ctx)

Get firmware version function.

Parameters
ctxClick object.

@description The function requires device firmware version.

◆ nanolr_get_gp1_pin()

uint8_t nanolr_get_gp1_pin ( nanolr_t * ctx)

Get GP1 pin state function.

Parameters
ctxClick object.
Returns
0 : inactive, 1 : active

@description The function get states of the GP1 ( PWM ) pin that can handle interrupts.

◆ nanolr_get_network_address()

void nanolr_get_network_address ( nanolr_t * ctx)

Get network address function.

Parameters
ctxClick object.

@description The function retrieve the addresses in use on the module.

Note
- LRWAN Network: To set the network addresses, the payload is a 4
bytes field (sent most significant byte first)
indicating the network identifier to be used.
When using Over-the-air activation, this param is set during network start.
- LREMB Network: When using the LREMB protocol,
the network address is 2 Byte long.

◆ nanolr_get_network_auto_settings()

void nanolr_get_network_auto_settings ( nanolr_t * ctx)

Get network automated settings function.

Parameters
ctxClick object.

@description The function retrieve the automated settings of the module.

◆ nanolr_get_network_id()

void nanolr_get_network_id ( nanolr_t * ctx)

Get network identifiers function.

Parameters
ctxClick object.

@description The function retrieve the network ID in use on the module.

Note
 
- LRWAN Network: the EBI �network identifier� is 4 bytes long
and corresponds to the �Network ID� identifier.
- LREMB Network: In Embit custom radio networks,
the Network ID correspond to the �PAN ID� and
identifies the specific network in use.

◆ nanolr_get_network_join_mode()

void nanolr_get_network_join_mode ( nanolr_t * ctx)

Get network join mode function.

Parameters
ctxClick object.

@description The function retrieve the network join mode of the module.

◆ nanolr_get_network_preference()

void nanolr_get_network_preference ( nanolr_t * ctx)

Get network preference function.

Parameters
ctxClick object.

@description The function retrieve the active network preferences.

◆ nanolr_get_network_role()

void nanolr_get_network_role ( nanolr_t * ctx)

Get network role function.

Parameters
ctxClick object.

@description The function retrieve the selected network role of the module.

◆ nanolr_get_operating_channel()

void nanolr_get_operating_channel ( nanolr_t * ctx)

Get operating channel function.

Parameters
ctxClick object.

@description The function retrieve the current channel.

◆ nanolr_get_output_power()

void nanolr_get_output_power ( nanolr_t * ctx)

Get output power function.

Parameters
ctxClick object.

@description The function retrieve the current output power.

◆ nanolr_get_physical_address()

void nanolr_get_physical_address ( nanolr_t * ctx)

Get physical address function.

Parameters
ctxClick object.

@description The function retrieve the physical address of a module.

◆ nanolr_get_wan_network_type()

void nanolr_get_wan_network_type ( nanolr_t * ctx)

Get LRWAN network type function.

Parameters
ctxClick object.

@description The function retrieve the LRWAN network type of the module: public or private.

◆ nanolr_init()

NANOLR_RETVAL nanolr_init ( nanolr_t * ctx,
nanolr_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ nanolr_network_start()

void nanolr_network_start ( nanolr_t * ctx)

Network start function.

Parameters
ctxClick object.

@description The function send the commands to start the network.

◆ nanolr_network_stop()

void nanolr_network_stop ( nanolr_t * ctx)

Network stop function.

Parameters
ctxClick object.

@description The function send the commands to stops the network.

◆ nanolr_parser_rsp()

nanolr_err_t nanolr_parser_rsp ( nanolr_t * ctx,
nanolr_rsp_t * response )

Response parser function.

Parameters
ctxClick object.
Returns
0 : error status ok, 1 : error crc

@description The function parser device response.

◆ nanolr_request_2_send()

uint8_t nanolr_request_2_send ( nanolr_t * ctx)

Request to Send function.

Parameters
ctxClick object.
Returns
0 : inactive, 1 : active

@description The function Request to Send indicate a desire to transmit.

◆ nanolr_reset()

void nanolr_reset ( nanolr_t * ctx)

Reset module.

Parameters
ctxClick object.

@description The function resets the module.

◆ nanolr_restore_2_factory()

void nanolr_restore_2_factory ( nanolr_t * ctx)

Restore to factory function.

Parameters
ctxClick object.

@description The function sends a command to reset the device to factory settings.

◆ nanolr_rsp_rdy()

uint8_t nanolr_rsp_rdy ( nanolr_t * ctx)

Check response ready function.

Parameters
ctxClick object.
Returns
0 : the response is not ready, 1 : the response is ready

@description The function check if the response is ready.

◆ nanolr_save_energy_always_on()

void nanolr_save_energy_always_on ( nanolr_t * ctx)

Save energy on function.

Parameters
ctxClick object.

@description The function sends a command to set save energy mode: LRWANTM Class C / LREMB reception anytime of the device.

◆ nanolr_save_energy_rx_window()

void nanolr_save_energy_rx_window ( nanolr_t * ctx)

Save energy rx window function.

Parameters
ctxClick object.

@description The function sends a command to set save energy mode: LRWANTM Class A / LREMB receive after transmit of the device.

◆ nanolr_save_energy_tx_only()

void nanolr_save_energy_tx_only ( nanolr_t * ctx)

Save energy tx only function.

Parameters
ctxClick object.

@description The function sends a command to set save energy mode: LREMB transmit only of the device.

◆ nanolr_save_settings()

void nanolr_save_settings ( nanolr_t * ctx)

Restore to factory function.

Parameters
ctxClick object.

@description The function sends a command to save the current settings.

◆ nanolr_send_data()

void nanolr_send_data ( nanolr_t * ctx,
uint8_t * tx_data,
uint8_t length )

Send data function.

Parameters
ctxClick object.
tx_datapointer to the memory location where tx_data be stored
lengthnumber of bytes to send

@description The function the send data command depends on the network protocol chosen.

Note
 
Send data LREMB broadcast:
send options: 0x0000;
destination address (broadcast): 0xFFFF;
any EMB-EVB boards is configured with reception always enabled,
so it is able to receive both direct messages and broadcast messages.
The end device usually employs
energy save mode (will be implemented in the future).

◆ nanolr_set_network_address()

void nanolr_set_network_address ( nanolr_t * ctx,
uint16_t ntw_addr )

Set network address function.

Parameters
ctxClick object.
ntw_addr16-bit network address

@description The function set the network addresses.

Note
The address 0xFFFF indicates the broadcast address. Addresses form 0xFFF0 to 0xFFFE are reserved.

◆ nanolr_set_network_id()

void nanolr_set_network_id ( nanolr_t * ctx,
uint16_t ntw_id )

Set network identifiers function.

Parameters
ctxClick object.
ntw_id16-bit network ID

@description The function set the network ID in use on the module.

◆ nanolr_set_network_join_mode()

void nanolr_set_network_join_mode ( nanolr_t * ctx,
uint8_t ntw_join_mode )

Set network join mode function.

Parameters
ctxClick object.
ntw_join_mode
 
- 0x00 ( NANOLR_NTW_JOIN_MODE_ABP )  : ABP (activation by personalisation).
- 0x01 ( NANOLR_NTW_JOIN_MODE_OTAA ) : OTAA (over-the-air-activation).

@description The function set network join mode of the module.

◆ nanolr_set_network_preference()

void nanolr_set_network_preference ( nanolr_t * ctx,
uint8_t prot,
uint8_t auto_join,
uint8_t adr )

Set network preference function.

Parameters
ctxClick object.
prot
- 0x00 ( NANOLR_NTW_PREFERENCE_PROTOCOL_LR_EMB ) :
LREMB network protocol.
- 0x80 ( NANOLR_NTW_PREFERENCE_PROTOCOL_LR_WAN ) :
LRWAN network protocol.
auto_join
- 0x00 ( NANOLR_NTW_PREFERENCE_AUTO_JOIN_DISABLE ) :
Auto Joining Disabled (Activation By Personalization - ABP).
- 0x40 ( NANOLR_NTW_PREFERENCE_AUTO_JOIN_ENABLE )  :
Auto Joining Enabled (Over-The-Air Activation - OTAA).
adr
 
- 0x00 ( NANOLR_NTW_PREFERENCE_ADAPTIVE_DATA_RATE_DISABLE ) :
disable ADR (Adaptive Data Rate)
- 0x20 ( NANOLR_NTW_PREFERENCE_ADAPTIVE_DATA_RATE_ENABLE )  :
enable ADR (Adaptive Data Rate).

@description The function set network preferences of the module.

◆ nanolr_set_network_role()

void nanolr_set_network_role ( nanolr_t * ctx,
uint8_t ntw_role )

Set network role function.

Parameters
ctxClick object.
ntw_role
- 0x00 ( NANOLR_NTW_ROLE_COORDINATOR ) : Coordinator.
- 0x02 ( NANOLR_NTW_ROLE_END_DEVICE )  : End Device.

@description The function set the selected network role of the module.

Note
Only the End Device role is supported on LRWAN networks.

◆ nanolr_set_operating_channel()

void nanolr_set_operating_channel ( nanolr_t * ctx,
nanolr_network_t * net )

Set operating channel function.

Parameters
ctxClick object.
channel
- 0x01 ( NANOLR_OP_CHANNEL_CH_1_868_1MHz )    : 868.100 MHz;
- 0x02 ( NANOLR_OP_CHANNEL_CH_2_868_3MHz )    : 868.300 MHz;
- 0x03 ( NANOLR_OP_CHANNEL_CH_3_868_5MHz )    : 868.500 MHz;
- 0x04 ( NANOLR_OP_CHANNEL_CH_4_869_525MHz )  : 869.525 MHz;
spreading_factor
 
- 0x07 ( NANOLR_OP_CHANNEL_SPR_FCT_128 )      : Chips/symbol 128;
- 0x08 ( NANOLR_OP_CHANNEL_SPR_FCT_256 )      : Chips/symbol 256;
- 0x09 ( NANOLR_OP_CHANNEL_SPR_FCT_512 )      : Chips/symbol 512;
- 0x0A ( NANOLR_OP_CHANNEL_SPR_FCT_1024 )     : Chips/symbol 1024;
- 0x0B ( NANOLR_OP_CHANNEL_SPR_FCT_2048 )     : Chips/symbol 2048;
- 0x0C ( NANOLR_OP_CHANNEL_SPR_FCT_4096 )     : Chips/symbol 4096;
 

bandwidth
- 0x00 ( NANOLR_OP_CHANNEL_BANDWIDTH_125KHZ ) : 125 kHz;
- 0x01 ( NANOLR_OP_CHANNEL_BANDWIDTH_250KHZ ) : 250 kHz;
coding_rate
 
- 0x00 ( NANOLR_OP_CHANNEL_CODING_RATE_4_5 )  : Coding Rate 4/5;
- 0x01 ( NANOLR_OP_CHANNEL_CODING_RATE_4_6 )  : Coding Rate 4/6;
- 0x02 ( NANOLR_OP_CHANNEL_CODING_RATE_4_7 )  : Coding Rate 4/7;
- 0x03 ( NANOLR_OP_CHANNEL_CODING_RATE_4_8 )  : Coding Rate 4/8;

@description The function set the current channel.

Note
The operating channel can only be changed when network is down. When using the LRWAN network, the channel is automatically assigned by the concentrator.

◆ nanolr_set_output_power()

void nanolr_set_output_power ( nanolr_t * ctx,
uint8_t out_pwr )

Set output power function.

Parameters
ctxClick object.
out_pwrOutput power [+2, +19] dBm

@description The function retrieve the current output power.

◆ nanolr_set_physical_address()

void nanolr_set_physical_address ( nanolr_t * ctx,
uint8_t * app_eui,
uint8_t * dev_eui )

Set physical address function.

Parameters
ctxClick object.
app_euiPointer to the memory location where app_eui data ( 8 bytes ) be stored
dev_euiPointer to the memory location where dev_eui data ( 8 bytes ) be stored

@description The function set the physical address of a module.

Note
The physical address is used only when joining to a LRWAN network.

◆ nanolr_set_st_pin()

void nanolr_set_st_pin ( nanolr_t * ctx,
uint8_t state )

Set ST pin state function.

Parameters
ctxClick object.
state0 : inactive, 1 : active

@description The function set states of the ST ( AN ) pin.

◆ nanolr_sw_reset()

void nanolr_sw_reset ( nanolr_t * ctx)

Software reset function.

Parameters
ctxClick object.

@description The function sends a command for the software reset on the device.

◆ nanolr_uart_isr()

void nanolr_uart_isr ( nanolr_t * ctx)

UART ISR function.

Parameters
ctxClick object.

@description The function read response bytes from the device and sets flag after each received byte.

◆ nanolr_wan_network_private()

void nanolr_wan_network_private ( nanolr_t * ctx)

Set LRWAN network type private function.

Parameters
ctxClick object.

@description The function set the LRWAN network type of the module: private.

◆ nanolr_wan_network_public()

void nanolr_wan_network_public ( nanolr_t * ctx)

Set LRWAN network type public function.

Parameters
ctxClick object.

@description The function set the LRWAN network type of the module: public.