uwb 2.0.0.0
uwb.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  uwb_t
 Click ctx object definition. More...
 
struct  uwb_cfg_t
 Click configuration structure definition. More...
 
struct  uwb_dev_t
 Structure for device configuration. More...
 

Macros

#define UWB_MAP_MIKROBUS(cfg, mikrobus)
 
#define UWB_OK   0
 
#define UWB_ERROR   -1
 
#define UWB_SUB_NO   0x00
 
#define UWB_REG_DEV_ID   0x00
 
#define UWB_REG_EU_ID   0x01
 
#define UWB_REG_PAN_ID   0x03
 
#define UWB_REG_SYS_CFG   0x04
 
#define UWB_REG_SYS_CNT   0x06
 
#define UWB_REG_SYS_TX_CTRL   0x08
 
#define UWB_REG_TX_DATA_BUF   0x09
 
#define UWB_REG_DX_TIME   0x0A
 
#define UWB_REG_RX_TIMEOUT   0x0C
 
#define UWB_REG_SYS_CTRL   0x0D
 
#define UWB_REG_SYS_EVENT_MASK   0x0E
 
#define UWB_REG_EVENT_STATUS   0x0F
 
#define UWB_REG_RX_INFO   0x10
 
#define UWB_REG_RX_BUF   0x11
 
#define UWB_REG_RX_QUALITY_INFO   0x12
 
#define UWB_REG_RX_TIME_INTERVAL   0x13
 
#define UWB_REG_RX_TIME_OFFSET   0x14
 
#define UWB_REG_RX_MESSAGE_TOA   0x15
 
#define UWB_REG_TX_MESSAGE_TOS   0x17
 
#define UWB_REG_TX_ANTD   0x18
 
#define UWB_REG_SYS_STATE   0x19
 
#define UWB_REG_ACK_RESPONSE_TIME   0x1A
 
#define UWB_REG_RX_SNIFF_CFG   0x1D
 
#define UWB_REG_TX_POWER   0x1E
 
#define UWB_REG_CHN_CTRL   0x1F
 
#define UWB_REG_SFD   0x21
 
#define UWB_REG_AUTO_GAIN_CFG   0x23
 
#define UWB_REG_EXTERNAL_SYNC   0x24
 
#define UWB_REG_READ_AA_DATA   0x25
 
#define UWB_REG_GPIO_CTRL   0x26
 
#define UWB_REG_DRX_CFG   0x27
 
#define UWB_REG_RF_CFG   0x28
 
#define UWB_REG_TX_CALIBRATION   0x2A
 
#define UWB_REG_FREQ_SYNTH_CTRL   0x2B
 
#define UWB_REG_ALWAYS_ON_REG   0x2C
 
#define UWB_REG_OTP_INTERFACE   0x2D
 
#define UWB_REG_LEAD_EDGE_DET_CTRL   0x2E
 
#define UWB_REG_DIGITAL_DIAG_IF   0x2F
 
#define UWB_REG_POWER_MANAGE_SYS_CTRL   0x36
 
#define UWB_OTP_WRITE   0x00
 
#define UWB_OTP_ADR   0x04
 
#define UWB_OTP_CTRL   0x06
 
#define UWB_OTP_STATUS   0x08
 
#define UWB_OTP_RDAT   0x0A
 
#define UWB_OTP_SRDAT   0x0E
 
#define UWB_OTP_SF   0x12
 
#define UWB_DATA_RATE_110KBSPS   0x00
 
#define UWB_DATA_RATE_850KBSPS   0x01
 
#define UWB_DATA_RATE_6800KBSPS   0x02
 
#define UWB_PULSTE_FREQ_4MHZ   0x00
 
#define UWB_PULSTE_FREQ_16MHZ   0x01
 
#define UWB_PULSTE_FREQ_64MHZ   0x02
 
#define UWB_PREAMBLE_LEN_64   0x01
 
#define UWB_PREAMBLE_LEN_128   0x05
 
#define UWB_PREAMBLE_LEN_256   0x09
 
#define UWB_PREAMBLE_LEN_512   0x0D
 
#define UWB_PREAMBLE_LEN_1024   0x02
 
#define UWB_PREAMBLE_LEN_1536   0x06
 
#define UWB_PREAMBLE_LEN_2048   0x0A
 
#define UWB_PREAMBLE_LEN_4096   0x03
 
#define UWB_PAC_SIZE_8   8
 
#define UWB_PAC_SIZE_16   16
 
#define UWB_PAC_SIZE_32   32
 
#define UWB_PAC_SIZE_64   64
 
#define UWB_CHANNEL_1   1
 
#define UWB_CHANNEL_2   2
 
#define UWB_CHANNEL_3   3
 
#define UWB_CHANNEL_4   4
 
#define UWB_CHANNEL_5   5
 
#define UWB_CHANNEL_7   7
 
#define UWB_PREAMBLE_CODE_1   1
 
#define UWB_PREAMBLE_CODE_2   2
 
#define UWB_PREAMBLE_CODE_3   3
 
#define UWB_PREAMBLE_CODE_4   4
 
#define UWB_PREAMBLE_CODE_5   5
 
#define UWB_PREAMBLE_CODE_6   6
 
#define UWB_PREAMBLE_CODE_7   7
 
#define UWB_PREAMBLE_CODE_8   8
 
#define UWB_PREAMBLE_CODE_9   9
 
#define UWB_PREAMBLE_CODE_10   10
 
#define UWB_PREAMBLE_CODE_11   11
 
#define UWB_PREAMBLE_CODE_12   12
 
#define UWB_PREAMBLE_CODE_13   13
 
#define UWB_PREAMBLE_CODE_14   14
 
#define UWB_PREAMBLE_CODE_15   15
 
#define UWB_PREAMBLE_CODE_16   16
 
#define UWB_PREAMBLE_CODE_17   17
 
#define UWB_PREAMBLE_CODE_18   18
 
#define UWB_PREAMBLE_CODE_19   19
 
#define UWB_PREAMBLE_CODE_20   20
 
#define UWB_PREAMBLE_CODE_21   21
 
#define UWB_PREAMBLE_CODE_22   22
 
#define UWB_PREAMBLE_CODE_23   23
 
#define UWB_PREAMBLE_CODE_24   24
 
#define UWB_FRAME_LEN_NORMAL   0x00
 
#define UWB_FRAME_LEN_EXTENDED   0x03
 
#define UWB_HIGH   1
 
#define UWB_LOW   0
 
#define UWB_DEV_ERROR   0xFF
 
#define UWB_DEV_OK   0x00
 
#define UWB_MODE_IDLE   1
 
#define UWB_MODE_RX   2
 
#define UWB_MODE_TX   3
 
#define UWB_TAG   0xDECA
 
#define WRITE_MASK   0x80
 
#define SUB_MASK   0x40
 
#define READ_MASK   0x00
 
#define SUB_EXT_MASK   0x80
 
#define AGC_TUNE1_SUB   0x04
 
#define AGC_TUNE2_SUB   0x0C
 
#define AGC_TUNE3_SUB   0x12
 
#define LEN_AGC_TUNE1   2
 
#define LEN_AGC_TUNE2   4
 
#define LEN_AGC_TUNE3   2
 
#define DRX_TUNE0b_SUB   0x02
 
#define DRX_TUNE1a_SUB   0x04
 
#define DRX_TUNE1b_SUB   0x06
 
#define DRX_TUNE2_SUB   0x08
 
#define DRX_TUNE4H_SUB   0x26
 
#define LEN_DRX_TUNE0b   2
 
#define LEN_DRX_TUNE1a   2
 
#define LEN_DRX_TUNE1b   2
 
#define LEN_DRX_TUNE2   4
 
#define LEN_DRX_TUNE4H   2
 
#define LDE_CFG1_SUB   0x0806
 
#define LDE_RXANTD_SUB   0x1804
 
#define LDE_CFG2_SUB   0x1806
 
#define LDE_REPC_SUB   0x2804
 
#define LEN_LDE_CFG1   1
 
#define LEN_LDE_CFG2   2
 
#define LEN_LDE_REPC   2
 
#define LEN_LDE_RXANTD   2
 
#define LEN_TX_POWER   4
 
#define RF_RXCTRLH_SUB   0x0B
 
#define RF_TXCTRL_SUB   0x0C
 
#define LEN_RF_RXCTRLH   1
 
#define LEN_RF_TXCTRL   4
 
#define TC_PGDELAY_SUB   0x0B
 
#define LEN_TC_PGDELAY   1
 
#define TC_SARC   0x00
 
#define TC_SARL   0x03
 
#define FS_PLLCFG_SUB   0x07
 
#define FS_PLLTUNE_SUB   0x0B
 
#define FS_XTALT_SUB   0x0E
 
#define LEN_FS_PLLCFG   4
 
#define LEN_FS_PLLTUNE   1
 
#define LEN_FS_XTALT   1
 
#define DUMMY_BUFFER   1024
 
#define UWB_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define UWB_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 

Functions

void uwb_cfg_setup (uwb_cfg_t *cfg)
 Config Object Initialization function.
 
err_t uwb_init (uwb_t *ctx, uwb_cfg_t *cfg)
 Initialization function.
 
void uwb_generic_write (uwb_t *ctx, uint8_t reg_adr, uint8_t *tx_buf, uint16_t buf_len)
 Function for writing data to register.
 
void uwb_generic_read (uwb_t *ctx, uint8_t reg_adr, uint8_t *rx_buf, uint16_t buf_len)
 Function for reading data from register.
 
void uwb_set_rst_pin_status (uwb_t *ctx, uint8_t status)
 Function for setting rst pin status.
 
uint8_t uwb_get_qint_pin_status (uwb_t *ctx)
 Function for getting irq pin status.
 
void uwb_read_otp (uwb_t *ctx, uint16_t otp_adr, uint8_t *rx_buf)
 Function for reading OTM memory.
 
void uwb_set_bit (uwb_t *ctx, uint8_t reg_adr, uint16_t bit_num, uint8_t bit_state)
 Function for setting single bit state.
 
uint8_t uwb_get_bit (uwb_t *ctx, uint8_t reg_adr, uint16_t bit_num)
 Function for getting single bit state.
 
uint16_t uwb_reg_data_len (uint8_t reg_adr)
 Function for getting length of register data.
 
void uwb_set_dev_adr_n_network_id (uwb_t *ctx, uint16_t dev_adr, uint16_t net_id)
 Function for setting device address and network ID.
 
uint8_t uwb_set_data_rate (uwb_t *ctx, uint8_t rate)
 Function for setting data rate.
 
void uwb_set_pulse_freq (uwb_t *ctx, uint8_t freq)
 Function for setting pulse frequency.
 
void uwb_set_preamble_len (uwb_t *ctx, uint8_t prealen)
 Function for setting preamble length.
 
void uwb_set_preable_code (uwb_t *ctx, uint8_t preamble)
 Function for setting preamble code.
 
void uwb_set_channel (uwb_t *ctx, uint8_t channel)
 Function for setting channel.
 
void uwb_set_transmit_type (uwb_t *ctx, const uint8_t *t_t)
 Function for setting transmit type mode.
 
void uwb_get_transmit (uwb_t *ctx, uint8_t *rx_buf, uint16_t len_buf)
 Function for getting transmit data.
 
uint8_t uwb_get_transmit_len (uwb_t *ctx)
 Function for getting transmit length.
 
void uwb_set_transmit (uwb_t *ctx, uint8_t *tx_buf, uint16_t len_buf)
 Function for setting transmit data.
 
void uwb_use_smart_power (uwb_t *ctx, uint8_t smart_power)
 Function for setting smart power option.
 
void uwb_frame_check (uint8_t fc_val)
 Function for setting frame check option.
 
void uwb_frame_filter (uwb_t *ctx, uint8_t ff_val)
 Function for setting frame filter option.
 
void uwb_set_mode (uwb_t *ctx, uint8_t mode)
 Function for setting device working mode.
 
void uwb_start_transceiver (uwb_t *ctx)
 Function for starting communication of device.
 
uint8_t uwb_get_transmit_status (uwb_t *ctx)
 Function for getting transmit status.
 
void uwb_clear_status (uwb_t *ctx)
 Function for clearing status.
 
void uwb_int_mask_set (uwb_t *ctx)
 Function for setting interrupt mask.
 
void uwb_tune_config (uwb_t *ctx)
 Function for tuneing configuration for set values.
 
void uwb_dev_reset (uwb_t *ctx)
 Function for reseting device.
 
void uwb_enable (uwb_t *ctx)
 Function for enabling device.
 

Variables

const uint8_t UWB_TMODE_LONGDATA_RANGE_LOWPOWER [3]
 
const uint8_t UWB_TMODE_LONGDATA_RANGE_ACCURACY [3]
 
const uint8_t UWB_TMODE_LONGDATA_FAST_LOWPOWER [3]
 
const uint8_t UWB_TMODE_LONGDATA_FAST_ACCURACY [3]
 
const uint8_t UWB_TMODE_SHORTDATA_FAST_LOWPOWER [3]
 
const uint8_t UWB_TMODE_SHORTDATA_FAST_ACCURACY [3]
 

Detailed Description

This file contains API for UWB Click driver.