lightmixsens 2.0.0.0
lightmixsens.h File Reference

This file contains API for Light mix sens 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  lightmixsens_t
 Light mix sens Click context object. More...
 
struct  lightmixsens_cfg_t
 Light mix sens Click configuration object. More...
 
struct  lightmixsens_data_obj
 Light mix sens Click data object. More...
 

Macros

#define LIGHTMIXSENS_REG_ENABLE   0x80
 Light mix sens description register.
 
#define LIGHTMIXSENS_REG_ATIME   0x81
 
#define LIGHTMIXSENS_REG_PTIME   0x82
 
#define LIGHTMIXSENS_REG_WTIME   0x83
 
#define LIGHTMIXSENS_REG_AILT   0x84
 
#define LIGHTMIXSENS_REG_AIHT   0x86
 
#define LIGHTMIXSENS_REG_PILT   0x88
 
#define LIGHTMIXSENS_REG_PIHT   0x8A
 
#define LIGHTMIXSENS_REG_PERS   0x8C
 
#define LIGHTMIXSENS_REG_CFG0   0x8D
 
#define LIGHTMIXSENS_REG_PCFG0   0x8E
 
#define LIGHTMIXSENS_REG_PCFG1   0x8F
 
#define LIGHTMIXSENS_REG_CFG1   0x90
 
#define LIGHTMIXSENS_REG_REVID   0x91
 
#define LIGHTMIXSENS_REG_ID   0x92
 
#define LIGHTMIXSENS_REG_STATUS   0x93
 
#define LIGHTMIXSENS_REG_CDATA   0x94
 
#define LIGHTMIXSENS_REG_RDATA   0x96
 
#define LIGHTMIXSENS_REG_GDATA_IRDATA   0x98
 
#define LIGHTMIXSENS_REG_BDATA   0x9A
 
#define LIGHTMIXSENS_REG_PDATA   0x9C
 
#define LIGHTMIXSENS_REG_REVID2   0x9E
 
#define LIGHTMIXSENS_REG_CFG2   0x9F
 
#define LIGHTMIXSENS_REG_CFG3   0xAB
 
#define LIGHTMIXSENS_REG_POFFSET   0xC0
 
#define LIGHTMIXSENS_REG_AZCFG   0xD6
 
#define LIGHTMIXSENS_REG_CALIB   0xD7
 
#define LIGHTMIXSENS_REG_CALIBCFG   0xD9
 
#define LIGHTMIXSENS_REG_CALIBSTAT   0xDC
 
#define LIGHTMIXSENS_REG_INTENAB   0xDD
 
#define LIGHTMIXSENS_ATIME_WTIME_CONST   2.8
 Light mix sens description setting.
 
#define LIGHTMIXSENS_PTIME_CONST   88
 
#define LIGHTMIXSENS_WTIME_INCR_FACTOR   12
 
#define LIGHTMIXSENS_ENABLE_WAIT   0x08
 
#define LIGHTMIXSENS_ENABLE_PROX   0x04
 
#define LIGHTMIXSENS_ENABLE_ALS   0x02
 
#define LIGHTMIXSENS_ENABLE_OSC   0x01
 
#define LIGHTMIXSENS_DISABLE_ALL   0x00
 
#define LIGHTMIXSENS_PCFG1_GAIN_1x   0x00
 
#define LIGHTMIXSENS_PCFG1_GAIN_2x   0x40
 
#define LIGHTMIXSENS_PCFG1_GAIN_4x   0x80
 
#define LIGHTMIXSENS_PCFG1_GAIN_8x   0xC0
 
#define LIGHTMIXSENS_PCFG1_DRIVE_6mA   0x00
 
#define LIGHTMIXSENS_PCFG1_DRIVE_12mA   0x01
 
#define LIGHTMIXSENS_PCFG1_DRIVE_18mA   0x02
 
#define LIGHTMIXSENS_PCFG1_DRIVE_192mA   0x1F
 
#define LIGHTMIXSENS_CFG0_WLONG   0x04
 
#define LIGHTMIXSENS_CFG1_IR_TO_GREEN   0x08
 
#define LIGHTMIXSENS_CFG1_AGAIN_1x   0x00
 
#define LIGHTMIXSENS_CFG1_AGAIN_4x   0x01
 
#define LIGHTMIXSENS_CFG1_AGAIN_16x   0x02
 
#define LIGHTMIXSENS_CFG1_AGAIN_64x   0x03
 
#define LIGHTMIXSENS_CFG2_AGAINMAX   0x10
 
#define LIGHTMIXSENS_CFG2_AGAINL   0x04
 
#define LIGHTMIXSENS_CFG3_INT_READ_CLEAR   0x80
 
#define LIGHTMIXSENS_CFG3_SAI   0x10
 
#define LIGHTMIXSENS_FLAG_ASAT   0x80
 Light mix sens flag bits.
 
#define LIGHTMIXSENS_FLAG_PSAT   0x40
 
#define LIGHTMIXSENS_FLAG_PINT   0x20
 
#define LIGHTMIXSENS_FLAG_AINT   0x10
 
#define LIGHTMIXSENS_FLAG_CINT   0x08
 
#define LIGHTMIXSENS_FLAG_PSAT_REFL   0x02
 
#define LIGHTMIXSENS_FLAG_PSAT_AMB   0x01
 
#define LIGHTMIXSENS_CALIB_ELECTRICAL   0x20
 Light mix sens calibration settings.
 
#define LIGHTMIXSENS_CALIB_OFFSET_START   0x01
 
#define LIGHTMIXSENS_CALIBCFG_PROX_TARGET_0   0x00
 
#define LIGHTMIXSENS_CALIBCFG_PROX_TARGET_1   0x20
 
#define LIGHTMIXSENS_CALIBCFG_PROX_TARGET_3   0x40
 
#define LIGHTMIXSENS_CALIBCFG_PROX_TARGET_7   0x60
 
#define LIGHTMIXSENS_CALIBCFG_PROX_TARGET_15   0x80
 
#define LIGHTMIXSENS_CALIBCFG_PROX_TARGET_31   0xA0
 
#define LIGHTMIXSENS_CALIBCFG_PROX_TARGET_63   0xC0
 
#define LIGHTMIXSENS_CALIBCFG_PROX_TARGET_127   0xE0
 
#define LIGHTMIXSENS_CALIBCFG_AUTO_OFFSET_ADJ   0x08
 
#define LIGHTMIXSENS_CALIBCFG_PROX_AVG_DIS   0x00
 
#define LIGHTMIXSENS_CALIBCFG_PROX_AVG_2   0x01
 
#define LIGHTMIXSENS_CALIBCFG_PROX_AVG_4   0x02
 
#define LIGHTMIXSENS_CALIBCFG_PROX_AVG_8   0x03
 
#define LIGHTMIXSENS_CALIBCFG_PROX_AVG_16   0x04
 
#define LIGHTMIXSENS_CALIBCFG_PROX_AVG_32   0x05
 
#define LIGHTMIXSENS_CALIBCFG_PROX_AVG_64   0x06
 
#define LIGHTMIXSENS_CALIBCFG_PROX_AVG_128   0x07
 
#define LIGHTMIXSENS_CALIBSTAT_FINISHED   0x01
 
#define LIGHTMIXSENS_DUMMY_DATA   0x00
 
#define LIGHTMIXSENS_SET_DEV_ADDR   0x39
 Light mix sens device address setting.
 
#define LIGHTMIXSENS_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  lightmixsens_return_value_t { LIGHTMIXSENS_OK = 0 , LIGHTMIXSENS_ERROR = -1 }
 Light mix sens Click return value data. More...
 

Functions

void lightmixsens_cfg_setup (lightmixsens_cfg_t *cfg)
 Light mix sens configuration object setup function.
 
err_t lightmixsens_init (lightmixsens_t *ctx, lightmixsens_cfg_t *cfg)
 Light mix sens initialization function.
 
void lightmixsens_default_cfg (lightmixsens_t *ctx)
 Light mix sens default configuration function.
 
void lightmixsens_generic_write (lightmixsens_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Light mix sens I2C writing function.
 
void lightmixsens_generic_read (lightmixsens_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Light mix sens I2C reading function.
 
err_t lightmixsens_write_byte (lightmixsens_t *ctx, uint8_t reg_addr, uint8_t data_in)
 Generic Write Byte function.
 
err_t lightmixsens_write_word (lightmixsens_t *ctx, uint8_t reg_addr, uint16_t data_in)
 Generic Write Word function.
 
err_t lightmixsens_read_byte (lightmixsens_t *ctx, uint8_t reg_addr, uint8_t *data_out)
 Generic Read Byte function.
 
err_t lightmixsens_read_word (lightmixsens_t *ctx, uint8_t reg_addr, uint16_t *data_out)
 Generic Read Word function.
 
void lightmixsens_get_status (lightmixsens_t *ctx, uint8_t flag_mask, uint8_t *status)
 Get Status function.
 
void lightmixsens_switch_ir_to_green (lightmixsens_t *ctx)
 Switch IR To Green Channel function.
 
void lightmixsens_switch_ir_to_prox (lightmixsens_t *ctx)
 Switch IR To Proximity function.
 
void lightmixsens_wait_atime (lightmixsens_t *ctx)
 Wait ALS/Color Intregration Time Done function.
 
void lightmixsens_wait_ptime (lightmixsens_t *ctx)
 Wait Proximity Sample Time Done function.
 
void lightmixsens_wait_wtime (lightmixsens_t *ctx)
 Wait WTIME + WLONG Done function.
 

Detailed Description

This file contains API for Light mix sens Click Driver.

Enumeration Type Documentation

◆ lightmixsens_return_value_t

Light mix sens Click return value data.

Predefined enum values for driver return values.

Enumerator
LIGHTMIXSENS_OK 
LIGHTMIXSENS_ERROR