irsense 2.0.0.0
irsense.h File Reference

This file contains API for IR SENSE 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  irsense_t
 Click ctx object definition. More...
 
struct  irsense_ir_data_t
 IR data structure definition. More...
 
struct  irsense_eint_t
 Enable interrupt structure definition. More...
 
struct  irsense_reg_t
 Register address structure definition. More...
 
struct  irsense_eeprom_t
 EEPROM map structure definition. More...
 
struct  irsense_cfg_t
 Click configuration structure definition. More...
 

Macros

#define IRSENSE_MAP_MIKROBUS(cfg, mikrobus)
 
#define IRSENSE_RETVAL   uint8_t
 
#define IRSENSE_OK   0x00
 
#define IRSENSE_INIT_ERROR   0xFF
 
#define IRSENSE_I2C_ADDRESS_0   0x64
 
#define IRSENSE_I2C_ADDRESS_1   0x65
 
#define IRSENSE_I2C_ADDRESS_2   0x66
 
#define IRSENSE_REG_WIA1   0x00
 
#define IRSENSE_REG_WIA2   0x01
 
#define IRSENSE_REG_INFO1   0x02
 
#define IRSENSE_REG_INFO2   0x03
 
#define IRSENSE_REG_INTST   0x04
 
#define IRSENSE_REG_ST1   0x05
 
#define IRSENSE_REG_IR1_LOW   0x06
 
#define IRSENSE_REG_IR1_HIGH   0x07
 
#define IRSENSE_REG_IR2_LOW   0x08
 
#define IRSENSE_REG_IR2_HIGH   0x09
 
#define IRSENSE_REG_IR3_LOW   0x0A
 
#define IRSENSE_REG_IR3_HIGH   0x0B
 
#define IRSENSE_REG_IR4_LOW   0x0C
 
#define IRSENSE_REG_IR4_HIGH   0x0D
 
#define IRSENSE_REG_TMP_LOW   0x0E
 
#define IRSENSE_REG_TMP_HIGH   0x0F
 
#define IRSENSE_REG_ST2   0x10
 
#define IRSENSE_REG_ETH13H_LOW   0x11
 
#define IRSENSE_REG_ETH13H_HIGH   0x12
 
#define IRSENSE_REG_ETH13L_LOW   0x13
 
#define IRSENSE_REG_ETH13L_HIGH   0x14
 
#define IRSENSE_REG_ETH24H_LOW   0x15
 
#define IRSENSE_REG_ETH24H_HIGH   0x16
 
#define IRSENSE_REG_ETH24L_LOW   0x17
 
#define IRSENSE_REG_ETH24L_HIGH   0x18
 
#define IRSENSE_REG_EHYS13   0x19
 
#define IRSENSE_REG_EHYS24   0x1A
 
#define IRSENSE_REG_EINTEN   0x1B
 
#define IRSENSE_REG_ECNTL1   0x1C
 
#define IRSENSE_REG_CNTL2   0x1D
 
#define IRSENSE_EEPROM_MAP_EKEY   0x50
 
#define IRSENSE_EEPROM_MAP_ETH13H_LOW   0x51
 
#define IRSENSE_EEPROM_MAP_ETH13H_HIGH   0x52
 
#define IRSENSE_EEPROM_MAP_ETH13L_LOW   0x53
 
#define IRSENSE_EEPROM_MAP_ETH13L_HIGH   0x54
 
#define IRSENSE_EEPROM_MAP_ETH24H_LOW   0x55
 
#define IRSENSE_EEPROM_MAP_ETH24H_HIGH   0x56
 
#define IRSENSE_EEPROM_MAP_ETH24L_LOW   0x57
 
#define IRSENSE_EEPROM_MAP_ETH24L_HIGH   0x58
 
#define IRSENSE_EEPROM_MAP_EHYS13   0x59
 
#define IRSENSE_EEPROM_MAP_EHYS24   0x5A
 
#define IRSENSE_EEPROM_MAP_EINTEN   0x5B
 
#define IRSENSE_EEPROM_MAP_ECNTL1   0x5C
 
#define IRSENSE_ECNTL1_MODE_STAND_BY   0x00
 
#define IRSENSE_ECNTL1_MODE_EEPROM_ACCESS   0x01
 
#define IRSENSE_ECNTL1_MODE_SINGLE_SHOT   0x02
 
#define IRSENSE_ECNTL1_MODE_BE_PROHIBITED   0x03
 
#define IRSENSE_ECNTL1_MODE_CONTINUOUS_0   0x04
 
#define IRSENSE_ECNTL1_MODE_CONTINUOUS_1   0x05
 
#define IRSENSE_ECNTL1_MODE_CONTINUOUS_2   0x06
 
#define IRSENSE_ECNTL1_MODE_CONTINUOUS_3   0x07
 
#define IRSENSE_ECNTL1_CUTOFF_FREQUENCY_0_3_Hz   0x00
 
#define IRSENSE_ECNTL1_CUTOFF_FREQUENCY_0_6_Hz   0x08
 
#define IRSENSE_ECNTL1_CUTOFF_FREQUENCY_1_1_Hz   0x10
 
#define IRSENSE_ECNTL1_CUTOFF_FREQUENCY_2_2_Hz   0x18
 
#define IRSENSE_ECNTL1_CUTOFF_FREQUENCY_4_4_Hz   0x20
 
#define IRSENSE_ECNTL1_CUTOFF_FREQUENCY_8_8_Hz   0x28
 
#define IRSENSE_EINTEN_IR13_HIGH_INT_DISABLE   0x00
 
#define IRSENSE_EINTEN_IR13_HIGH_INT_ENABLE   0x01
 
#define IRSENSE_EINTEN_IR13_LOW_INT_DISABLE   0x00
 
#define IRSENSE_EINTEN_IR13_LOW_INT_ENABLE   0x01
 
#define IRSENSE_EINTEN_IR24_HIGH_INT_DISABLE   0x00
 
#define IRSENSE_EINTEN_IR24_HIGH_INT_ENABLE   0x01
 
#define IRSENSE_EINTEN_IR24_LOW_INT_DISABLE   0x00
 
#define IRSENSE_EINTEN_IR24_LOW_INT_ENABLE   0x01
 
#define IRSENSE_EINTEN_DRI_INT_DISABLE   0x00
 
#define IRSENSE_EINTEN_DRI_INT_ENABLE   0x01
 
#define IRSENSE_CNTL2_SOFT_RESET   0x01
 
#define IRSENSE_EEPROM_MAP_VAL_EKEY   0xA5
 
#define IRSENSE_ENABLE_SETTINGS_EEPROM_MODE   0x38
 
#define IRSENSE_ENABLE_EEPROM_MODE   0xC1
 
#define IRSENSE_EINTEN_RESET_VALUE   0xC0
 

Functions

void irsense_cfg_setup (irsense_cfg_t *cfg)
 Config Object Initialization function.
 
IRSENSE_RETVAL irsense_init (irsense_t *ctx, irsense_cfg_t *cfg)
 Initialization function.
 
void irsense_generic_write (irsense_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void irsense_generic_read (irsense_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void irsense_write_byte (irsense_t *ctx, uint8_t reg_address, uint8_t write_data)
 Generic write the byte of data function.
 
uint8_t irsense_read_byte (irsense_t *ctx, uint8_t reg_address)
 Generic read the byte of data function.
 
uint16_t irsense_read_data (irsense_t *ctx, uint8_t reg_address_low)
 Generic read 16-bit of data function.
 
void irsense_power_on (irsense_t *ctx)
 Enable the sensor function.
 
void irsense_power_off (irsense_t *ctx)
 Disable the sensor function.
 
uint8_t irsense_get_company_code (irsense_t *ctx)
 Get company code function.
 
uint8_t irsense_get_device_id (irsense_t *ctx)
 Get device ID function.
 
uint8_t irsense_read_interrupt_status (irsense_t *ctx)
 Get interrupts activate or inactivate corresponding status value function.
 
uint8_t irsense_get_status (irsense_t *ctx)
 Get status value function.
 
void irsense_set_configuration (irsense_t *ctx, uint8_t register_value)
 Set configuration function.
 
void irsense_set_mode (irsense_t *ctx, uint8_t mode)
 Set the mode function.
 
void irsense_set_cutoff_frequency (irsense_t *ctx, uint8_t frequency)
 Set the cutoff frequency function.
 
uint8_t irsense_check_available (irsense_t *ctx)
 Checks to see if DRDY flag is set in the status register function.
 
uint8_t irsense_check_overrun (irsense_t *ctx)
 Checks to see if data overrun flag is set in the status register function.
 
void irsense_soft_reset (irsense_t *ctx)
 Soft reset function.
 
void irsense_refresh (irsense_t *ctx)
 Refresh by read dummy data function.
 
int16_t irsense_get_ir1 (irsense_t *ctx)
 Get value of sensor channel 1 function.
 
int16_t irsense_get_ir2 (irsense_t *ctx)
 Get value of sensor channel 2 function.
 
int16_t irsense_get_ir3 (irsense_t *ctx)
 Get value of sensor channel 3 function.
 
int16_t irsense_get_ir4 (irsense_t *ctx)
 Get value of sensor channel 4 function.
 
void irsense_get_ir_sense (irsense_t *ctx, irsense_ir_data_t *ir_data)
 Get value of sensor all channels function.
 
float irsense_get_temperature (irsense_t *ctx)
 Get the temperature in degrees Celsius function.
 
float irsense_get_temperature_f (irsense_t *ctx)
 Get the temperature in Fahrenheit degrees function.
 
void irsense_set_threshold_ir2_ir4 (irsense_t *ctx, uint8_t value)
 Set high or low threshold for channel 2 and channel 4 ( Ir2-Ir4 ) function.
 
uint16_t irsense_get_threshold_ir2_ir4 (irsense_t *ctx)
 Get threshold value for channel 2 and channel 4 ( Ir2-Ir4 ) function.
 
void irsense_set_threshold_eeprom_ir2_ir4 (irsense_t *ctx, uint8_t value)
 Set high or low EEPROM threshold for channel 2 and channel 4 ( Ir2-Ir4 ) function.
 
void irsense_set_threshold_ir1_ir3 (irsense_t *ctx, uint8_t value)
 Set high or low threshold for channel 1 and channel 3 ( Ir1-Ir3 ) function.
 
uint16_t irsense_get_threshold_ir1_ir3 (irsense_t *ctx)
 Get threshold value for channel 1 and channel 3 ( Ir1-Ir3 ) function.
 
void irsense_set_threshold_eeprom_ir1_ir3 (irsense_t *ctx, uint8_t value)
 Set high or low EEPROM threshold for channel 1 and channel 3 ( Ir1-Ir3 ) function.
 
void irsense_read_threshold (irsense_t *ctx, irsense_reg_t *reg)
 Get threshold value for all channels function.
 
void irsense_read_threshold_eeprom (irsense_t *ctx, irsense_eeprom_t *eeprom)
 Get threshold EEPROM value for all channels function.
 
void irsense_set_hysteresis_ir2_ir4 (irsense_t *ctx, uint8_t value)
 Set hysteresis setting of threshold level for channel 2 and channel 4 ( Ir2-Ir4 ) function.
 
void irsense_set_hysteresis_eeprom_ir2_ir4 (irsense_t *ctx, uint8_t value)
 Set hysteresis EEPROM setting of threshold level for channel 2 and channel 4 ( Ir2-Ir4 ) function.
 
void irsense_set_hysteresis_ir1_ir3 (irsense_t *ctx, uint8_t value)
 Set hysteresis setting of threshold level for channel 1 and channel 3 ( Ir1-Ir3 ) function.
 
void irsense_set_hysteresis_eeprom_ir1_ir3 (irsense_t *ctx, uint8_t value)
 Set hysteresis EEPROM setting of threshold level for channel 1 and channel 3 ( Ir1-Ir3 ) function.
 
void irsense_read_hysteresis (irsense_t *ctx, uint8_t *ehys24, uint8_t *ehys13)
 Get Hysteresis value for all channes function.
 
void irsense_read_hysteresis_eeprom (irsense_t *ctx, uint8_t *eehys24, uint8_t *eehys13)
 Get Hysteresis EEPROM value for all channes function.
 
void irsense_set_interrupts_reg (irsense_t *ctx, irsense_eint_t *eint)
 Sets interrupts activate or inactivate corresponding function.
 
void irsense_enable_data_ready_interrupt (irsense_t *ctx)
 Sets interrupts source settings function.
 
uint8_t irsense_check_int_states (irsense_t *ctx)
 Check state of INT pin function.
 

Detailed Description

This file contains API for IR SENSE Click driver.