nrfxlib API 0.1.0
Loading...
Searching...
No Matches
nrf_gzll.h File Reference

Gazell Link Layer API. More...

#include <stdbool.h>
#include "nrf.h"
#include "nrf_gzll_constants.h"

Go to the source code of this file.

Data Structures

struct  nrf_gzll_device_tx_info_t
 Data structure containing information about the last packet transmission. More...
 
struct  nrf_gzll_host_rx_info_t
 Data structure containing information about the last packet received. More...
 
struct  nrf_gzll_tx_statistics_t
 

Typedefs

typedef void(* nrf_gzll_tx_timeout_callback) (uint32_t pipe, uint8_t rf_channel)
 
typedef void(* nrf_gzll_crc_failure_callback) (uint32_t pipe, uint8_t rf_channel)
 
typedef void(* nrf_gzll_tick_timer_expired_callback) (void)
 

Enumerations

enum  nrf_gzll_mode_t { NRF_GZLL_MODE_DEVICE , NRF_GZLL_MODE_HOST , NRF_GZLL_MODE_SUSPEND }
 Enumerator used for selecting Gazell mode. More...
 
enum  nrf_gzll_device_channel_selection_policy_t { NRF_GZLL_DEVICE_CHANNEL_SELECTION_POLICY_USE_SUCCESSFUL , NRF_GZLL_DEVICE_CHANNEL_SELECTION_POLICY_USE_CURRENT }
 Enumerator used for selecting Gazell Device channel selection policy. More...
 
enum  nrf_gzll_tx_power_t {
  NRF_GZLL_TX_POWER_8_DBM , NRF_GZLL_TX_POWER_7_DBM , NRF_GZLL_TX_POWER_6_DBM , NRF_GZLL_TX_POWER_5_DBM ,
  NRF_GZLL_TX_POWER_4_DBM , NRF_GZLL_TX_POWER_3_DBM , NRF_GZLL_TX_POWER_2_DBM , NRF_GZLL_TX_POWER_0_DBM ,
  NRF_GZLL_TX_POWER_N4_DBM , NRF_GZLL_TX_POWER_N8_DBM , NRF_GZLL_TX_POWER_N12_DBM , NRF_GZLL_TX_POWER_N16_DBM ,
  NRF_GZLL_TX_POWER_N20_DBM , NRF_GZLL_TX_POWER_N40_DBM
}
 Enumerator used for selecting the transmit (TX) power. More...
 
enum  nrf_gzll_datarate_t { NRF_GZLL_DATARATE_1MBIT = 1 , NRF_GZLL_DATARATE_2MBIT = 2 , NRF_GZLL_DATARATE_1MBIT_BLE = 3 , NRF_GZLL_DATARATE_2MBIT_BLE = 4 }
 Enumerator used for selecting the radio datarate. More...
 
enum  nrf_gzll_xosc_ctl_t { NRF_GZLL_XOSC_CTL_AUTO , NRF_GZLL_XOSC_CTL_MANUAL }
 Enumerator used for specifying whether switching the external high frequency oscillator on/off shall be handled automatically inside Gazell or manually by the application. More...
 
enum  nrf_gzll_error_code_t {
  NRF_GZLL_ERROR_CODE_NO_ERROR = 0 , NRF_GZLL_ERROR_CODE_FAILED_TO_INITIALIZE = 1 , NRF_GZLL_ERROR_CODE_ATTEMPTED_TO_CONFIGURE_WHEN_ENABLED = 2 , NRF_GZLL_ERROR_CODE_POINTER_IS_NULL = 3 ,
  NRF_GZLL_ERROR_CODE_INVALID_PIPE = 4 , NRF_GZLL_ERROR_CODE_INVALID_MODE = 5 , NRF_GZLL_ERROR_CODE_INVALID_PAYLOAD_LENGTH = 6 , NRF_GZLL_ERROR_CODE_INVALID_CHANNEL_TABLE_SIZE = 7 ,
  NRF_GZLL_ERROR_CODE_INSUFFICIENT_PACKETS_AVAILABLE = 8 , NRF_GZLL_ERROR_CODE_ATTEMPTED_TO_ADD_TO_FULL_FIFO = 9 , NRF_GZLL_ERROR_CODE_NO_SPACE_IN_RX_FIFO_FOR_ACK = 10 , NRF_GZLL_ERROR_CODE_ATTEMPTED_TO_FETCH_FROM_EMPTY_FIFO = 11 ,
  NRF_GZLL_ERROR_CODE_ATTEMPTED_TO_FLUSH_WHEN_ENABLED = 12 , NRF_GZLL_ERROR_CODE_INVALID_PARAMETER = 14 , NRF_GZLL_ERROR_CODE_INTERNAL_ASSERT_OCCURRED = 15 , NRF_GZLL_ERROR_CODE_CALLBACK_NOT_IMPLEMENTED = 16 ,
  NRF_GZLL_ERROR_CODE_INVALID_ADDRESS = 17 , NRF_GZLL_ERROR_CODE_NUMBER_OF_ERROR_CODES = 18
}
 Enumerator used for error codes for Gazell API functions. More...
 

Functions

General API functions
bool nrf_gzll_init (nrf_gzll_mode_t mode)
 Initialize Gazell.
 
bool nrf_gzll_enable (void)
 Enable Gazell.
 
void nrf_gzll_disable (void)
 Disable Gazell.
 
bool nrf_gzll_is_enabled (void)
 
Device mode callback functions
void nrf_gzll_device_tx_success (uint32_t pipe, nrf_gzll_device_tx_info_t tx_info)
 ACK received callback (Device mode only).
 
void nrf_gzll_device_tx_failed (uint32_t pipe, nrf_gzll_device_tx_info_t tx_info)
 Transmission failed callback (Device mode only).
 
Host mode callback functions
void nrf_gzll_host_rx_data_ready (uint32_t pipe, nrf_gzll_host_rx_info_t rx_info)
 Data packet received callback (Host mode only).
 
Callback functions for both Device and Host mode
void nrf_gzll_disabled (void)
 Disabled callback.
 
void nrf_gzll_mode_changed (void)
 Mode changed callback.
 
Packet transmission and receiving functions
bool nrf_gzll_add_packet_to_tx_fifo (uint32_t pipe, uint8_t const *p_payload, uint32_t length)
 Add a packet to the tail of the TX FIFO.
 
bool nrf_gzll_fetch_packet_from_rx_fifo (uint32_t pipe, uint8_t *p_payload, uint32_t *p_length)
 Fetch a packet from the head of the RX FIFO.
 
int32_t nrf_gzll_get_tx_fifo_packet_count (uint32_t pipe)
 Get the number of packets in the TX FIFO on a specific pipe.
 
int32_t nrf_gzll_get_rx_fifo_packet_count (uint32_t pipe)
 Get the number of packets in the RX FIFO on a specific pipe.
 
uint32_t nrf_gzll_get_total_allocated_packet_count (void)
 Get the total number of packets residing in all TX and RX FIFOs.
 
bool nrf_gzll_ok_to_add_packet_to_tx_fifo (uint32_t pipe)
 Check if adding a packet to a pipe's TX FIFO should be successful.
 
bool nrf_gzll_flush_tx_fifo (uint32_t pipe)
 Flush the RX FIFO for a specific pipe.
 
bool nrf_gzll_flush_rx_fifo (uint32_t pipe)
 Flush the RX FIFO for a specific pipe.
 
bool nrf_gzll_tx_statistics_enable (nrf_gzll_tx_statistics_t *p_statistics)
 Function for enabling transmission statistics.
 
void nrf_gzll_tx_statistics_disable (void)
 Function for disabling transmission statistics.
 
bool nrf_gzll_get_channel_timeouts (uint8_t channel_index, uint32_t *p_timeouts)
 Function for obtaining number of transmission timeouts for specific channel.
 
void nrf_gzll_reset_tx_statistics (void)
 Function for clearing transmission statistic structure.
 
Configuration functions

Configuration 'set' functions may only be called while Gazell is disabled. The new parameter comes into effect when Gazell is enabled again.

Configuration 'get' functions may be called at any time.

void nrf_gzll_tx_timeout_callback_register (nrf_gzll_tx_timeout_callback callback)
 Function for registering callback to be called on the transmission timeout.
 
void nrf_gzll_crc_failure_callback_register (nrf_gzll_crc_failure_callback callback)
 Function for registering callback to be called on the packet CRC failure.
 
bool nrf_gzll_set_mode (nrf_gzll_mode_t mode)
 Set the mode.
 
nrf_gzll_mode_t nrf_gzll_get_mode (void)
 Get function counterpart to nrf_gzll_set_mode().
 
bool nrf_gzll_set_base_address_0 (uint32_t base_address)
 Set the base address for pipe 0.
 
uint32_t nrf_gzll_get_base_address_0 (void)
 Get function counterpart to nrf_gzll_set_base_address_0().
 
bool nrf_gzll_set_base_address_1 (uint32_t base_address)
 Set the base address for pipes 1-7.
 
uint32_t nrf_gzll_get_base_address_1 (void)
 Get function counterpart to nrf_gzll_set_base_address_1().
 
bool nrf_gzll_set_address_prefix_byte (uint32_t pipe, uint8_t address_prefix_byte)
 Set the address prefix byte for a specific pipe.
 
bool nrf_gzll_get_address_prefix_byte (uint32_t pipe, uint8_t *p_out_address_prefix_byte)
 Get function counterpart to nrf_gzll_set_address_prefix_byte().
 
bool nrf_gzll_set_rx_pipes_enabled (uint32_t pipes)
 Set which pipes shall listen for packets in Host mode.
 
uint32_t nrf_gzll_get_rx_pipes_enabled (void)
 Get function counterpart to nrf_gzll_set_rx_pipes_enabled().
 
bool nrf_gzll_set_timeslot_period (uint32_t period_us)
 Set the timeslot period.
 
uint32_t nrf_gzll_get_timeslot_period (void)
 Get function counterpart to nrf_gzll_get_timeslot_period().
 
bool nrf_gzll_set_device_channel_selection_policy (nrf_gzll_device_channel_selection_policy_t policy)
 Set the Device channel selection policy.
 
nrf_gzll_device_channel_selection_policy_t nrf_gzll_get_device_channel_selection_policy (void)
 Get function counterpart to nrf_gzll_set_device_channel_selection_policy().
 
bool nrf_gzll_set_timeslots_per_channel (uint32_t timeslots)
 Set the number of timeslots that Gazell shall reside on a single channel before switching to another channel.
 
uint32_t nrf_gzll_get_timeslots_per_channel (void)
 Get function counterpart to nrf_gzll_set_timeslots_per_channel().
 
bool nrf_gzll_set_timeslots_per_channel_when_device_out_of_sync (uint32_t timeslots)
 Set the number of timeslots that a Gazell shall reside on a single channel before switching to another channel when in the "out of sync" state.
 
uint32_t nrf_gzll_get_timeslots_per_channel_when_device_out_of_sync (void)
 Get function counterpart to nrf_gzll_set_timeslots_per_channel_when_device_out_of_sync().
 
bool nrf_gzll_set_sync_lifetime (uint32_t lifetime)
 Set the number of timeslots after a successful reception of a Device or Host packet that the Gazell Link Layer shall assume that the link is synchronized. A value of 0 implies that the link is always out of sync.
 
uint32_t nrf_gzll_get_sync_lifetime (void)
 Get function counterpart to nrf_gzll_set_sync_lifetime().
 
void nrf_gzll_set_max_tx_attempts (uint16_t max_tx_attempts)
 Set the maximum number of TX attempts that can be used for a single packet.
 
uint16_t nrf_gzll_get_max_tx_attempts (void)
 Get function counterpart to nrf_gzll_set_max_tx_attempts().
 
bool nrf_gzll_set_channel_table (uint8_t *p_channel_table, uint32_t size)
 Set the table of Radio Frequency (RF) channels.
 
bool nrf_gzll_get_channel_table (uint8_t *p_channel_table, uint32_t *p_size)
 Get the table of Radio Frequency (RF) channels.
 
uint32_t nrf_gzll_get_channel_table_size (void)
 Get the current channel table size.
 
bool nrf_gzll_set_tx_power (nrf_gzll_tx_power_t tx_power)
 Set the radio TX power.
 
nrf_gzll_tx_power_t nrf_gzll_get_tx_power (void)
 Get function counterpart to nrf_gzll_set_tx_power().
 
bool nrf_gzll_set_datarate (nrf_gzll_datarate_t data_rate)
 Set the radio datarate.
 
nrf_gzll_datarate_t nrf_gzll_get_datarate (void)
 Get function counterpart to nrf_gzll_set_datarate().
 
bool nrf_gzll_set_xosc_ctl (nrf_gzll_xosc_ctl_t xosc_ctl)
 Set whether start/stop of external oscillator (XOSC) shall be handled automatically inside Gazell or manually by the application.
 
nrf_gzll_xosc_ctl_t nrf_gzll_get_xosc_ctl (void)
 
void nrf_gzll_set_auto_disable (uint32_t num_ticks)
 Set Gazell to disable automatically after a certain number of timeslot ticks.
 
uint32_t nrf_gzll_get_tick_count (void)
 Get the number of timeslot ticks that have occurred since nrf_gzll_init() was called.
 
void nrf_gzll_clear_tick_count (void)
 Clear the internal timeslot tick count variable that is read by nrf_gzll_get_tick_count().
 
bool nrf_gzll_set_tick_timer (uint32_t num_ticks, nrf_gzll_tick_timer_expired_callback callback)
 Set a timeslot tick timer.
 
Error handling functions
nrf_gzll_error_code_t nrf_gzll_get_error_code (void)
 Gets the Gazell error code.
 
void nrf_gzll_reset_error_code (void)
 Reset the Gazell error code.
 

Detailed Description

Gazell Link Layer API.