proximity13 2.0.0.0
proximity13.h File Reference

This file contains API for Proximity 13 Click driver. More...

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

Go to the source code of this file.

Data Structures

struct  proximity13_t
 Click ctx object definition. More...
 
struct  proximity13_cfg_t
 Click configuration structure definition. More...
 
struct  proximity13_config_t
 Structure for configurating device. More...
 
struct  proximity13_chn_val_t
 Structure for reading values of channels. More...
 

Macros

#define PROXIMITY13_MAP_MIKROBUS(cfg, mikrobus)
 
#define PROXIMITY13_RETVAL   uint8_t
 
#define PROXIMITY13_OK   0x00
 
#define PROXIMITY13_INIT_ERROR   0xFF
 
#define PROXIMITY13_ERROR   0xEE
 
#define PROXIMITY13_SLAVE_ADDRESS   0x53
 
#define PROXIMITY13_REG_PART_ID   0x00
 
#define PROXIMITY13_REG_HW_ID   0x01
 
#define PROXIMITY13_REG_REV_ID   0x02
 
#define PROXIMITY13_REG_INFO_0   0x03
 
#define PROXIMITY13_REG_INFO_1   0x04
 
#define PROXIMITY13_REG_HOSTIN_0   0x0A
 
#define PROXIMITY13_REG_COMMAND   0x0B
 
#define PROXIMITY13_REG_IRQ_ENABLE   0x0F
 
#define PROXIMITY13_REG_RESPONSE_1   0x10
 
#define PROXIMITY13_REG_RESPONSE_0   0x11
 
#define PROXIMITY13_REG_IRQ_STATUS   0x12
 
#define PROXIMITY13_REG_HOSTOUT_0   0x13
 
#define PROXIMITY13_REG_HOSTOUT_1   0x14
 
#define PROXIMITY13_REG_HOSTOUT_2   0x15
 
#define PROXIMITY13_REG_HOSTOUT_3   0x16
 
#define PROXIMITY13_REG_HOSTOUT_4   0x17
 
#define PROXIMITY13_REG_HOSTOUT_5   0x18
 
#define PROXIMITY13_REG_HOSTOUT_6   0x19
 
#define PROXIMITY13_REG_HOSTOUT_7   0x1A
 
#define PROXIMITY13_REG_HOSTOUT_8   0x1B
 
#define PROXIMITY13_REG_HOSTOUT_9   0x1C
 
#define PROXIMITY13_REG_HOSTOUT_10   0x1D
 
#define PROXIMITY13_REG_HOSTOUT_11   0x1E
 
#define PROXIMITY13_REG_HOSTOUT_12   0x1F
 
#define PROXIMITY13_REG_HOSTOUT_13   0x20
 
#define PROXIMITY13_REG_HOSTOUT_14   0x21
 
#define PROXIMITY13_REG_HOSTOUT_15   0x22
 
#define PROXIMITY13_REG_HOSTOUT_16   0x23
 
#define PROXIMITY13_REG_HOSTOUT_17   0x24
 
#define PROXIMITY13_REG_HOSTOUT_18   0x25
 
#define PROXIMITY13_REG_HOSTOUT_19   0x26
 
#define PROXIMITY13_REG_HOSTOUT_20   0x27
 
#define PROXIMITY13_REG_HOSTOUT_21   0x28
 
#define PROXIMITY13_REG_HOSTOUT_22   0x29
 
#define PROXIMITY13_REG_HOSTOUT_23   0x2A
 
#define PROXIMITY13_REG_HOSTOUT_24   0x2B
 
#define PROXIMITY13_REG_HOSTOUT_25   0x2C
 
#define PROXIMITY13_PARAMETER_I2C_ADDR   0x00
 
#define PROXIMITY13_PARAMETER_CHAN_LIST   0x01
 
#define PROXIMITY13_PARAMETER_ADCCONFIG_0   0x02
 
#define PROXIMITY13_PARAMETER_ADCSENS_0   0x03
 
#define PROXIMITY13_PARAMETER_ADCPOST_0   0x04
 
#define PROXIMITY13_PARAMETER_MEASCONFIG_0   0x05
 
#define PROXIMITY13_PARAMETER_ADCCONFIG_1   0x06
 
#define PROXIMITY13_PARAMETER_ADCSENS_1   0x07
 
#define PROXIMITY13_PARAMETER_ADCPOST_1   0x08
 
#define PROXIMITY13_PARAMETER_MEASCONFIG_1   0x09
 
#define PROXIMITY13_PARAMETER_ADCCONFIG_2   0x0A
 
#define PROXIMITY13_PARAMETER_ADCSENS_2   0x0B
 
#define PROXIMITY13_PARAMETER_ADCPOST_2   0x0C
 
#define PROXIMITY13_PARAMETER_MEASCONFIG_2   0x0D
 
#define PROXIMITY13_PARAMETER_ADCCONFIG_3   0x0E
 
#define PROXIMITY13_PARAMETER_ADCSENS_3   0x0F
 
#define PROXIMITY13_PARAMETER_ADCPOST_3   0x10
 
#define PROXIMITY13_PARAMETER_MEASCONFIG_3   0x11
 
#define PROXIMITY13_PARAMETER_ADCCONFIG_4   0x12
 
#define PROXIMITY13_PARAMETER_ADCSENS_4   0x13
 
#define PROXIMITY13_PARAMETER_ADCPOST_4   0x14
 
#define PROXIMITY13_PARAMETER_MEASCONFIG_4   0x15
 
#define PROXIMITY13_PARAMETER_ADCCONFIG_5   0x16
 
#define PROXIMITY13_PARAMETER_ADCSENS_5   0x17
 
#define PROXIMITY13_PARAMETER_ADCPOST_5   0x18
 
#define PROXIMITY13_PARAMETER_MEASCONFIG_5   0x19
 
#define PROXIMITY13_PARAMETER_MEASRATE_H   0x1A
 
#define PROXIMITY13_PARAMETER_MEASRATE_L   0x1B
 
#define PROXIMITY13_PARAMETER_MEASCOUNT_0   0x1C
 
#define PROXIMITY13_PARAMETER_MEASCOUNT_1   0x1D
 
#define PROXIMITY13_PARAMETER_MEASCOUNT_2   0x1E
 
#define PROXIMITY13_PARAMETER_LED1_A   0x1F
 
#define PROXIMITY13_PARAMETER_LED1_B   0x20
 
#define PROXIMITY13_PARAMETER_LED2_A   0x21
 
#define PROXIMITY13_PARAMETER_LED2_B   0x22
 
#define PROXIMITY13_PARAMETER_LED3_A   0x23
 
#define PROXIMITY13_PARAMETER_LED3_B   0x24
 
#define PROXIMITY13_PARAMETER_THRESHOLD0_H   0x25
 
#define PROXIMITY13_PARAMETER_THRESHOLD0_L   0x26
 
#define PROXIMITY13_PARAMETER_THRESHOLD1_H   0x27
 
#define PROXIMITY13_PARAMETER_THRESHOLD1_L   0x28
 
#define PROXIMITY13_PARAMETER_THRESHOLD2_H   0x29
 
#define PROXIMITY13_PARAMETER_THRESHOLD2_L   0x2A
 
#define PROXIMITY13_PARAMETER_BURST   0x2B
 
#define PROXIMITY13_CMD_RESET_CTR   0x00
 
#define PROXIMITY13_CMD_RESET_SW   0x01
 
#define PROXIMITY13_CMD_FORCE   0x11
 
#define PROXIMITY13_CMD_PAUSE   0x12
 
#define PROXIMITY13_CMD_START   0x13
 
#define PROXIMITY13_DEV_ID_VAL   0x53
 
#define PROXIMITY13_HW_ID_VAL   0x01
 
#define PROXIMITY13_REV_ID_VAL   0x11
 
#define PROXIMITY13_ADC_CFG_RATE_48p8_US   0x00
 
#define PROXIMITY13_ADC_CFG_RATE_97p6_US   0x20
 
#define PROXIMITY13_ADC_CFG_RATE_195_US   0x40
 
#define PROXIMITY13_ADC_CFG_RATE_24p4_US   0x60
 
#define PROXIMITY13_ADC_CFG_MUX_SMALL_IR   0x00
 
#define PROXIMITY13_ADC_CFG_MUX_MEDIUM_IR   0x01
 
#define PROXIMITY13_ADC_CFG_MUX_LARGE_IR   0x02
 
#define PROXIMITY13_ADC_CFG_MUX_WHITE   0x0B
 
#define PROXIMITY13_ADC_CFG_MUX_LARGE_WHITE   0x0D
 
#define PROXIMITY13_ADC_SENS_SW_GAIN_1   0x00
 
#define PROXIMITY13_ADC_SENS_SW_GAIN_2   0x10
 
#define PROXIMITY13_ADC_SENS_SW_GAIN_4   0x20
 
#define PROXIMITY13_ADC_SENS_SW_GAIN_8   0x30
 
#define PROXIMITY13_ADC_SENS_SW_GAIN_16   0x40
 
#define PROXIMITY13_ADC_SENS_SW_GAIN_32   0x50
 
#define PROXIMITY13_ADC_SENS_SW_GAIN_64   0x60
 
#define PROXIMITY13_ADC_SENS_SW_GAIN_128   0x70
 
#define PROXIMITY13_ADC_SENS_HW_GAIN_MIN_24p4_US   0x00
 
#define PROXIMITY13_ADC_SENS_HW_GAIN_MAX_50_MS   0x0B
 
#define PROXIMITY13_ADC_POST_RESOLUTION_16   0x00
 
#define PROXIMITY13_ADC_POST_RESOLUTION_24   0x40
 
#define PROXIMITY13_ADC_POST_INT_MORE_THEN_THRESH   0x00
 
#define PROXIMITY13_ADC_POST_INT_LESS_THEN_THRESH   0x04
 
#define PROXIMITY13_ADC_POST_INT_NO_TRESH   0x00
 
#define PROXIMITY13_ADC_POST_INT_THRESHOLD_0_EN   0x01
 
#define PROXIMITY13_ADC_POST_INT_THRESHOLD_1_EN   0x02
 
#define PROXIMITY13_ADC_POST_INT_BETWEEN_TRESHOLD   0x03
 
#define PROXIMITY13_MEAS_CFG_BURST_ONLY   0x00
 
#define PROXIMITY13_MEAS_CFG_MEASCOUNT0   0x40
 
#define PROXIMITY13_MEAS_CFG_MEASCOUNT1   0x80
 
#define PROXIMITY13_MEAS_CFG_MEASCOUNT2   0xC0
 
#define PROXIMITY13_MEAS_CFG_NOMINAL_LED   0x00
 
#define PROXIMITY13_MEAS_CFG_LED_UNDEFINED   0x10
 
#define PROXIMITY13_MEAS_CFG_LED_INC_9_PCT   0x20
 
#define PROXIMITY13_MEAS_CFG_LED_INC_10_PCT   0x30
 
#define PROXIMITY13_MEAS_CFG_LED_A   0x00
 
#define PROXIMITY13_MEAS_CFG_LED_B   0x08
 
#define PROXIMITY13_MEAS_CFG_LED_2   0x04
 
#define PROXIMITY13_MEAS_CFG_LED_3   0x02
 
#define PROXIMITY13_MEAS_CFG_LED_1   0x01
 
#define PROXIMITY13_PIN_HIGH   1
 
#define PROXIMITY13_PIN_LOW   0
 
#define PROXIMITY13_CHANNEL_0   0x01
 
#define PROXIMITY13_CHANNEL_1   0x02
 
#define PROXIMITY13_CHANNEL_2   0x04
 
#define PROXIMITY13_CHANNEL_3   0x08
 
#define PROXIMITY13_CHANNEL_4   0x10
 
#define PROXIMITY13_CHANNEL_5   0x20
 

Functions

void proximity13_cfg_setup (proximity13_cfg_t *cfg)
 Config Object Initialization function.
 
PROXIMITY13_RETVAL proximity13_init (proximity13_t *ctx, proximity13_cfg_t *cfg)
 Initialization function.
 
void proximity13_default_cfg (proximity13_t *ctx)
 Click Default Configuration function.
 
void proximity13_generic_write (proximity13_t *ctx, uint8_t reg_adr, uint8_t write_data)
 Generic write function.
 
uint8_t proximity13_generic_read (proximity13_t *ctx, uint8_t reg_adr)
 Generic read function.
 
uint8_t proximity13_get_int_pin_status (proximity13_t *ctx)
 Checks status of int pin.
 
uint8_t proximity13_send_command (proximity13_t *ctx, uint8_t cmd_val)
 Sends command to command register.
 
uint8_t proximity13_set_parameter (proximity13_t *ctx, uint8_t param, uint8_t cmd_val)
 Sets parameter.
 
uint8_t porximity13_config_channel (proximity13_t *ctx, uint8_t chn_num, proximity13_config_t cfg_val)
 Configuration of channel.
 
uint8_t porximity13_check_id (proximity13_t *ctx)
 Checks id of the device.
 
void proximity13_read_channels (proximity13_t *ctx, proximity13_chn_val_t *chn_val)
 Reads all enabled channels.
 

Detailed Description

This file contains API for Proximity 13 Click driver.