lightranger3 2.0.0.0
lightranger3.h File Reference

This file contains API for Light Ranger 3 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  lightranger3_t
 Click ctx object definition. More...
 
struct  lightranger3_cfg_t
 Click configuration structure definition. More...
 

Macros

#define LIGHTRANGER3_MAP_MIKROBUS(cfg, mikrobus)
 
#define LIGHTRANGER3_RETVAL   uint8_t
 
#define LIGHTRANGER3_OK   0x00
 
#define LIGHTRANGER3_INIT_ERROR   0xFF
 
#define LIGHTRANGER3_REG_ICSR   0x00
 
#define LIGHTRANGER3_REG_IER   0x02
 
#define LIGHTRANGER3_REG_CMD   0x04
 
#define LIGHTRANGER3_REG_DEV_STATUS   0x06
 
#define LIGHTRANGER3_REG_RESULT   0x08
 
#define LIGHTRANGER3_REG_RESULT_CONFIG   0x0A
 
#define LIGHTRANGER3_REG_CMD_CONFIG_A   0x0C
 
#define LIGHTRANGER3_REG_CMD_CONFIG_B   0x0E
 
#define LIGHTRANGER3_REG_HOST_TO_MCPU_MBX   0x10
 
#define LIGHTRANGER3_REG_MCPU_TO_HOST_MBX   0x12
 
#define LIGHTRANGER3_REG_PMU_CONFIG   0x14
 
#define LIGHTRANGER3_REG_I2C_ADDR_PTR   0x18
 
#define LIGHTRANGER3_REG_I2C_DATA_PTR   0x1A
 
#define LIGHTRANGER3_REG_I2C_INIT_CFG   0x1C
 
#define LIGHTRANGER3_REG_MCPU_PM_CTRL   0x1E
 
#define LIGHTRANGER3_REG_HW_FW_CONFIG_0   0x20
 
#define LIGHTRANGER3_REG_HW_FW_CONFIG_1   0x22
 
#define LIGHTRANGER3_REG_HW_FW_CONFIG_2   0x24
 
#define LIGHTRANGER3_REG_HW_FW_CONFIG_3   0x26
 
#define LIGHTRANGER3_REG_DEVICE_ID   0x28
 
#define LIGHTRANGER3_REG_PTCH_MEMORY_CFG   0x2A
 
#define LIGHTRANGER3_STANDBY_MODE   0x90
 
#define LIGHTRANGER3_OFF_MODE   0x91
 
#define LIGHTRANGER3_ON_MODE   0x92
 
#define LIGHTRANGER3_MEASUREMENT_MODE   0x81
 
#define LIGHTRANGER3_ERROR   0x01
 
#define DISTANCE_IS_GOOD   0x7FFF
 

Functions

void lightranger3_cfg_setup (lightranger3_cfg_t *cfg)
 Config Object Initialization function.
 
LIGHTRANGER3_RETVAL lightranger3_init (lightranger3_t *ctx, lightranger3_cfg_t *cfg)
 Initialization function.
 
void lightranger3_generic_write (lightranger3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void lightranger3_generic_read (lightranger3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void lightranger3_write_byte (lightranger3_t *ctx, uint8_t reg, uint8_t w_data)
 Functions for write one byte in register.
 
void lightranger3_write_data (lightranger3_t *ctx, uint8_t reg, uint16_t w_data)
 Functions for write data in register.
 
uint8_t lightranger3_read_byte (lightranger3_t *ctx, uint8_t reg)
 Functions for read one byte from register.
 
uint16_t lightranger3_read_data (lightranger3_t *ctx, uint8_t reg)
 Functions for read data from register.
 
uint8_t lightranger3_set_standby_mode (lightranger3_t *ctx)
 Functions for go to standby mode.
 
uint8_t lightranger3_set_off_mode (lightranger3_t *ctx)
 Functions for go to OFF mode.
 
uint8_t lightranger3_set_on_mode (lightranger3_t *ctx)
 Functions for go to ON mode.
 
uint8_t lightranger3_set_measurement_mode (lightranger3_t *ctx)
 Functions for go to measurement mode.
 
uint8_t lightranger3_take_single_measurement (lightranger3_t *ctx)
 Functions for measurement.
 
uint16_t lightranger3_get_distance (lightranger3_t *ctx)
 Functions for reads distance.
 
uint16_t lightranger3_get_confidence_value (lightranger3_t *ctx)
 Functions for reads confidence value.
 
uint16_t lightranger3_get_device_id (lightranger3_t *ctx)
 Functions for reads device ID.
 
void lightranger3_soft_reset (lightranger3_t *ctx)
 Functions for soft reset.
 
uint8_t lightranger3_get_interrupt (lightranger3_t *ctx)
 Functions for reads interrupt pin.
 
uint8_t lightranger3_device_init (lightranger3_t *ctx)
 Functions for initializes chip.
 

Detailed Description

This file contains API for Light Ranger 3 Click driver.