ccrf 2.0.0.0
ccrf.h File Reference

This file contains API for ccRF Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  ccrf_t
 Click ctx object definition. More...
 
struct  ccrf_cfg_t
 Click configuration structure definition. More...
 

Macros

#define CCRF_MAP_MIKROBUS(cfg, mikrobus)
 
#define CCRF_OK   0
 
#define CCRF_ERROR   -1
 
#define CCRF_IOCFG2   0x00
 
#define CCRF_IOCFG1   0x01
 
#define CCRF_IOCFG0   0x02
 
#define CCRF_FIFOTHR   0x03
 
#define CCRF_SYNC1   0x04
 
#define CCRF_SYNC0   0x05
 
#define CCRF_PKTLEN   0x06
 
#define CCRF_PKTCTRL1   0x07
 
#define CCRF_PKTCTRL0   0x08
 
#define CCRF_ADDR   0x09
 
#define CCRF_CHANNR   0x0A
 
#define CCRF_FSCTRL1   0x0B
 
#define CCRF_FSCTRL0   0x0C
 
#define CCRF_FREQ2   0x0D
 
#define CCRF_FREQ1   0x0E
 
#define CCRF_FREQ0   0x0F
 
#define CCRF_MDMCFG4   0x10
 
#define CCRF_MDMCFG3   0x11
 
#define CCRF_MDMCFG2   0x12
 
#define CCRF_MDMCFG1   0x13
 
#define CCRF_MDMCFG0   0x14
 
#define CCRF_DEVIATN   0x15
 
#define CCRF_MCSM2   0x16
 
#define CCRF_MCSM1   0x17
 
#define CCRF_MCSM0   0x18
 
#define CCRF_FOCCFG   0x19
 
#define CCRF_BSCFG   0x1A
 
#define CCRF_AGCCTRL2   0x1B
 
#define CCRF_AGCCTRL1   0x1C
 
#define CCRF_AGCCTRL0   0x1D
 
#define CCRF_WOREVT1   0x1E
 
#define CCRF_WOREVT0   0x1F
 
#define CCRF_WORCTRL   0x20
 
#define CCRF_FREND1   0x21
 
#define CCRF_FREND0   0x22
 
#define CCRF_FSCAL3   0x23
 
#define CCRF_FSCAL2   0x24
 
#define CCRF_FSCAL1   0x25
 
#define CCRF_FSCAL0   0x26
 
#define CCRF_RCCTRL1   0x27
 
#define CCRF_RCCTRL0   0x28
 
#define CCRF_FSTEST   0x29
 
#define CCRF_PTEST   0x2A
 
#define CCRF_AGCTEST   0x2B
 
#define CCRF_TEST2   0x2C
 
#define CCRF_TEST1   0x2D
 
#define CCRF_TEST0   0x2E
 
#define CCRF_SRES   0x30
 
#define CCRF_SFSTXON   0x31
 
#define CCRF_SXOFF   0x32
 
#define CCRF_SCAL   0x33
 
#define CCRF_SRX   0x34
 
#define CCRF_STX   0x35
 
#define CCRF_SIDLE   0x36
 
#define CCRF_SAFC   0x37
 
#define CCRF_SWOR   0x38
 
#define CCRF_SPWD   0x39
 
#define CCRF_SFRX   0x3A
 
#define CCRF_SFTX   0x3B
 
#define CCRF_SWORRST   0x3C
 
#define CCRF_SNOP   0x3D
 
#define CCRF_PARTNUM   0x30
 
#define CCRF_VERSION   0x31
 
#define CCRF_FREQEST   0x32
 
#define CCRF_LQI   0x33
 
#define CCRF_RSSI   0x34
 
#define CCRF_MARCSTATE   0x35
 
#define CCRF_WORTIME1   0x36
 
#define CCRF_WORTIME0   0x37
 
#define CCRF_PKTSTATUS   0x38
 
#define CCRF_VCO_VC_DAC   0x39
 
#define CCRF_TXBYTES   0x3A
 
#define CCRF_RXBYTES   0x3B
 
#define CCRF_RCCTRL1_STATUS   0x3C
 
#define CCRF_RCCTRL0_STATUS   0x3D
 
#define CCRF_NUM_RXBYTES   0x7F
 
#define CCRF_PATABLE   0x3E
 
#define CCRF_TXFIFO   0x3F
 
#define CCRF_RXFIFO   0x3F
 
#define CCRF_LQI_RX   0x01
 
#define CCRF_CRC_OK   0x80
 
#define CCRF_WRITE_BURST   0x40
 
#define CCRF_READ_SINGLE   0x80
 
#define CCRF_READ_BURST   0xC0
 
#define CCRF_RECEIVE_CRC_ERROR   0x00
 
#define CCRF_RECEIVE_CRC_OK   0x80
 
#define CCRF_BURST_IN_RXFIFO   0x7F
 
#define CCRF_SINGLE_TXFIFO   0x3F
 
#define CCRF_BURST_TXFIFO   0x7F
 
#define CCRF_SINGLE_RXFIFO   0xBF
 
#define CCRF_BURST_RXFIFO   0xFF
 
#define CCRF_TX_MODE   0
 
#define CCRF_RX_MODE   1
 
#define CCRF_IDLE_MODE   2
 

Functions

void ccrf_cfg_setup (ccrf_cfg_t *cfg)
 Config Object Initialization function.
 
err_t ccrf_init (ccrf_t *ctx, ccrf_cfg_t *cfg)
 Initialization function.
 
void ccrf_default_cfg (ccrf_t *ctx)
 Click Default Configuration function.
 
uint8_t ccrf_get_start (ccrf_t *ctx)
 Get state of GD0 pin function.
 
void ccrf_write_byte (ccrf_t *ctx, uint8_t reg_address, uint8_t write_data)
 Write the byte of data to the 8-bit register address function.
 
void ccrf_write_bytes (ccrf_t *ctx, uint8_t reg_address, uint8_t *write_data, uint8_t n_bytes)
 Sequential write function.
 
void ccrf_write_strobe (ccrf_t *ctx, uint8_t strobe)
 Write a strobe command function.
 
uint8_t ccrf_read_byte (ccrf_t *ctx, uint8_t reg_address)
 Read the byte of data from the 8-bit register address function.
 
uint8_t ccrf_read_byte_status (ccrf_t *ctx, uint8_t reg_address)
 Read the byte of data from the 8-bit status register address function.
 
void ccrf_read_bytes (ccrf_t *ctx, uint8_t reg_address, uint8_t *read_data, uint8_t n_bytes)
 Sequential read function.
 
void ccrf_sw_reset (ccrf_t *ctx)
 Softwere reset function.
 
void ccrf_hw_reset (ccrf_t *ctx)
 Hardware reset function.
 
void ccrf_transmit_packet (ccrf_t *ctx, uint8_t *tx_buffer, uint8_t n_bytes)
 Transmit packet data function.
 
uint8_t ccrf_receive_packet (ccrf_t *ctx, uint8_t *rx_buffer, uint8_t *length_buff)
 Receive packet data function.
 
uint8_t ccrf_transmit_packet_with_address (ccrf_t *ctx, uint8_t *tx_buffer, uint8_t n_bytes, uint8_t *attempts)
 Transmit packet data with address function.
 
void ccrf_set_gd2_active_low (ccrf_t *ctx)
 GD2 select active low function.
 
void ccrf_set_gd2_active_high (ccrf_t *ctx)
 GD2 select active high function.
 
void ccrf_set_gd0_active_low (ccrf_t *ctx)
 GD0 select active low function.
 
void ccrf_set_gd0_active_high (ccrf_t *ctx)
 GD0 select active high function.
 
void ccrf_enable_temperature_sensor (ccrf_t *ctx)
 Enable analog temperature sensor function.
 
void ccrf_disable_temperature_sensor (ccrf_t *ctx)
 Disable analog temperature sensor function.
 
void ccrf_set_fifo_threshold (ccrf_t *ctx, uint8_t threshold_rx_tx)
 Set the threshold for the TX FIFO and RX FIFO function.
 
void ccrf_set_max_length_packets (ccrf_t *ctx, uint8_t max_length)
 Set maximum length packets allowed function.
 
void ccrf_turn_data_whitening_on (ccrf_t *ctx)
 Turn data whitening on function.
 
void ccrf_turn_data_whitening_off (ccrf_t *ctx)
 Turn data whitening off function.
 
void ccrf_format_rx_tx_data (ccrf_t *ctx, uint8_t rx_tx_data_format)
 Set format of RX and TX data function.
 
void ccrf_set_device_address (ccrf_t *ctx, uint8_t dev_addr)
 Set device address function.
 
void ccrf_set_channel_number (ccrf_t *ctx, uint8_t ch_num)
 Set channel number function.
 
void ccrf_set_if_frequency (ccrf_t *ctx, uint8_t if_freq)
 Set desired IF frequency function.
 
void ccrf_set_frequency_offset (ccrf_t *ctx, uint8_t freq_offset)
 Set frequency offset function.
 
void ccrf_disable_dc_blocking_filter (ccrf_t *ctx)
 Disable digital DC blocking filter function.
 
void ccrf_enable_dc_blocking_filter (ccrf_t *ctx)
 Enable digital DC blocking filter function.
 
void ccrf_set_modulation (ccrf_t *ctx, uint8_t rf_modulation)
 Set the modulation format of the radio signal function.
 
void ccrf_enable_manchester_encoding (ccrf_t *ctx)
 Enable Manchester encoding function.
 
void ccrf_disable_manchester_encoding (ccrf_t *ctx)
 Disable Manchester encoding function.
 
void ccrf_set_sync_word_qualifier_mode (ccrf_t *ctx, uint8_t q_mode)
 Set sync-word qualifier mode function.
 
void ccrf_disable_fec (ccrf_t *ctx)
 Disable forward error correction function.
 
void ccrf_enable_fec (ccrf_t *ctx)
 Enable forward error correction function.
 
void ccrf_set_min_num_preamble (ccrf_t *ctx, uint8_t p_num)
 Set the minimum number of preamble bytes to be transmitted function.
 
void ccrf_set_cca_mode (ccrf_t *ctx, uint8_t cca_mode)
 Set CCA mode function.
 
void ccrf_set_state_packet_recived (ccrf_t *ctx, uint8_t pr_state)
 Set state after finishing packet reception function.
 
void ccrf_set_state_packet_sent (ccrf_t *ctx, uint8_t ps_state)
 Set state when a packet has been sent function.
 
void ccrf_set_auto_calibrate_mode (ccrf_t *ctx, uint8_t ac_mode)
 Set automatically calibrate function.
 
void ccrf_set_freq_loop_gain_bs (ccrf_t *ctx, uint8_t fcl_gain)
 Set frequency compensation loop gain before a sync function.
 
void ccrf_set_freq_loop_gain_as (ccrf_t *ctx, uint8_t fcl_gain)
 Set frequency compensation loop gain after a sync function.
 
void ccrf_set_bit_sync_config (ccrf_t *ctx, uint8_t bs_config)
 Set bit synchronization configuration function.
 
void ccrf_set_dvga_gain (ccrf_t *ctx, uint8_t dvga_gain)
 Set the maximum allowable DVGA gain function.
 
void ccrf_set_lna_gain (ccrf_t *ctx, uint8_t lna_gain)
 Set the maximum allowable LNA gain function.
 
void ccrf_set_amplitude_ch_filter (ccrf_t *ctx, uint8_t ach_filter)
 Set the target amplitude from channel filter function.
 
void ccrf_set_lna_strategies (ccrf_t *ctx, uint8_t lna_strat)
 Set the LNA strategies function.
 
void ccrf_set_relative_rssi_threshold (ccrf_t *ctx, uint8_t rssi_threshold)
 Set the relative change threshold for asserting carrier sense function.
 
void ccrf_set_absolute_rssi_threshold (ccrf_t *ctx, uint8_t rssi_threshold)
 Set the rabsolute RSSI threshold for asserting carrier sense function.
 
void ccrf_set_hysteresis_lvl (ccrf_t *ctx, uint8_t hyst_lvl)
 Set the level of hysteresis on the magnitude deviation function.
 
void ccrf_set_num_ch_filter (ccrf_t *ctx, uint8_t num_ch_filter)
 Set the number of channel filter samples function.
 
void ccrf_set_agc_gain (ccrf_t *ctx, uint8_t agc_gain)
 Set the AGC gain function.
 
void ccrf_set_avr_len_ampitude (ccrf_t *ctx, uint8_t al_amp)
 Set the averaging length for the amplitude from the channel filter function.
 
void ccrf_set_auto_initial_calibration (ccrf_t *ctx)
 Set automatic initial calibration function.
 
void ccrf_set_timeout_reg_block (ccrf_t *ctx, uint8_t timeout)
 Set the averaging length for the amplitude from the channel filter function.
 
void ccrf_disable_osc_rc (ccrf_t *ctx)
 Disables the RC oscillator calibration function.
 
void ccrf_enable_osc_rc (ccrf_t *ctx)
 Enable the RC oscillator calibration function.
 
void ccrf_set_timeout_wor (ccrf_t *ctx, uint8_t timeout)
 Set the maximum timeout of the WOR module function.
 
uint8_t ccrf_get_chip_part_number (ccrf_t *ctx)
 Get chip part number function.
 
uint8_t ccrf_get_chip_version_number (ccrf_t *ctx)
 Get chip version number function.
 
uint8_t ccrf_get_rssi (ccrf_t *ctx)
 Get received signal strength indication function.
 
uint8_t ccrf_get_mrc_state (ccrf_t *ctx)
 Get main radio control state machine state function.
 
uint8_t ccrf_get_gd0_and_packet_state (ccrf_t *ctx)
 Get current GDO status and packet status function.
 
uint8_t ccrf_get_underflow_rx_fifo (ccrf_t *ctx)
 Get underflow RX FIFO status function.
 
uint8_t ccrf_get_rx_fifo_num_bytes (ccrf_t *ctx)
 Get number of bytes in RX FIFO function.
 
uint8_t ccrf_get_rc_osc_cal_result (ccrf_t *ctx)
 Get RC oscillator calibration result function.
 

Detailed Description

This file contains API for ccRF Click driver.