ambient2 2.0.0.0
ambient2.h File Reference

This file contains API for Ambient 2 Click driver. More...

#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  ambient2_sens_data_t
 Click sensor data definition. More...
 
struct  ambient2_t
 Click context object definition. More...
 
struct  ambient2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define AMBIENT2_CFG_RANGE_40_95_LX_MIN   0x0
 
#define AMBIENT2_CFG_RANGE_81_9_LX   0x1000
 
#define AMBIENT2_CFG_RANGE_163_8_LX   0x2000
 
#define AMBIENT2_CFG_RANGE_327_6_LX   0x3000
 
#define AMBIENT2_CFG_RANGE_655_2_LX   0x4000
 
#define AMBIENT2_CFG_RANGE_1310_4_LX   0x5000
 
#define AMBIENT2_CFG_RANGE_2620_8_LX   0x6000
 
#define AMBIENT2_CFG_RANGE_5241_6_LX   0x7000
 
#define AMBIENT2_CFG_RANGE_10483_2_LX   0x8000
 
#define AMBIENT2_CFG_RANGE_20966_4_LX   0x9000
 
#define AMBIENT2_CFG_RANGE_41932_8_LX   0xA000
 
#define AMBIENT2_CFG_RANGE_83865_6_LX_MAX   0xB000
 
#define AMBIENT2_CFG_RANGE_AUTO_SCALE   0xC000
 
#define AMBIENT2_CFG_CONV_TIME_100MS   0x0
 
#define AMBIENT2_CFG_CONV_TIME_800MS   0x800
 
#define AMBIENT2_CFG_CONV_MODE_SHUTDOWN   0x0
 
#define AMBIENT2_CFG_CONV_MODE_SINGLE_SHOT   0x200
 
#define AMBIENT2_CFG_CONV_MODE_CONT_CONV   0x400
 
#define AMBIENT2_CFG_LATCH_COMP_HYSTERESIS_STYLE   0x0
 
#define AMBIENT2_CFG_LATCH_COMP_WINDOW_STYLE   0x10
 
#define AMBIENT2_CFG_POL_INT_ACTIVE_LOW   0x0
 
#define AMBIENT2_CFG_POL_INT_ACTIVE_HIGH   0x8
 
#define AMBIENT2_CFG_MASK_EXPONENT   0x4
 
#define AMBIENT2_CFG_FAULT_1_COUNT   0x0
 
#define AMBIENT2_CFG_FAULT_2_COUNTS   0x1
 
#define AMBIENT2_CFG_FAULT_4_COUNTS   0x2
 
#define AMBIENT2_CFG_FAULT_8_COUNTS   0x3
 
#define AMBIENT2_FLAG_MASK_OVERFLOW   0x100
 
#define AMBIENT2_FLAG_MASK_CONV_READY   0x80
 
#define AMBIENT2_FLAG_MASK_HIGH   0x40
 
#define AMBIENT2_FLAG_MASK_LOW   0x20
 
#define AMBIENT2_ID_MANUFACTURER   0x5449
 
#define AMBIENT2_ID_DEVICE   0x3001
 
#define AMBIENT2_MAP_MIKROBUS(cfg, mikrobus)
 

Typedefs

typedef uint16_t ambient2_data_t
 Click registers data type.
 

Enumerations

enum  ambient2_err_t { AMBIENT2_OK = 0x0 , AMBIENT2_ERR_INIT_DRV = 0xFE , AMBIENT2_ERR_UNSUPPORTED_PIN }
 Click error code definition. More...
 
enum  ambient_addr_t { AMBIENT2_I2C_ADDRESS_GND = 0x44 , AMBIENT2_I2C_ADDRESS_VDD , AMBIENT2_I2C_ADDRESS_SDA , AMBIENT2_I2C_ADDRESS_SCL }
 Click I2C address selection. More...
 
enum  ambient2_reg_addr_t {
  AMBIENT2_REG_RESULT = 0x0 , AMBIENT2_REG_CONFIGURATION , AMBIENT2_REG_LOW_LIMIT , AMBIENT2_REG_HIGH_LIMIT ,
  AMBIENT2_REG_MANUFACTURER_ID = 0x7E , AMBIENT2_REG_DEVICE_ID
}
 Click register address selection. More...
 

Functions

void ambient2_cfg_setup (ambient2_cfg_t *cfg)
 Configuration Object Setup function.
 
ambient2_err_t ambient2_init (ambient2_t *ctx, ambient2_cfg_t *cfg)
 Click Initialization function.
 
void ambient2_default_cfg (ambient2_t *ctx)
 Click Default Configuration function.
 
void ambient2_generic_write (ambient2_t *ctx, ambient2_reg_addr_t reg_addr, ambient2_data_t data_in)
 Generic Write function.
 
ambient2_data_t ambient2_generic_read (ambient2_t *ctx, ambient2_reg_addr_t reg_addr)
 Generic Read function.
 
void ambient2_get_sens_results (ambient2_t *ctx)
 Sensor Results Read function.
 
uint8_t ambient2_get_int (ambient2_t *ctx)
 INT Pin Check function.
 

Detailed Description

This file contains API for Ambient 2 Click driver.