ambient15 2.0.0.0
ambient15.h File Reference

This file contains API for Ambient 15 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  ambient15_t
 Ambient 15 Click context object. More...
 
struct  ambient15_cfg_t
 Ambient 15 Click configuration object. More...
 

Macros

#define AMBIENT15_REG_CONTROL   0x00
 Ambient 15 registers list.
 
#define AMBIENT15_REG_TIMING   0x01
 
#define AMBIENT15_REG_INTERRUPT   0x02
 
#define AMBIENT15_REG_THL_LOW   0x03
 
#define AMBIENT15_REG_THL_HIGH   0x04
 
#define AMBIENT15_REG_THH_LOW   0x05
 
#define AMBIENT15_REG_THH_HIGH   0x06
 
#define AMBIENT15_REG_ANALOG   0x07
 
#define AMBIENT15_REG_ID   0x12
 
#define AMBIENT15_REG_DATA0_LOW   0x14
 
#define AMBIENT15_REG_DATA0_HIGH   0x15
 
#define AMBIENT15_REG_DATA1_LOW   0x16
 
#define AMBIENT15_REG_DATA1_HIGH   0x17
 
#define AMBIENT15_REG_TIMER_LOW   0x18
 
#define AMBIENT15_REG_TIMER_HIGH   0x19
 
#define AMBIENT15_REG_ID2   0x1E
 
#define AMBIENT15_CMD_BIT   0x80
 Ambient 15 Command register setting.
 
#define AMBIENT15_TRANSACTION_REPEATED   0x00
 
#define AMBIENT15_TRANSACTION_AUTO_INC   0x20
 
#define AMBIENT15_TRANSACTION_SPEC_FUNC   0x60
 
#define AMBIENT15_SPEC_FUNC_INT_CLEAR   0x01
 
#define AMBIENT15_SPEC_FUNC_STOP_MAN_INT   0x02
 
#define AMBIENT15_SPEC_FUNC_START_MAN_INT   0x03
 
#define AMBIENT15_CONTROL_ADC_INTR   0x20
 Ambient 15 control register setting.
 
#define AMBIENT15_CONTROL_ADC_VALID   0x10
 
#define AMBIENT15_CONTROL_ADC_ENABLE   0x02
 
#define AMBIENT15_CONTROL_POWER_ON   0x01
 
#define AMBIENT15_ATIME_MAX   688.5
 Ambient 15 timing register setting.
 
#define AMBIENT15_ATIME_MIN   2.7
 
#define AMBIENT15_ATIME_STEP   2.7
 
#define AMBIENT15_DEFAULT_ATIME   200.0
 
#define AMBIENT15_ENABLE_INTERRUPT   0x10
 Ambient 15 interrupt register setting.
 
#define AMBIENT15_GAIN_1X   0x00
 Ambient 15 analog register setting.
 
#define AMBIENT15_GAIN_8X   0x01
 
#define AMBIENT15_GAIN_16X   0x02
 
#define AMBIENT15_GAIN_111X   0x03
 
#define AMBIENT15_ID_PARTNO   0x90
 Ambient 15 ID values.
 
#define AMBIENT15_ID2   0x80
 
#define AMBIENT15_CH0_COFF0   1000ul
 Ambient 15 lux calculation coefficients.
 
#define AMBIENT15_CH1_COFF0   2160ul
 
#define AMBIENT15_CH0_COFF1   950ul
 
#define AMBIENT15_CH1_COFF1   1110ul
 
#define AMBIENT15_SET_DEV_ADDR_GND   0x29
 Ambient 15 device address setting.
 
#define AMBIENT15_SET_DEV_ADDR_FLOAT   0x39
 
#define AMBIENT15_SET_DEV_ADDR_VCC   0x49
 
#define AMBIENT15_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  ambient15_return_value_t { AMBIENT15_OK = 0 , AMBIENT15_ERROR = -1 }
 Ambient 15 Click return value data. More...
 

Functions

void ambient15_cfg_setup (ambient15_cfg_t *cfg)
 Ambient 15 configuration object setup function.
 
err_t ambient15_init (ambient15_t *ctx, ambient15_cfg_t *cfg)
 Ambient 15 initialization function.
 
err_t ambient15_default_cfg (ambient15_t *ctx)
 Ambient 15 default configuration function.
 
err_t ambient15_generic_write (ambient15_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Ambient 15 I2C writing function.
 
err_t ambient15_generic_read (ambient15_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Ambient 15 I2C reading function.
 
err_t ambient15_write_register (ambient15_t *ctx, uint8_t reg, uint8_t data_in)
 Ambient 15 write register function.
 
err_t ambient15_read_register (ambient15_t *ctx, uint8_t reg, uint8_t *data_out)
 Ambient 15 read register function.
 
uint8_t ambient15_get_int_pin (ambient15_t *ctx)
 Ambient 15 get int pin function.
 
err_t ambient15_check_communication (ambient15_t *ctx)
 Ambient 15 check communication function.
 
err_t ambient15_set_atime (ambient15_t *ctx, float atime_ms)
 Ambient 15 set atime function.
 
err_t ambient15_set_gain (ambient15_t *ctx, uint8_t gain)
 Ambient 15 set gain function.
 
err_t ambient15_read_raw_data (ambient15_t *ctx, uint16_t *ch_0, uint16_t *ch_1)
 Ambient 15 read raw data function.
 
err_t ambient15_measure_light_level (ambient15_t *ctx, uint16_t *lux)
 Ambient 15 measure light level function.
 

Detailed Description

This file contains API for Ambient 15 Click Driver.

Enumeration Type Documentation

◆ ambient15_return_value_t

Ambient 15 Click return value data.

Predefined enum values for driver return values.

Enumerator
AMBIENT15_OK 
AMBIENT15_ERROR