lightranger10 2.0.0.0
lightranger10.h File Reference

This file contains API for LightRanger 10 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  lightranger10_t
 LightRanger 10 Click context object. More...
 
struct  lightranger10_cfg_t
 LightRanger 10 Click configuration object. More...
 

Macros

#define LIGHTRANGER10_REG_SOFT_RESET   0x0000
 LightRanger 10 register list.
 
#define LIGHTRANGER10_REG_ALGO_PTP_RANGE_OFFSET_MM   0x001E
 
#define LIGHTRANGER10_REG_MM_CFG_INNER_OFFSET_MM   0x0020
 
#define LIGHTRANGER10_REG_MM_CFG_OUTER_OFFSET_MM   0x0022
 
#define LIGHTRANGER10_REG_RANGE_CFG_VCSEL_PERIOD_A   0x0060
 
#define LIGHTRANGER10_REG_RANGE_CFG_VCSEL_PERIOD_B   0x0063
 
#define LIGHTRANGER10_REG_RANGE_CFG_VALID_PHASE_HIGH   0x0069
 
#define LIGHTRANGER10_REG_SD_CFG_WOI_SD0   0x0078
 
#define LIGHTRANGER10_REG_SD_CFG_WOI_SD1   0x0079
 
#define LIGHTRANGER10_REG_SD_CFG_INIT_PHASE_SD0   0x007A
 
#define LIGHTRANGER10_REG_SD_CFG_INIT_PHASE_SD1   0x007B
 
#define LIGHTRANGER10_REG_SYSTEM_INT_MEAS_PERIOD   0x006C
 
#define LIGHTRANGER10_REG_SYSTEM_INTERRUPT_CLEAR   0x0086
 
#define LIGHTRANGER10_REG_SYSTEM_MODE_START   0x0087
 
#define LIGHTRANGER10_REG_RESULT_RANGE_MM_SD0   0x0096
 
#define LIGHTRANGER10_REG_RESULT_OSC_CALIBRATE_VAL   0x00DE
 
#define LIGHTRANGER10_REG_MODEL_ID   0x010F
 
#define LIGHTRANGER10_REG_MODEL_TYPE   0x0110
 
#define LIGHTRANGER10_SOFT_RESET_SET   0x00
 LightRanger 10 soft reset settings.
 
#define LIGHTRANGER10_SOFT_RESET_CLEAR   0x01
 
#define LIGHTRANGER10_INTERRUPT_CLEAR   0x01
 LightRanger 10 interrupt clear settings.
 
#define LIGHTRANGER10_RANGING_ENABLE   0x40
 LightRanger 10 ranging enable values.
 
#define LIGHTRANGER10_RANGING_DISABLE   0x00
 
#define LIGHTRANGER10_DISTANCE_MODE_MEDIUM   0x00
 LightRanger 10 distance mode values.
 
#define LIGHTRANGER10_DISTANCE_MODE_LONG   0x01
 
#define LIGHTRANGER10_DISTANCE_MEDIUM_RANGE_PERIOD_A   0x0B
 LightRanger 10 distance config values.
 
#define LIGHTRANGER10_DISTANCE_MEDIUM_RANGE_PERIOD_B   0x09
 
#define LIGHTRANGER10_DISTANCE_MEDIUM_RANGE_VAL_PH_H   0x78
 
#define LIGHTRANGER10_DISTANCE_MEDIUM_SD_WOI_SD0   0x0B
 
#define LIGHTRANGER10_DISTANCE_MEDIUM_SD_WOI_SD1   0x09
 
#define LIGHTRANGER10_DISTANCE_MEDIUM_SD_IN_PH_SD0   0x0A
 
#define LIGHTRANGER10_DISTANCE_MEDIUM_SD_IN_PH_SD1   0x0A
 
#define LIGHTRANGER10_DISTANCE_LONG_RANGE_PERIOD_A   0x0F
 
#define LIGHTRANGER10_DISTANCE_LONG_RANGE_PERIOD_B   0x0D
 
#define LIGHTRANGER10_DISTANCE_LONG_RANGE_VAL_PH_H   0xB8
 
#define LIGHTRANGER10_DISTANCE_LONG_SD_WOI_SD0   0x0F
 
#define LIGHTRANGER10_DISTANCE_LONG_SD_WOI_SD1   0x0D
 
#define LIGHTRANGER10_DISTANCE_LONG_SD_IN_PH_SD0   0x0E
 
#define LIGHTRANGER10_DISTANCE_LONG_SD_IN_PH_SD1   0x0E
 
#define LIGHTRANGER10_ALGO_PTP_RANGE_OFFSET_MM_MULT   4
 LightRanger 10 distance offset calculation settings.
 
#define LIGHTRANGER10_ALGO_PTP_RANGE_OFFSET_MM_RESET   0
 
#define LIGHTRANGER10_MM_CFG_INNER_OFFSET_MM_RESET   0
 
#define LIGHTRANGER10_MM_CFG_OUTER_OFFSET_MM_RESET   0
 
#define LIGHTRANGER10_CALIBRATE_DISTANCE_AVERAGE_NUM   20
 
#define LIGHTRANGER10_DEFAULT_IM_PERIOD_MS   200
 LightRanger 10 intermeasurement period settings.
 
#define LIGHTRANGER10_OSC_CALIB_IM_PERIOD_OFFSET   4
 
#define LIGHTRANGER10_MODEL_ID   0xEB
 LightRanger 10 model ID and type values.
 
#define LIGHTRANGER10_MODEL_TYPE   0xAA
 
#define LIGHTRANGER10_DEVICE_ADDRESS   0x29
 LightRanger 10 device address setting.
 
#define LIGHTRANGER10_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  lightranger10_return_value_t { LIGHTRANGER10_OK = 0 , LIGHTRANGER10_ERROR = -1 }
 LightRanger 10 Click return value data. More...
 

Functions

void lightranger10_cfg_setup (lightranger10_cfg_t *cfg)
 LightRanger 10 configuration object setup function.
 
err_t lightranger10_init (lightranger10_t *ctx, lightranger10_cfg_t *cfg)
 LightRanger 10 initialization function.
 
err_t lightranger10_default_cfg (lightranger10_t *ctx)
 LightRanger 10 default configuration function.
 
err_t lightranger10_generic_write (lightranger10_t *ctx, uint16_t reg, uint8_t *data_in, uint8_t len)
 LightRanger 10 I2C writing function.
 
err_t lightranger10_generic_read (lightranger10_t *ctx, uint16_t reg, uint8_t *data_out, uint8_t len)
 LightRanger 10 I2C reading function.
 
err_t lightranger10_write_byte (lightranger10_t *ctx, uint16_t reg, uint8_t data_in)
 LightRanger 10 write byte function.
 
err_t lightranger10_read_byte (lightranger10_t *ctx, uint16_t reg, uint8_t *data_out)
 LightRanger 10 read byte function.
 
err_t lightranger10_write_word (lightranger10_t *ctx, uint16_t reg, uint16_t data_in)
 LightRanger 10 write word function.
 
err_t lightranger10_read_word (lightranger10_t *ctx, uint16_t reg, uint16_t *data_out)
 LightRanger 10 read word function.
 
err_t lightranger10_write_dword (lightranger10_t *ctx, uint16_t reg, uint32_t data_in)
 LightRanger 10 write dword function.
 
err_t lightranger10_read_dword (lightranger10_t *ctx, uint16_t reg, uint16_t *data_out)
 LightRanger 10 read dword function.
 
err_t lightranger10_check_communication (lightranger10_t *ctx)
 LightRanger 10 check communication function.
 
uint8_t lightranger10_get_int_pin (lightranger10_t *ctx)
 LightRanger 10 get int pin function.
 
void lightranger10_enable_device (lightranger10_t *ctx)
 LightRanger 10 enable device function.
 
void lightranger10_disable_device (lightranger10_t *ctx)
 LightRanger 10 disable device function.
 
void lightranger10_reset_device (lightranger10_t *ctx)
 LightRanger 10 reset device function.
 
err_t lightranger10_soft_reset (lightranger10_t *ctx)
 LightRanger 10 soft reset function.
 
err_t lightranger10_clear_interrupts (lightranger10_t *ctx)
 LightRanger 10 clear interrupts function.
 
err_t lightranger10_set_inter_measurement_period_ms (lightranger10_t *ctx, uint32_t period_ms)
 LightRanger 10 set inter measurement period ms function.
 
err_t lightranger10_set_distance_offset (lightranger10_t *ctx, int16_t offset_mm)
 LightRanger 10 set distance offset function.
 
err_t lightranger10_calibrate_distance (lightranger10_t *ctx, uint16_t target_distance_mm)
 LightRanger 10 calibrate distance function.
 
err_t lightranger10_set_distance_mode (lightranger10_t *ctx, uint8_t distance_mode)
 LightRanger 10 set distance mode function.
 
err_t lightranger10_start_measurement (lightranger10_t *ctx)
 LightRanger 10 start measurement function.
 
err_t lightranger10_stop_measurement (lightranger10_t *ctx)
 LightRanger 10 stop measurement function.
 
err_t lightranger10_get_distance (lightranger10_t *ctx, uint16_t *distance_mm)
 LightRanger 10 get distance function.
 

Detailed Description

This file contains API for LightRanger 10 Click Driver.

Enumeration Type Documentation

◆ lightranger10_return_value_t

LightRanger 10 Click return value data.

Predefined enum values for driver return values.

Enumerator
LIGHTRANGER10_OK 
LIGHTRANGER10_ERROR