Go to the documentation of this file.
38 #include "mikrosdk_version.h"
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 #include "drv_i2c_master.h"
63 #define IRSENSE2_MAP_MIKROBUS( cfg, mikrobus ) \
64 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
65 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
66 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
73 #define IRSENSE2_RETVAL uint8_t
75 #define IRSENSE2_OK 0x00
76 #define IRSENSE2_INIT_ERROR 0xFF
84 #define COMPANY_CODE_WIA1 0x00
85 #define DEVICE_ID_WIA2 0x01
88 #define STATUS_1_ST1 0x04
89 #define STATUS_2_ST2 0x0A
91 #define IR_SENSOR_LSB 0x06
92 #define IR_SENSOR_MSB 0x07
93 #define TMP_SENSOR_LSB 0x08
94 #define TMP_SENSOR_MSB 0x09
95 #define THIRH_IR_THRESHOLD_LVL_LSB 0x0B
96 #define THIRH_IR_THRESHOLD_LVL_MSB 0x0C
97 #define THIRL_IR_THRESHOLD_LVL_LSB 0x0D
98 #define THIRL_IR_THRESHOLD_LVL_MSB 0x0E
99 #define THTMPH_TEMP_SENS_THRESHOLD_LV_LSB 0x0F
100 #define THTMPH_TEMP_SENS_THRESHOLD_LV_MSB 0x10
101 #define THTMPL_TEMP_SENS_THRESHOLD_LV_LSB 0x11
102 #define THTMPL_TEMP_SENS_THRESHOLD_LV_MSB 0x12
103 #define INTEN_INTERRUPT_FACTOR_SETTING 0x13
104 #define CNTL1_CUT_OFF_FREQ_SETTING 0x14
105 #define CNTL2_OPERATING_MODE_SETTING 0x15
106 #define CNTL3_SOFT_RESET 0x16
114 #define INTCAUSE_RST 0xE0
118 #define THIRH_THIRL_THTMPH_THTMPL_RST 0x00
119 #define INTEN_RST 0xE0
120 #define CNTL1_RST 0xE0
121 #define CNTL2_RST 0xFC
122 #define CNTL3_RST 0xFE
129 #define INTEN_MODE_MASK_DATARDY_INT_VALID 0xE1
130 #define CNTL1_IR__MODE_MASK_NO_FILTER 0xE0
131 #define CNTL1_IR__MODE_MASK_FC_2_5HZ 0xE8
132 #define CNTL1_IR_MODE_MASK_FC_0_9HZ 0xF0
133 #define CNTL1_IR_MODE_MASK_FC_0_45HZ 0xF8
134 #define CNTL1_TMP_MODE_MASK_NO_FILTER 0xE0
135 #define CNTL1_TMP_MODE_MASK_FC_2_5HZ 0xE1
136 #define CNTL1_TMP_MODE_MASK_FC_0_9HZ 0xE2
137 #define CNTL1_TMP_MODE_MASK_FC_0_45HZ 0xE3
138 #define CNTL1_TMP_MODE_MASK_FC_0_22HZ 0xE4
139 #define CNTL2_STANDBY_MODE 0xFC
140 #define CNTL2_CONTINUOUS_MODE 0xFD
141 #define CNTL2_SINGLE_SHOT_MODE 0xFE
142 #define CNTL3_RESET_MODE 0xFF
335 #endif // _IRSENSE2_H_
int16_t irsense2_get_ir_data(irsense2_t *ctx)
IR Data read function.
Click configuration structure definition.
Definition: irsense2.h:179
digital_in_t int_pin
Definition: irsense2.h:159
i2c_master_t i2c
Definition: irsense2.h:163
float prev_ir_data
Definition: irsense2.h:170
int8_t prev_ir_data_cfg
Definition: irsense2.h:194
uint8_t data_flag
Definition: irsense2.h:169
#define IRSENSE2_RETVAL
Definition: irsense2.h:73
uint8_t i2c_address
Definition: irsense2.h:192
int16_t irsense2_get_temperature_data(irsense2_t *ctx)
Temperatire Data read function.
IRSENSE2_RETVAL irsense2_init(irsense2_t *ctx, irsense2_cfg_t *cfg)
Initialization function.
float prev_ir_data2
Definition: irsense2.h:171
void irsense2_data_read(irsense2_t *ctx, float *ir_data, float *temp_data)
Data function.
Click ctx object definition.
Definition: irsense2.h:156
void irsense2_generic_write(irsense2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void irsense2_generic_read(irsense2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
int8_t prev_ir_data_cfg2
Definition: irsense2.h:195
uint8_t data_flag_cfg
Definition: irsense2.h:193
uint32_t i2c_speed
Definition: irsense2.h:191
pin_name_t int_pin
Definition: irsense2.h:187
pin_name_t scl
Definition: irsense2.h:182
void irsense2_get_int_pin(irsense2_t *ctx)
Int_pin state function.
uint8_t slave_address
Definition: irsense2.h:167
void irsense2_get_int(irsense2_t *ctx)
Interrupt factor function.
pin_name_t sda
Definition: irsense2.h:183
uint8_t irsense_human_detected(irsense2_t *ctx, float ir_data)
Human detection function.
void irsense2_cfg_setup(irsense2_cfg_t *cfg)
Config Object Initialization function.
void irsense2_default_cfg(irsense2_t *ctx)
Click Default Configuration function.