ambient14  2.1.0.0
Data Structures | Macros | Enumerations | Functions
ambient14.h File Reference

This file contains API for Ambient 14 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  ambient14_t
 Ambient 14 Click context object. More...
 
struct  ambient14_cfg_t
 Ambient 14 Click configuration object. More...
 

Macros

#define AMBIENT14_REG_ENABLE   0x80
 Ambient 14 register list. More...
 
#define AMBIENT14_REG_ATIME   0x81
 
#define AMBIENT14_REG_PRATE   0x82
 
#define AMBIENT14_REG_AWTIME   0x83
 
#define AMBIENT14_REG_AILTL   0x84
 
#define AMBIENT14_REG_AILTH   0x85
 
#define AMBIENT14_REG_AIHTL   0x86
 
#define AMBIENT14_REG_AIHTH   0x87
 
#define AMBIENT14_REG_PILTL   0x88
 
#define AMBIENT14_REG_PILTH   0x89
 
#define AMBIENT14_REG_PIHTL   0x8A
 
#define AMBIENT14_REG_PIHTH   0x8B
 
#define AMBIENT14_REG_PERS   0x8C
 
#define AMBIENT14_REG_CFG0   0x8D
 
#define AMBIENT14_REG_PCFG0   0x8E
 
#define AMBIENT14_REG_PCFG1   0x8F
 
#define AMBIENT14_REG_PCFG2   0x90
 
#define AMBIENT14_REG_CFG1   0x91
 
#define AMBIENT14_REG_REVID   0x92
 
#define AMBIENT14_REG_ID   0x93
 
#define AMBIENT14_REG_STATUS   0x94
 
#define AMBIENT14_REG_ALSL   0x95
 
#define AMBIENT14_REG_ALSH   0x96
 
#define AMBIENT14_REG_IRL   0x97
 
#define AMBIENT14_REG_IRH   0x98
 
#define AMBIENT14_REG_PDATAL   0x99
 
#define AMBIENT14_REG_PDATAH   0x9A
 
#define AMBIENT14_REG_REVID2   0xA6
 
#define AMBIENT14_REG_SOFTRST   0xA8
 
#define AMBIENT14_REG_PWTIME   0xA9
 
#define AMBIENT14_REG_CFG8   0xAA
 
#define AMBIENT14_REG_CFG3   0xAB
 
#define AMBIENT14_REG_CFG6   0xAE
 
#define AMBIENT14_REG_POFFSETL   0xC0
 
#define AMBIENT14_REG_POFFSETH   0xC1
 
#define AMBIENT14_REG_CALIB   0xD7
 
#define AMBIENT14_REG_CALIB_OFFSET   0xD8
 
#define AMBIENT14_REG_CALIBCFG   0xD9
 
#define AMBIENT14_REG_CALIBSTAT   0xDC
 
#define AMBIENT14_REG_INTENAB   0xDD
 
#define AMBIENT14_REG_FAC_L   0xE6
 
#define AMBIENT14_REG_FAC_H   0xE7
 
#define AMBIENT14_REG_TEST9   0xF9
 
#define AMBIENT14_ENABLE_PWEN   0x10
 Ambient 14 ENABLE register setting. More...
 
#define AMBIENT14_ENABLE_AWEN   0x08
 
#define AMBIENT14_ENABLE_PEN   0x04
 
#define AMBIENT14_ENABLE_AEN   0x02
 
#define AMBIENT14_ENABLE_PON   0x01
 
#define AMBIENT14_SOFT_RESET   0x01
 Ambient 14 SOFTRST register setting. More...
 
#define AMBIENT14_PCFG0_PGAIN1_1X   0x00
 Ambient 14 PCFG0 register setting. More...
 
#define AMBIENT14_PCFG0_PGAIN1_2X   0x40
 
#define AMBIENT14_PCFG0_PGAIN1_4X   0x80
 
#define AMBIENT14_PCFG0_PGAIN1_8X   0xC0
 
#define AMBIENT14_PCFG0_PGAIN1_MASK   0xC0
 
#define AMBIENT14_PCFG0_PPULSE_MIN   0x00
 
#define AMBIENT14_PCFG0_PPULSE_DEFAULT   0x01
 
#define AMBIENT14_PCFG0_PPULSE_MAX   0x3F
 
#define AMBIENT14_PCFG0_PPULSE_MASK   0x3F
 
#define AMBIENT14_PCFG1_PPULSE_LENH_DEFAULT   0x00
 Ambient 14 PCFG1 register setting. More...
 
#define AMBIENT14_PCFG1_PPULSE_LENH_MASK   0xC0
 
#define AMBIENT14_PCFG1_RESERVED   0x30
 
#define AMBIENT14_PCFG1_PLDRIVE_7_MA   0x05
 
#define AMBIENT14_PCFG1_PLDRIVE_8_MA   0x06
 
#define AMBIENT14_PCFG1_PLDRIVE_9_MA   0x07
 
#define AMBIENT14_PCFG1_PLDRIVE_10_MA   0x08
 
#define AMBIENT14_PCFG1_PLDRIVE_MASK   0x0F
 
#define AMBIENT14_PCFG2_PPULSE_LENL_DEFAULT   0x20
 Ambient 14 PCFG2 register setting. More...
 
#define AMBIENT14_PCFG2_PPULSE_LENL_MASK   0xFF
 
#define AMBIENT14_CFG1_PGAIN2_2_5X   0x00
 Ambient 14 CFG1 register setting. More...
 
#define AMBIENT14_CFG1_PGAIN2_5X   0x20
 
#define AMBIENT14_CFG1_PGAIN2_10X   0x60
 
#define AMBIENT14_CFG1_PGAIN2_MASK   0x60
 
#define AMBIENT14_CFG1_AGAIN_16X   0x05
 
#define AMBIENT14_CFG1_AGAIN_128X   0x08
 
#define AMBIENT14_CFG1_AGAIN_1024X   0x0B
 
#define AMBIENT14_CFG1_AGAIN_MASK   0x1F
 
#define AMBIENT14_CFG8_RESERVED   0x29
 Ambient 14 CFG8 register setting. More...
 
#define AMBIENT14_CFG6_APC_ENABLE   0x00
 Ambient 14 CFG6 register setting. More...
 
#define AMBIENT14_CFG6_APC_DISABLE   0x40
 
#define AMBIENT14_CFG6_RESERVED   0x3F
 
#define AMBIENT14_STATUS_ASAT   0x80
 Ambient 14 STATUS register setting. More...
 
#define AMBIENT14_STATUS_PSAT   0x40
 
#define AMBIENT14_STATUS_PINT   0x20
 
#define AMBIENT14_STATUS_AINT   0x10
 
#define AMBIENT14_STATUS_CINT   0x08
 
#define AMBIENT14_STATUS_ZINT   0x04
 
#define AMBIENT14_STATUS_PSAT_REFLECTIVE   0x02
 
#define AMBIENT14_STATUS_PSAT_AMBIENT   0x01
 
#define AMBIENT14_STATUS_CLEAR_ALL   0xFF
 
#define AMBIENT14_INTENAB_ASIEN   0x80
 Ambient 14 INTENAB register setting. More...
 
#define AMBIENT14_INTENAB_PSIEN   0x40
 
#define AMBIENT14_INTENAB_PIEN   0x20
 
#define AMBIENT14_INTENAB_AIEN   0x10
 
#define AMBIENT14_INTENAB_CIEN   0x08
 
#define AMBIENT14_INTENAB_ZIEN   0x04
 
#define AMBIENT14_INTENAB_DISABLE   0x00
 
#define AMBIENT14_CALIB_CALAVG   0x80
 Ambient 14 CALIB register setting. More...
 
#define AMBIENT14_CALIB_ELECTRICAL_CALIB   0x20
 
#define AMBIENT14_CALIB_CALPRATE   0x10
 
#define AMBIENT14_CALIB_START_OFFSET_CAL   0x01
 
#define AMBIENT14_CALIBCFG_BINSRCH_TARGET_3   0x00
 Ambient 14 CALIBCFG register setting. More...
 
#define AMBIENT14_CALIBCFG_BINSRCH_TARGET_7   0x20
 
#define AMBIENT14_CALIBCFG_BINSRCH_TARGET_15   0x40
 
#define AMBIENT14_CALIBCFG_BINSRCH_TARGET_31   0x60
 
#define AMBIENT14_CALIBCFG_BINSRCH_TARGET_63   0x80
 
#define AMBIENT14_CALIBCFG_BINSRCH_TARGET_127   0xA0
 
#define AMBIENT14_CALIBCFG_BINSRCH_TARGET_255   0xC0
 
#define AMBIENT14_CALIBCFG_BINSRCH_TARGET_511   0xE0
 
#define AMBIENT14_CALIBCFG_BINSRCH_TARGET_MASK   0xE0
 
#define AMBIENT14_CALIBCFG_RESERVED   0x10
 
#define AMBIENT14_CALIBCFG_AUTO_OFFSET_ADJ   0x08
 
#define AMBIENT14_CALIBCFG_PROX_AVG_DISABLE   0x00
 
#define AMBIENT14_CALIBCFG_PROX_AVG_2   0x01
 
#define AMBIENT14_CALIBCFG_PROX_AVG_4   0x02
 
#define AMBIENT14_CALIBCFG_PROX_AVG_8   0x03
 
#define AMBIENT14_CALIBCFG_PROX_AVG_16   0x04
 
#define AMBIENT14_CALIBCFG_PROX_AVG_MASK   0x07
 
#define AMBIENT14_CALIBSTAT_OFFSET_ADJUSTED   0x04
 Ambient 14 CALIBSTAT register setting. More...
 
#define AMBIENT14_CALIBSTAT_CALIB_FINISHED   0x01
 
#define AMBIENT14_SINGLE_STEP_MS   2.78f
 Ambient 14 integration time setting. More...
 
#define AMBIENT14_ATIME_MAX   ( 256 * AMBIENT14_SINGLE_STEP_MS )
 
#define AMBIENT14_ATIME_MIN   AMBIENT14_SINGLE_STEP_MS
 
#define AMBIENT14_ATIME_DEFAULT   100.0f
 
#define AMBIENT14_AWTIME_MAX   ( 256 * AMBIENT14_SINGLE_STEP_MS )
 
#define AMBIENT14_AWTIME_MIN   AMBIENT14_SINGLE_STEP_MS
 
#define AMBIENT14_AWTIME_DEFAULT   50.0f
 
#define AMBIENT14_PWTIME_MAX   ( 256 * AMBIENT14_SINGLE_STEP_MS )
 
#define AMBIENT14_PWTIME_MIN   AMBIENT14_SINGLE_STEP_MS
 
#define AMBIENT14_PWTIME_DEFAULT   500.0f
 
#define AMBIENT14_ROUND_TO_INT   0.5f
 
#define AMBIENT14_ILLUMINANCE_GAIN_16_TO_128   0.125f
 Ambient 14 illuminance conversion setting. More...
 
#define AMBIENT14_ILLUMINANCE_ATIME_100_GAIN_128   0.0095f
 
#define AMBIENT14_ILLUMINANCE_GAIN_1024_TO_128   8.2f
 
#define AMBIENT14_DEVICE_ID   0x50
 Ambient 14 ID value. More...
 
#define AMBIENT14_DEVICE_ADDRESS   0x39
 Ambient 14 device address setting. More...
 
#define AMBIENT14_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  ambient14_return_value_t { AMBIENT14_OK = 0, AMBIENT14_ERROR = -1 }
 Ambient 14 Click return value data. More...
 

Functions

void ambient14_cfg_setup (ambient14_cfg_t *cfg)
 Ambient 14 configuration object setup function. More...
 
err_t ambient14_init (ambient14_t *ctx, ambient14_cfg_t *cfg)
 Ambient 14 initialization function. More...
 
err_t ambient14_default_cfg (ambient14_t *ctx)
 Ambient 14 default configuration function. More...
 
err_t ambient14_write_regs (ambient14_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Ambient 14 write regs function. More...
 
err_t ambient14_read_regs (ambient14_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Ambient 14 read regs function. More...
 
err_t ambient14_write_reg (ambient14_t *ctx, uint8_t reg, uint8_t data_in)
 Ambient 14 write reg function. More...
 
err_t ambient14_read_reg (ambient14_t *ctx, uint8_t reg, uint8_t *data_out)
 Ambient 14 read reg function. More...
 
void ambient14_enable_device (ambient14_t *ctx)
 Ambient 14 enable device function. More...
 
void ambient14_disable_device (ambient14_t *ctx)
 Ambient 14 disable device function. More...
 
uint8_t ambient14_get_int_pin (ambient14_t *ctx)
 Ambient 14 get int pin function. More...
 
err_t ambient14_check_communication (ambient14_t *ctx)
 Ambient 14 check communication function. More...
 
err_t ambient14_soft_reset (ambient14_t *ctx)
 Ambient 14 soft reset function. More...
 
err_t ambient14_clear_interrupts (ambient14_t *ctx)
 Ambient 14 clear interrupts function. More...
 
err_t ambient14_set_atime (ambient14_t *ctx, float atime_ms)
 Ambient 14 set atime function. More...
 
err_t ambient14_set_awtime (ambient14_t *ctx, float awtime_ms)
 Ambient 14 set awtime function. More...
 
err_t ambient14_set_pwtime (ambient14_t *ctx, float pwtime_ms)
 Ambient 14 set pwtime function. More...
 
err_t ambient14_read_proximity (ambient14_t *ctx, uint16_t *prox_data)
 Ambient 14 read proximity function. More...
 
err_t ambient14_read_als_ir (ambient14_t *ctx, uint16_t *als_data, uint16_t *ir_data)
 Ambient 14 read als ir function. More...
 
err_t ambient14_get_illuminance (ambient14_t *ctx, uint16_t als_data, float *illuminance)
 Ambient 14 get illuminance function. More...
 

Detailed Description

This file contains API for Ambient 14 Click Driver.

Enumeration Type Documentation

◆ ambient14_return_value_t

Ambient 14 Click return value data.

Predefined enum values for driver return values.

Enumerator
AMBIENT14_OK 
AMBIENT14_ERROR