lightranger2 2.0.0.0
lightranger2.h File Reference

This file contains API for LightRanger 2 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  lightranger2_t
 Click ctx object definition. More...
 
struct  lightranger2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define LIGHTRANGER2_MAP_MIKROBUS(cfg, mikrobus)
 
#define LIGHTRANGER2_RETVAL   uint8_t
 
#define LIGHTRANGER2_OK   0x00
 
#define LIGHTRANGER2_INIT_ERROR   0xFF
 
#define LIGHTRANGER2_I2C_ADDR   0x29
 
#define LIGHTRANGER2_SYSRANGE_START   0x00
 
#define LIGHTRANGER2_SYSTEM_THRESH_HIGH   0x0C
 
#define LIGHTRANGER2_SYSTEM_THRESH_LOW   0x0E
 
#define LIGHTRANGER2_SYSTEM_SEQUENCE_CONFIG   0x01
 
#define LIGHTRANGER2_SYSTEM_RANGE_CONFIG   0x09
 
#define LIGHTRANGER2_SYSTEM_INTERMEASUREMENT_PERIOD   0x04
 
#define LIGHTRANGER2_SYSTEM_INTERRUPT_CONFIG_GPIO   0x0A
 
#define LIGHTRANGER2_GPIO_HV_MUX_ACTIVE_HIGH   0x84
 
#define LIGHTRANGER2_SYSTEM_INTERRUPT_CLEAR   0x0B
 
#define LIGHTRANGER2_RESULT_INTERRUPT_STATUS   0x13
 
#define LIGHTRANGER2_RESULT_RANGE_STATUS   0x14
 
#define LIGHTRANGER2_RESULT_CORE_AMBIENT_WINDOW_EVENTS_RTN   0xBC
 
#define LIGHTRANGER2_RESULT_CORE_RANGING_TOTAL_EVENTS_RTN   0xC0
 
#define LIGHTRANGER2_RESULT_CORE_AMBIENT_WINDOW_EVENTS_REF   0xD0
 
#define LIGHTRANGER2_RESULT_CORE_RANGING_TOTAL_EVENTS_REF   0xD4
 
#define LIGHTRANGER2_RESULT_PEAK_SIGNAL_RATE_REF   0xB6
 
#define LIGHTRANGER2_ALGO_PART_TO_PART_RANGE_OFFSET_MM   0x28
 
#define LIGHTRANGER2_MSRC_CONFIG_CONTROL   0x60
 
#define LIGHTRANGER2_PRE_RANGE_CONFIG_MIN_SNR   0x27
 
#define LIGHTRANGER2_PRE_RANGE_CONFIG_VALID_PHASE_LOW   0x56
 
#define LIGHTRANGER2_PRE_RANGE_CONFIG_VALID_PHASE_HIGH   0x57
 
#define LIGHTRANGER2_PRE_RANGE_MIN_COUNT_RATE_RTN_LIMIT   0x64
 
#define LIGHTRANGER2_FINAL_RANGE_CONFIG_MIN_SNR   0x67
 
#define LIGHTRANGER2_FINAL_RANGE_CONFIG_VALID_PHASE_LOW   0x47
 
#define LIGHTRANGER2_FINAL_RANGE_CONFIG_VALID_PHASE_HIGH   0x48
 
#define LIGHTRANGER2_FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT   0x44
 
#define LIGHTRANGER2_PRE_RANGE_CONFIG_SIGMA_THRESH_HI   0x61
 
#define LIGHTRANGER2_PRE_RANGE_CONFIG_SIGMA_THRESH_LO   0x62
 
#define LIGHTRANGER2_PRE_RANGE_CONFIG_VCSEL_PERIOD   0x50
 
#define LIGHTRANGER2_PRE_RANGE_CONFIG_TIMEOUT_MACROP_HI   0x51
 
#define LIGHTRANGER2_PRE_RANGE_CONFIG_TIMEOUT_MACROP_LO   0x52
 
#define LIGHTRANGER2_SYSTEM_HISTOGRAM_BIN   0x81
 
#define LIGHTRANGER2_HISTOGRAM_CONFIG_INITIAL_PHASE_SELECT   0x33
 
#define LIGHTRANGER2_HISTOGRAM_CONFIG_READOUT_CTRL   0x55
 
#define LIGHTRANGER2_FINAL_RANGE_CONFIG_VCSEL_PERIOD   0x70
 
#define LIGHTRANGER2_FINAL_RANGE_CONFIG_TIMEOUT_MACROP_HI   0x71
 
#define LIGHTRANGER2_FINAL_RANGE_CONFIG_TIMEOUT_MACROP_LO   0x72
 
#define LIGHTRANGER2_CROSSTALK_COMPENSATION_PEAK_RATE_MCPS   0x20
 
#define LIGHTRANGER2_MSRC_CONFIG_TIMEOUT_MACROP   0x46
 
#define LIGHTRANGER2_SOFT_RESET_GO2_SOFT_RESET_N   0xBF
 
#define LIGHTRANGER2_IDENTIFICATION_MODEL_ID   0xC0
 
#define LIGHTRANGER2_IDENTIFICATION_REVISION_ID   0xC2
 
#define LIGHTRANGER2_OSC_CALIBRATE_VAL   0xF8
 
#define LIGHTRANGER2_GLOBAL_CONFIG_VCSEL_WIDTH   0x32
 
#define LIGHTRANGER2_GLOBAL_CONFIG_SPAD_ENABLES_REF_0   0xB0
 
#define LIGHTRANGER2_GLOBAL_CONFIG_SPAD_ENABLES_REF_1   0xB1
 
#define LIGHTRANGER2_GLOBAL_CONFIG_SPAD_ENABLES_REF_2   0xB2
 
#define LIGHTRANGER2_GLOBAL_CONFIG_SPAD_ENABLES_REF_3   0xB3
 
#define LIGHTRANGER2_GLOBAL_CONFIG_SPAD_ENABLES_REF_4   0xB4
 
#define LIGHTRANGER2_GLOBAL_CONFIG_SPAD_ENABLES_REF_5   0xB5
 
#define LIGHTRANGER2_GLOBAL_CONFIG_REF_EN_START_SELECT   0xB6
 
#define LIGHTRANGER2_DYNAMIC_SPAD_NUM_REQUESTED_REF_SPAD   0x4E
 
#define LIGHTRANGER2_DYNAMIC_SPAD_REF_EN_START_OFFSET   0x4F
 
#define LIGHTRANGER2_POWER_MANAGEMENT_GO1_POWER_FORCE   0x80
 
#define LIGHTRANGER2_VHV_CONFIG_PAD_SCL_SDA__EXTSUP_HV   0x89
 
#define LIGHTRANGER2_ALGO_PHASECAL_LIM   0x30
 
#define LIGHTRANGER2_ALGO_PHASECAL_CONFIG_TIMEOUT   0x30
 
#define LIGHTRANGER2_STATUS_ERR   0x00
 
#define LIGHTRANGER2_STATUS_OK   0x01
 

Functions

void lightranger2_cfg_setup (lightranger2_cfg_t *cfg)
 Config Object Initialization function.
 
LIGHTRANGER2_RETVAL lightranger2_init (lightranger2_t *ctx, lightranger2_cfg_t *cfg)
 Initialization function.
 
LIGHTRANGER2_RETVAL lightranger2_default_cfg (lightranger2_t *ctx)
 Click Default Configuration function.
 
void lightranger2_write_byte (lightranger2_t *ctx, uint8_t reg_address, uint8_t write_data)
 Click Default Configuration function.
 
uint8_t lightranger2_read_byte (lightranger2_t *ctx, uint8_t reg_address)
 Click Default Configuration function.
 
void lightranger2_write_data (lightranger2_t *ctx, uint8_t reg_address, uint16_t write_data)
 Click Default Configuration function.
 
uint16_t lightranger2_read_data (lightranger2_t *ctx, uint8_t reg_address)
 Click Default Configuration function.
 
void lightranger2_write_bytes (lightranger2_t *ctx, uint8_t reg_address, uint8_t *write_data, uint8_t n_bytes)
 Generic sequential data write function.
 
void lightranger2_read_bytes (lightranger2_t *ctx, uint8_t reg_address, uint8_t *read_data, uint8_t n_bytes)
 Generic sequential data read function.
 
void lightranger2_hw_reset (lightranger2_t *ctx)
 Hardware reset function.
 
void lightranger2_enable (lightranger2_t *ctx)
 Enable function.
 
void lightranger2_disable (lightranger2_t *ctx)
 Disable function.
 
uint8_t lightranger2_get_interrupt (lightranger2_t *ctx)
 Get interrupt state function.
 
void lightranger2_start_continuous (lightranger2_t *ctx, uint32_t period_ms)
 Start continuous ranging measurements function.
 
void lightranger2_stop_continuous (lightranger2_t *ctx)
 Stop continuous measurements function.
 
LIGHTRANGER2_RETVAL lightranger2_set_signal_rate_limit (lightranger2_t *ctx, float limit_mcps)
 Set the signal rate limit check value function.
 
float lightranger2_get_signal_rate_limit (lightranger2_t *ctx)
 Get the signal rate limit check value function.
 
LIGHTRANGER2_RETVAL lightranger2_get_spad_info (lightranger2_t *ctx, uint8_t *count_data, uint8_t *aperture_type)
 Get reference SPAD ( single photon avalanche diode ) function.
 
LIGHTRANGER2_RETVAL lightranger2_single_calibration (lightranger2_t *ctx, uint8_t vhv_init_byte)
 Perform single reference calibration function.
 
uint16_t lightranger2_get_range_continuous (lightranger2_t *ctx)
 Get a range measurement ( continuous mode ) function.
 
uint16_t lightranger2_get_range_single (lightranger2_t *ctx)
 Get a range measurement ( single mode ) function.
 

Detailed Description

This file contains API for LightRanger 2 Click driver.