nRF5 SDK for Thread and Zigbee v4.2.0
Macros | Enumerations | Functions
Nordic Semiconductor special functions

Macros

#define ZIGBEE_NRF_LOG_MODULE_NAME   zigbee
 Name of the log module related to Zigbee.
 

Enumerations

enum  addr_type_t { ADDR_INVALID = 0, ADDR_ANY = 1, ADDR_SHORT = 2, ADDR_LONG = 3 }
 Address type. More...
 

Functions

void zb_osif_get_ieee_eui64 (zb_ieee_addr_t ieee_eui64)
 Read IEEE long address from FICR registers. More...
 
void zb_osif_wait_for_event (void)
 Function which waits for event – essential implementation of sleep on NRF52.
 
void zb_osif_go_idle (void)
 Function which tries to sleep down the MCU. More...
 
void zb_nrf52_periph_disable (void)
 Function which disables all Zigbee stack-related peripherals. More...
 
void zb_nrf52_periph_enable (void)
 Function which enables back all Zigbee stack-related peripherals. More...
 
zb_uint32_t zb_osif_sleep (zb_uint32_t sleep_tmo)
 Function which tries to put the device into deep sleep mode, caused by an empty Zigbee stack scheduler queue. More...
 
void zb_osif_wake_up (void)
 Function which is called after zb_osif_sleep finished and ZBOSS timer is reenabled. More...
 
void zigbee_erase_persistent_storage (zb_bool_t erase)
 Function for setting the Erase persistent storage, depending on the erase pin. If the erase pin (1.39 by default, defined in zigbee_helpers.c) is shortened to the ground, then the persistent storage is erased. Otherwise, whether the storage is erased is decided upon the input parameter 'erase'. This behaviour is only valid if PCA10056 is used. More...
 
int to_hex_str (char *p_out, uint16_t out_size, const uint8_t *p_in, uint8_t in_size, bool reverse)
 Function for converting an input buffer to a hex string. More...
 
bool parse_hex_str (char const *p_in_str, uint8_t in_str_len, uint8_t *p_out_buff, uint8_t out_buff_size, bool reverse)
 Read array of uint8_t from hex string. More...
 
static bool parse_hex_u8 (char const *s, uint8_t *p_value)
 Parse a hex string to uint8_t. More...
 
static bool parse_hex_u16 (char const *s, uint16_t *p_value)
 Parse a hex string to uint16_t. More...
 
int ieee_addr_to_str (char *p_str_buf, uint16_t buf_len, const zb_ieee_addr_t p_in)
 Function for converting 64-bit address to hex string. More...
 
addr_type_t parse_address (const char *input, zb_addr_u *output, addr_type_t addr_type)
 Function for parsing a null-terminated string of hex characters into 64-bit or 16-bit address. More...
 
static bool parse_long_address (const char *input, zb_ieee_addr_t addr)
 Function for parsing a null-terminated string of hex characters into a 64-bit address. More...
 
static bool parse_short_address (const char *input, zb_uint16_t *addr)
 Function for parsing a null-terminated string of hex characters into 16-bit address. More...
 
zb_ret_t zigbee_default_signal_handler (zb_bufid_t bufid)
 Function for passing signals to the default Zigbee stack event handler. More...
 
void zigbee_led_status_update (zb_bufid_t bufid, uint32_t led_idx)
 Function for indicating the Zigbee network connection status on LED. If the device is successfully commissioned, the LED is turned on. If the device is not commissioned or has left the network, the LED is turned off. More...
 
void user_input_indicate (void)
 Function for indicating the default signal handler about user input on the device. If the device is not commissioned, the rejoin procedure is started. More...
 
void zigbee_power_down_unused_ram (void)
 Function for powering down unused RAM. Powers down all unused sections in RAM banks.
 

Detailed Description

Enumeration Type Documentation

Address type.

Note
ADDR_SHORT and ADDR_LONG correspond to APS addressing mode constants level_control_client_attr_listand must not be changed.

Function Documentation

int ieee_addr_to_str ( char *  p_str_buf,
uint16_t  buf_len,
const zb_ieee_addr_t  p_in 
)

Function for converting 64-bit address to hex string.

Parameters
[out]p_str_bufPointer to output buffer.
[in]buf_lenLength of the buffer pointed by p_str_buf.
[in]p_inZigbee IEEE address to be converted to string.
Returns
snprintf-compatible value. Less than zero means encoding error. Non-negative value is the number of characters that would have been written if the supplied buffer had been large enough. Value greater than or equal to buf_len means that the supplied buffer was too small.
Note
Null terminator is written if buf_len is large enough, but does not count for the return value.
addr_type_t parse_address ( const char *  input,
zb_addr_u output,
addr_type_t  addr_type 
)

Function for parsing a null-terminated string of hex characters into 64-bit or 16-bit address.

The function will skip 0x suffix from input if present.

Parameters
inputPointer to the input string string representing the address in big endian.
outputPointer to the resulting zb_addr_u variable.
addr_typeExpected address type.
Returns
Conversion result.
bool parse_hex_str ( char const *  p_in_str,
uint8_t  in_str_len,
uint8_t *  p_out_buff,
uint8_t  out_buff_size,
bool  reverse 
)

Read array of uint8_t from hex string.

Parameters
p_in_strPointer to the input hex string.
in_str_lenLength, in characters, of the input string.
p_out_buffPointer to the output uint8_t array.
out_buff_sizeSize, in bytes, of the output uint8_t array.
reverseIf true then parse from end to start.
Return values
trueif the conversion succeed
falseif the conversion failed
static bool parse_hex_u16 ( char const *  s,
uint16_t *  p_value 
)
inlinestatic

Parse a hex string to uint16_t.

The function verifies if input is valid, i.e., if all input characters are valid hex digits. If an invalid character is found then function fails.

Parameters
sPointer to input string.
p_valuePointer to output value.
Return values
trueif the conversion succeed
falseif the conversion failed
static bool parse_hex_u8 ( char const *  s,
uint8_t *  p_value 
)
inlinestatic

Parse a hex string to uint8_t.

The function verifies if input is valid, i.e., if all input characters are valid hex digits. If an invalid character is found then function fails.

Parameters
sPointer to input string.
p_valuePointer to output value.
Return values
trueif the conversion succeed
falseif the conversion failed
static bool parse_long_address ( const char *  input,
zb_ieee_addr_t  addr 
)
inlinestatic

Function for parsing a null-terminated string of hex characters into a 64-bit address.

The function will skip 0x suffix from input if present.

Parameters
inputPointer to the input string representing the address in big endian.
addrVariable where the address will be placed.
Return values
trueif the conversion succeed
falseif the conversion failed
static bool parse_short_address ( const char *  input,
zb_uint16_t addr 
)
inlinestatic

Function for parsing a null-terminated string of hex characters into 16-bit address.

The function will skip 0x suffix from input if present.

Parameters
inputPointer to the input string representing the address in big endian.
addrPointer to the a variable where address will be placed.
Return values
trueif the conversion succeed
falseif the conversion failed
int to_hex_str ( char *  p_out,
uint16_t  out_size,
const uint8_t *  p_in,
uint8_t  in_size,
bool  reverse 
)

Function for converting an input buffer to a hex string.

Parameters
[out]p_outPointer to the output buffer.
[in]out_sizeSize of the output buffer.
[in]p_inPointer to the input buffer.
[in]in_sizeSize of the input buffer.
[in]reverseIf true, data output happens in the reverse order.
Returns
snprintf-compatible value. Less than zero means encoding error. Non-negative value is the number of characters that would have been written if the supplied buffer had been large enough. Value greater than or equal to buf_len means that the supplied buffer was too small.
Note
Null terminator is written if buf_len is large enough, but does not count for the return value.
void user_input_indicate ( void  )

Function for indicating the default signal handler about user input on the device. If the device is not commissioned, the rejoin procedure is started.

Note
This function is to be used with End Devices only.
void zb_nrf52_periph_disable ( void  )

Function which disables all Zigbee stack-related peripherals.

Function is defined as weak; to be redefined if someone wants to implement their own going-to-deep-sleep policy/share resources between Zigbee stack and other components.

void zb_nrf52_periph_enable ( void  )

Function which enables back all Zigbee stack-related peripherals.

Function is defined as weak; to be redefined if someone wants to implement their own going-to-deep-sleep policy/share resources between Zigbee stack and other components.

void zb_osif_get_ieee_eui64 ( zb_ieee_addr_t  ieee_eui64)

Read IEEE long address from FICR registers.

Parameters
[out]ieee_eui64Pointer to a long address structure to be filled.

The 24 oldest bits are filled in by the ZIGBEE_VENDOR_OUI macro and the remainder is taken from the FICR register.

void zb_osif_go_idle ( void  )

Function which tries to sleep down the MCU.

Function is defined as weak; to be redefined if someone wants to implement their own going-to-sleep policy.

zb_uint32_t zb_osif_sleep ( zb_uint32_t  sleep_tmo)

Function which tries to put the device into deep sleep mode, caused by an empty Zigbee stack scheduler queue.

Function is defined as weak; to be redefined if someone wants to implement their own going-to-deep-sleep policy.

void zb_osif_wake_up ( void  )

Function which is called after zb_osif_sleep finished and ZBOSS timer is reenabled.

Function is defined as weak; to be redefined if someone wants to implement their own going-to-deep-sleep policy/share resources between Zigbee stack and other components.

zb_ret_t zigbee_default_signal_handler ( zb_bufid_t  bufid)

Function for passing signals to the default Zigbee stack event handler.

Note
This function does not free the Zigbee buffer.
Parameters
[in]bufidReference to the Zigbee stack buffer used to pass signal.
Returns
RET_OK on success or error code on failure.
void zigbee_erase_persistent_storage ( zb_bool_t  erase)

Function for setting the Erase persistent storage, depending on the erase pin. If the erase pin (1.39 by default, defined in zigbee_helpers.c) is shortened to the ground, then the persistent storage is erased. Otherwise, whether the storage is erased is decided upon the input parameter 'erase'. This behaviour is only valid if PCA10056 is used.

Parameters
[in]eraseWhether to erase the persistent storage in case the erase pin is not shortened to the ground.
void zigbee_led_status_update ( zb_bufid_t  bufid,
uint32_t  led_idx 
)

Function for indicating the Zigbee network connection status on LED. If the device is successfully commissioned, the LED is turned on. If the device is not commissioned or has left the network, the LED is turned off.

Note
This function does not free the Zigbee buffer.
Parameters
[in]bufidReference to the Zigbee stack buffer used to pass signal.
[in]led_idxLED index, as defined in the board-specific BSP header. The index starts from 0.

Documentation feedback | Developer Zone | Subscribe | Updated