ambient19 2.0.0.0
ambient19.h File Reference

This file contains API for Ambient 19 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  ambient19_t
 Ambient 19 Click context object. More...
 
struct  ambient19_cfg_t
 Ambient 19 Click configuration object. More...
 

Macros

#define AMBIENT19_REG_SYSM_CTRL   0x00
 Ambient 19 registers list.
 
#define AMBIENT19_REG_INT_CTRL   0x01
 
#define AMBIENT19_REG_INT_FLAG   0x02
 
#define AMBIENT19_REG_WAIT_TIME   0x03
 
#define AMBIENT19_REG_ALS_GAIN   0x04
 
#define AMBIENT19_REG_ALS_TIME   0x05
 
#define AMBIENT19_REG_LED_CTRL   0x06
 
#define AMBIENT19_REG_PS_GAIN   0x07
 
#define AMBIENT19_REG_PS_PULSE   0x08
 
#define AMBIENT19_REG_PS_TIME   0x09
 
#define AMBIENT19_REG_PERSISTENCE   0x0B
 
#define AMBIENT19_REG_ALS_THRES_LL   0x0C
 
#define AMBIENT19_REG_ALS_THRES_LH   0x0D
 
#define AMBIENT19_REG_ALS_THRES_HL   0x0E
 
#define AMBIENT19_REG_ALS_THRES_HH   0x0F
 
#define AMBIENT19_REG_PS_THRES_LL   0x10
 
#define AMBIENT19_REG_PS_THRES_LH   0x11
 
#define AMBIENT19_REG_PS_THRES_HL   0x12
 
#define AMBIENT19_REG_PS_THRES_HH   0x13
 
#define AMBIENT19_REG_PS_OFFSET_L   0x14
 
#define AMBIENT19_REG_PS_OFFSET_H   0x15
 
#define AMBIENT19_REG_INT_SOURCE   0x16
 
#define AMBIENT19_REG_ERROR_FLAG   0x17
 
#define AMBIENT19_REG_PS_DATA_L   0x18
 
#define AMBIENT19_REG_PS_DATA_H   0x19
 
#define AMBIENT19_REG_IR_DATA_L   0x1A
 
#define AMBIENT19_REG_IR_DATA_H   0x1B
 
#define AMBIENT19_REG_CH0_DATA_L   0x1C
 
#define AMBIENT19_REG_CH0_DATA_H   0x1D
 
#define AMBIENT19_REG_CH1_DATA_L   0x1E
 
#define AMBIENT19_REG_CH1_DATA_H   0x1F
 
#define AMBIENT19_REG_PNO_LB   0xBC
 
#define AMBIENT19_REG_PNO_HB   0xBD
 
#define AMBIENT19_SYSM_CTRL_SWRST   0x80
 Ambient 19 system control register settings.
 
#define AMBIENT19_SYSM_EN_WAIT   0x40
 
#define AMBIENT19_SYSM_EN_PS   0x02
 
#define AMBIENT19_SYSM_EN_ALS   0x01
 
#define AMBIENT19_INT_CTRL_PS_INT_MODE   0x80
 Ambient 19 interrupt pin control register settings.
 
#define AMBIENT19_INT_CTRL_SINT_MODE   0x40
 
#define AMBIENT19_INT_CTRL_PS_SYNC   0x20
 
#define AMBIENT19_INT_CTRL_ALS_SYNC   0x10
 
#define AMBIENT19_INT_CTRL_EN_PINT   0x02
 
#define AMBIENT19_INT_CTRL_EN_AINT   0x01
 
#define AMBIENT19_INT_FLAG_INT_POR   0x80
 Ambient 19 interrupt flag register settings.
 
#define AMBIENT19_INT_FLAG_DATA_FLAG   0x40
 
#define AMBIENT19_INT_FLAG_OBJ   0x20
 
#define AMBIENT19_INT_FLAG_INT_PS   0x02
 
#define AMBIENT19_INT_FLAG_INT_ALS   0x01
 
#define AMBIENT19_WAIT_TIME_MAX   1280.0
 Ambient 19 wait time register settings.
 
#define AMBIENT19_WAIT_TIME_MIN   5.0
 
#define AMBIENT19_WAIT_TIME_STEP   5.0
 
#define AMBIENT19_WAIT_TIME_DEFAULT   100.0
 
#define AMBIENT19_ALS_GAIN_1X   0x00
 Ambient 19 als gain register settings.
 
#define AMBIENT19_ALS_GAIN_4X   0x01
 
#define AMBIENT19_ALS_GAIN_8X   0x02
 
#define AMBIENT19_ALS_GAIN_32X   0x03
 
#define AMBIENT19_ALS_GAIN_96X   0x04
 
#define AMBIENT19_ALS_TIME_MAX   674.888
 Ambient 19 als time register settings.
 
#define AMBIENT19_ALS_TIME_MIN   5.513
 
#define AMBIENT19_ALS_TIME_STEP   2.625
 
#define AMBIENT19_ALS_TIME_DEFAULT   400.0
 
#define AMBIENT19_LED_CTRL_IRDR_SEL_50mA   0x00
 Ambient 19 led control register settings.
 
#define AMBIENT19_LED_CTRL_IRDR_SEL_100mA   0x40
 
#define AMBIENT19_LED_CTRL_IRDR_SEL_150mA   0x80
 
#define AMBIENT19_LED_CTRL_IRDR_SEL_200mA   0xC0
 
#define AMBIENT19_LED_CTRL_IRDR_SEL_BIT_MASK   0xC0
 
#define AMBIENT19_LED_CTRL_ITW_PS_MAX   875.213
 
#define AMBIENT19_LED_CTRL_ITW_PS_MIN   13.675
 
#define AMBIENT19_LED_CTRL_ITW_PS_STEP   13.675
 
#define AMBIENT19_LED_CTRL_ITW_PS_BIT_MASK   0x3F
 
#define AMBIENT19_PS_GAIN_1X   0x00
 Ambient 19 ps gain register settings.
 
#define AMBIENT19_PS_GAIN_2X   0x01
 
#define AMBIENT19_PS_GAIN_4X   0x02
 
#define AMBIENT19_PS_GAIN_8X   0x03
 
#define AMBIENT19_PS_TIME_MAX_COUNT_4095   0x0F
 Ambient 19 ps time register settings.
 
#define AMBIENT19_PERSISTANCE_EVERY_ALS_CONV   0x00
 Ambient 19 persistance register settings.
 
#define AMBIENT19_INT_SOURCE_CH0_DATA   0x00
 Ambient 19 int source register settings.
 
#define AMBIENT19_INT_SOURCE_CH1_DATA   0x01
 
#define AMBIENT19_LUX_K1   0.52
 Ambient 19 lux calculation coefficients.
 
#define AMBIENT19_LUX_K2   0.94
 
#define AMBIENT19_LUX_K3   1.12
 
#define AMBIENT19_PRODUCT_NUM_LOW   0x14
 Ambient 19 product number values.
 
#define AMBIENT19_PRODUCT_NUM_HIGH   0x16
 
#define AMBIENT19_DEVICE_ADDRESS   0x38
 Ambient 19 device address setting.
 
#define AMBIENT19_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  ambient19_return_value_t { AMBIENT19_OK = 0 , AMBIENT19_ERROR = -1 }
 Ambient 19 Click return value data. More...
 

Functions

void ambient19_cfg_setup (ambient19_cfg_t *cfg)
 Ambient 19 configuration object setup function.
 
err_t ambient19_init (ambient19_t *ctx, ambient19_cfg_t *cfg)
 Ambient 19 initialization function.
 
err_t ambient19_default_cfg (ambient19_t *ctx)
 Ambient 19 default configuration function.
 
err_t ambient19_generic_write (ambient19_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Ambient 19 I2C writing function.
 
err_t ambient19_generic_read (ambient19_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Ambient 19 I2C reading function.
 
err_t ambient19_write_register (ambient19_t *ctx, uint8_t reg, uint8_t data_in)
 Ambient 19 write register function.
 
err_t ambient19_read_register (ambient19_t *ctx, uint8_t reg, uint8_t *data_out)
 Ambient 19 read register function.
 
err_t ambient19_check_communication (ambient19_t *ctx)
 Ambient 19 check communication function.
 
uint8_t ambient19_get_int_pin (ambient19_t *ctx)
 Ambient 19 get INT pin function.
 
err_t ambient19_clear_interrupts (ambient19_t *ctx)
 Ambient 19 clear interrupts function.
 
err_t ambient19_set_wait_time (ambient19_t *ctx, float wait_time_ms)
 Ambient 19 set wait time function.
 
err_t ambient19_set_als_time (ambient19_t *ctx, float als_time_ms)
 Ambient 19 set als time function.
 
err_t ambient19_set_als_gain (ambient19_t *ctx, uint8_t als_gain)
 Ambient 19 set als gain function.
 
err_t ambient19_read_raw_als (ambient19_t *ctx, uint16_t *ch_0, uint16_t *ch_1)
 Ambient 19 read raw als function.
 
err_t ambient19_read_raw_proximity (ambient19_t *ctx, uint16_t *ps_data, uint16_t *ir_data)
 Ambient 19 read raw proximity function.
 
err_t ambient19_measure_light_level (ambient19_t *ctx, uint16_t *lux)
 Ambient 19 measure light level function.
 

Detailed Description

This file contains API for Ambient 19 Click Driver.

Enumeration Type Documentation

◆ ambient19_return_value_t

Ambient 19 Click return value data.

Predefined enum values for driver return values.

Enumerator
AMBIENT19_OK 
AMBIENT19_ERROR