ambient18 2.0.0.0
ambient18.h File Reference

This file contains API for Ambient 18 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_analog_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  ambient18_t
 Ambient 18 Click context object. More...
 
struct  ambient18_cfg_t
 Ambient 18 Click configuration object. More...
 

Macros

#define AMBIENT18_MODE_SHUTDOWN   0
 Ambient 18 mode setting.
 
#define AMBIENT18_MODE_H_GAIN   1
 
#define AMBIENT18_MODE_M_GAIN   2
 
#define AMBIENT18_MODE_L_GAIN   3
 
#define AMBIENT18_ADC_RESOLUTION   0x0FFF
 Ambient 18 ADC setting.
 
#define AMBIENT18_VREF_3V3   3.3
 
#define AMBIENT18_VREF_5V   5.0
 
#define AMBIENT18_IOUT_CURRENT_H_GAIN   6.1
 Ambient 18 ambient light constants.
 
#define AMBIENT18_IOUT_CURRENT_M_GAIN   0.61
 
#define AMBIENT18_IOUT_CURRENT_L_GAIN   0.061
 
#define AMBIENT18_MICROAMPER_TO_AMPER   0.000001
 
#define AMBIENT18_IOUT_RESISTOR   5420
 
#define AMBIENT18_SET_DEV_ADDR   0x4D
 Ambient 18 device address setting.
 
#define AMBIENT18_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  ambient18_drv_t { AMBIENT18_DRV_SEL_ADC , AMBIENT18_DRV_SEL_I2C }
 Ambient 18 Click driver selector. More...
 
enum  ambient18_return_value_t { AMBIENT18_OK = 0 , AMBIENT18_ERROR = -1 }
 Ambient 18 Click return value data. More...
 

Functions

void ambient18_cfg_setup (ambient18_cfg_t *cfg)
 Ambient 18 configuration object setup function.
 
void ambient18_drv_interface_selection (ambient18_cfg_t *cfg, ambient18_drv_t drv_sel)
 Ambient 18 driver interface setup function.
 
err_t ambient18_init (ambient18_t *ctx, ambient18_cfg_t *cfg)
 Ambient 18 initialization function.
 
err_t ambient18_read_raw_adc (ambient18_t *ctx, uint16_t *raw_adc)
 Ambient 18 read raw ADC value function.
 
err_t ambient18_read_voltage (ambient18_t *ctx, float *voltage)
 Ambient 18 read voltage level function.
 
err_t ambient18_set_vref (ambient18_t *ctx, float vref)
 Ambient 18 set vref function.
 
void ambient18_set_gain_mode (ambient18_t *ctx, uint8_t mode)
 Ambient 18 set gain mode function.
 
int32_t ambient18_voltage_to_lux (ambient18_t *ctx, float voltage)
 Ambient 18 voltage to illuminance function.
 

Detailed Description

This file contains API for Ambient 18 Click Driver.

Enumeration Type Documentation

◆ ambient18_drv_t

Ambient 18 Click driver selector.

Selects target driver interface of Ambient 18 Click driver.

Enumerator
AMBIENT18_DRV_SEL_ADC 

ADC driver descriptor.

AMBIENT18_DRV_SEL_I2C 

I2C driver descriptor.

◆ ambient18_return_value_t

Ambient 18 Click return value data.

Predefined enum values for driver return values.

Enumerator
AMBIENT18_OK 
AMBIENT18_ERROR