Loading...
Searching...
No Matches
#include <stdbool.h>
#include <stdint.h>
#include "periph/gpio.h"
#include "periph/i2c.h"
#include "vl6180x_regs.h"
+ Include dependency graph for vl6180x.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vl6180x_int_config_t
 Interrupt config. More...
 
struct  vl6180x_int_thresh_t
 Interrupt threshold configuration. More...
 
struct  vl6180x_params_t
 VL6180X device configuration. More...
 
struct  vl6180x_t
 VL6180X sensor device data structure type. More...
 

Macros

#define VL6180X_I2C_ADDR   (0x29)
 VNCL6180 default I2C slave address.
 

Enumerations

enum  vl6180x_error_t {
  VL6180X_OK = 0 , VL6180X_ERROR_I2C = 1 , VL6180X_ERROR_WRONG_ID = 2 , VL6180X_ERROR_NO_PIN = 3 ,
  VL6180X_ERROR_NO_DATA = 4 , VL6180X_ERROR_RNG = 5 , VL6180X_ERROR_ALS = 6 , VL6180X_ERROR_NOT_READY = 7
}
 Error codes. More...
 
enum  vl6180x_als_gain_t {
  VL6180X_ALS_GAIN_20 = 0 , VL6180X_ALS_GAIN_10 = 1 , VL6180X_ALS_GAIN_5 = 2 , VL6180X_ALS_GAIN_2_5 = 3 ,
  VL6180X_ALS_GAIN_1_67 = 4 , VL6180X_ALS_GAIN_1_25 = 5 , VL6180X_ALS_GAIN_1 = 6 , VL6180X_ALS_GAIN_40 = 7
}
 Analogue gain for ALS measurements. More...
 
enum  vl6180x_rng_status_t {
  VL6180X_RNG_OK = 0 , VL6180X_RNG_VCSEL_CONT_TEST = 1 , VL6180X_RNG_VCSEL_WD_TEST = 2 , VL6180X_RNG_VCSEL_WD = 3 ,
  VL6180X_RNG_PLL1_LOCK = 4 , VL6180X_RNG_PLL2_LOCK = 5 , VL6180X_RNG_EARLY_CONV_EST = 6 , VL6180X_RNG_MAX_CONV = 7 ,
  VL6180X_RNG_NO_TARGET = 8 , VL6180X_RNG_MAX_SNR = 11 , VL6180X_RNG_RAW_ALGO_UNDERFLOW = 12 , VL6180X_RNG_RAW_ALGO_OVERFLOW = 13 ,
  VL6180X_RNG_ALGO_UNDERFLOW = 14 , VL6180X_RNG_ALGO_OVERFLOW = 15
}
 Range measurement status. More...
 
enum  vl6180x_als_status_t { VL6180X_ALS_OK = 0 , VL6180X_ALS_OVERFLOW = 1 , VL6180X_ALS_UNDERFLOW = 2 }
 Ambient light sensing (ALS) status. More...
 
enum  vl6180x_int_mode_t {
  VL6180X_INT_NONE = 0 , VL6180X_INT_LOW = 1 , VL6180X_INT_HIGH = 2 , VL6180X_INT_OUT = 3 ,
  VL6180X_INT_DRDY = 4
}
 Interrupt mode. More...
 

Functions

int vl6180x_init (vl6180x_t *dev, const vl6180x_params_t *params)
 Initialize the VL6180X sensor device.
 
int vl6180x_start_cont (vl6180x_t *dev)
 Start measurements in continuous mode.
 
int vl6180x_stop_cont (vl6180x_t *dev)
 Stop measurements in continuous mode.
 
int vl6180x_rng_data_ready (const vl6180x_t *dev)
 Range data ready status function.
 
int vl6180x_rng_read (vl6180x_t *dev, uint8_t *mm)
 Read one ranging data sample in mm.
 
vl6180x_rng_status_t vl6180x_rng_status (const vl6180x_t *dev)
 Get status of last range measurement.
 
int vl6180x_rng_start_single (const vl6180x_t *dev)
 Start a single-shot range measurement.
 
int vl6180x_rng_config (vl6180x_t *dev, uint8_t period, uint8_t max_time)
 Reconfigure range measurements at runtime.
 
int vl6180x_als_data_ready (const vl6180x_t *dev)
 ALS data ready status function.
 
int vl6180x_als_read (vl6180x_t *dev, uint16_t *raw, uint16_t *lux)
 Read one ambient light sensing (ALS) data sample.
 
vl6180x_als_status_t vl6180x_als_status (const vl6180x_t *dev)
 Get status of last ALS measurement.
 
int vl6180x_als_start_single (const vl6180x_t *dev)
 Start a single-shot ALS measurement.
 
int vl6180x_als_config (vl6180x_t *dev, uint8_t period, uint8_t int_time, vl6180x_als_gain_t gain)
 Reconfigure ambient light sensing (ALS) during runtime.
 
int vl6180x_power_down (const vl6180x_t *dev)
 Power down the sensor.
 
int vl6180x_power_up (vl6180x_t *dev)
 Power down the sensor.
 
int vl6180x_int_wait (const vl6180x_t *dev, vl6180x_int_config_t *src)
 Wait for configured interrupts and return the interrupt sources.
 
int vl6180x_int_enable (vl6180x_t *dev, vl6180x_int_config_t mode)
 Enable and disable interrupts.
 
int vl6180x_int_config (vl6180x_t *dev, vl6180x_int_thresh_t thresh)
 Configure thresholds for event interrupts at runtime.
 

Low level interface functions

int vl6180x_reg_write (const vl6180x_t *dev, uint16_t reg, const uint8_t *data, uint8_t len)
 Direct write to register.
 
int vl6180x_reg_read (const vl6180x_t *dev, uint16_t reg, uint8_t *data, uint8_t len)
 Direct read from register.