proximity 2.0.0.0
proximity.h File Reference

This file contains API for Proximity 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  proximity_t
 Click ctx object definition. More...
 
struct  proximity_cfg_t
 Click configuration structure definition. More...
 

Macros

#define PROXIMITY_MAP_MIKROBUS(cfg, mikrobus)
 
#define PROXIMITY_RETVAL   uint8_t
 
#define PROXIMITY_OK   0x00
 
#define PROXIMITY_INIT_ERROR   0xFF
 
#define PROXIMITY_SLAVE_ADDR   0x13
 
#define PROXIMITY_REGISTER_COMMAND   0x80
 
#define PROXIMITY_REGISTER_ID   0x81
 
#define PROXIMITY_REGISTER_PROX_RATE   0x82
 
#define PROXIMITY_REGISTER_PROX_CURRENT   0x83
 
#define PROXIMITY_REGISTER_AMBI_PARAMETER   0x84
 
#define PROXIMITY_REGISTER_AMBI_VALUE   0x85
 
#define PROXIMITY_REGISTER_PROX_VALUE   0x87
 
#define PROXIMITY_REGISTER_INTERRUPT_CONTROL   0x89
 
#define PROXIMITY_REGISTER_INTERRUPT_LOW_THRES   0x8a
 
#define PROXIMITY_REGISTER_INTERRUPT_HIGH_THRES   0x8c
 
#define PROXIMITY_REGISTER_INTERRUPT_STATUS   0x8e
 
#define PROXIMITY_REGISTER_PROX_TIMING   0xf9
 
#define PROXIMITY_REGISTER_AMBI_IR_LIGHT_LEVEL   0x90
 
#define PROXIMITY_COMMAND_ALL_DISABLE   0x00
 
#define PROXIMITY_COMMAND_SELFTIMED_MODE_ENABLE   0x01
 
#define PROXIMITY_COMMAND_PROX_ENABLE   0x02
 
#define PROXIMITY_COMMAND_AMBI_ENABLE   0x04
 
#define PROXIMITY_COMMAND_PROX_ON_DEMAND   0x08
 
#define PROXIMITY_COMMAND_AMBI_ON_DEMAND   0x10
 
#define PROXIMITY_COMMAND_MASK_PROX_DATA_READY   0x20
 
#define PROXIMITY_COMMAND_MASK_AMBI_DATA_READY   0x40
 
#define PROXIMITY_COMMAND_MASK_LOCK   0x80
 
#define PROXIMITY_PRODUCT_MASK_REVISION_ID   0x0f
 
#define PROXIMITY_PRODUCT_MASK_PRODUCT_ID   0xf0
 
#define PROXIMITY_MEASUREMENT_RATE_2   0x00
 
#define PROXIMITY_MEASUREMENT_RATE_4   0x01
 
#define PROXIMITY_MEASUREMENT_RATE_8   0x02
 
#define PROXIMITY_MEASUREMENT_RATE_16   0x03
 
#define PROXIMITY_MEASUREMENT_RATE_31   0x04
 
#define PROXIMITY_MEASUREMENT_RATE_62   0x05
 
#define PROXIMITY_MEASUREMENT_RATE_125   0x06
 
#define PROXIMITY_MEASUREMENT_RATE_250   0x07
 
#define PROXIMITY_MASK_MEASUREMENT_RATE   0x07
 
#define PROXIMITY_MASK_LED_CURRENT   0x3f
 
#define PROXIMITY_MASK_FUSE_PROG_ID   0xc0
 
#define PROXIMITY_AMBI_PARA_AVERAGE_1   0x00
 
#define PROXIMITY_AMBI_PARA_AVERAGE_2   0x01
 
#define PROXIMITY_AMBI_PARA_AVERAGE_4   0x02
 
#define PROXIMITY_AMBI_PARA_AVERAGE_8   0x03
 
#define PROXIMITY_AMBI_PARA_AVERAGE_16   0x04
 
#define PROXIMITY_AMBI_PARA_AVERAGE_32   0x05
 
#define PROXIMITY_AMBI_PARA_AVERAGE_64   0x06
 
#define PROXIMITY_AMBI_PARA_AVERAGE_128   0x07
 
#define PROXIMITY_AMBI_MASK_PARA_AVERAGE   0x07
 
#define PROXIMITY_AMBI_PARA_AUTO_OFFSET_ENABLE   0x08
 
#define PROXIMITY_AMBI_MASK_PARA_AUTO_OFFSET   0x08
 
#define PROXIMITY_AMBI_PARA_MEAS_RATE_1   0x00
 
#define PROXIMITY_AMBI_PARA_MEAS_RATE_2   0x10
 
#define PROXIMITY_AMBI_PARA_MEAS_RATE_3   0x20
 
#define PROXIMITY_AMBI_PARA_MEAS_RATE_4   0x30
 
#define PROXIMITY_AMBI_PARA_MEAS_RATE_5   0x40
 
#define PROXIMITY_AMBI_PARA_MEAS_RATE_6   0x50
 
#define PROXIMITY_AMBI_PARA_MEAS_RATE_8   0x60
 
#define PROXIMITY_AMBI_PARA_MEAS_RATE_10   0x70
 
#define PROXIMITY_AMBI_MASK_PARA_MEAS_RATE   0x70
 
#define PROXIMITY_AMBI_PARA_CONT_CONV_ENABLE   0x80
 
#define PROXIMITY_AMBI_MASK_PARA_CONT_CONV   0x80
 
#define PROXIMITY_INTERRUPT_THRES_SEL_PROX   0x00
 
#define PROXIMITY_INTERRUPT_THRES_SEL_ALS   0x01
 
#define PROXIMITY_INTERRUPT_THRES_ENABLE   0x02
 
#define PROXIMITY_INTERRUPT_ALS_READY_ENABLE   0x04
 
#define PROXIMITY_INTERRUPT_PROX_READY_ENABLE   0x08
 
#define PROXIMITY_INTERRUPT_COUNT_EXCEED_1   0x00
 
#define PROXIMITY_INTERRUPT_COUNT_EXCEED_2   0x20
 
#define PROXIMITY_INTERRUPT_COUNT_EXCEED_4   0x40
 
#define PROXIMITY_INTERRUPT_COUNT_EXCEED_8   0x60
 
#define PROXIMITY_INTERRUPT_COUNT_EXCEED_16   0x80
 
#define PROXIMITY_INTERRUPT_COUNT_EXCEED_32   0xa0
 
#define PROXIMITY_INTERRUPT_COUNT_EXCEED_64   0xc0
 
#define PROXIMITY_INTERRUPT_COUNT_EXCEED_128   0xe0
 
#define PROXIMITY_INTERRUPT_MASK_COUNT_EXCEED   0xe0
 
#define PROXIMITY_INTERRUPT_STATUS_THRES_HI   0x01
 
#define PROXIMITY_INTERRUPT_STATUS_THRES_LO   0x02
 
#define PROXIMITY_INTERRUPT_STATUS_ALS_READY   0x04
 
#define PROXIMITY_INTERRUPT_STATUS_PROX_READY   0x08
 
#define PROXIMITY_INTERRUPT_MASK_STATUS_THRES_HI   0x01
 
#define PROXIMITY_INTERRUPT_MASK_THRES_LO   0x02
 
#define PROXIMITY_INTERRUPT_MASK_ALS_READY   0x04
 
#define PROXIMITY_INTERRUPT_MASK_PROX_READY   0x08
 

Functions

void proximity_cfg_setup (proximity_cfg_t *cfg)
 Config Object Initialization function.
 
PROXIMITY_RETVAL proximity_init (proximity_t *ctx, proximity_cfg_t *cfg)
 Initialization function.
 
void proximity_write_byte (proximity_t *ctx, uint8_t w_addr, uint8_t w_data)
 Functions for write one byte in register.
 
uint8_t proximity_read_byte (proximity_t *ctx, uint8_t r_addr)
 Functions for read byte from register.
 
void proximity_read_data (proximity_t *ctx, uint8_t r_addr, uint8_t *rcv_data, uint8_t n_len)
 Functions for read data from register.
 
void proximity_write_data (proximity_t *ctx, uint8_t w_addr, uint8_t *wr_data, uint8_t n_len)
 Functions for write data.
 
void proximity_set_default_mode (proximity_t *ctx)
 Functions for sets default mode.
 
void proximity_set_upper_threshold (proximity_t *ctx)
 Functions for sets upper threshold.
 
uint16_t proximity_read_prox_data (proximity_t *ctx)
 Functions for reads Proximity data.
 
uint16_t proximity_read_ambient_light (proximity_t *ctx)
 Functions for reads Ambient light.
 

Detailed Description

This file contains API for Proximity Click driver.