Go to the documentation of this file.
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
52 #define PRESENCE_MAP_MIKROBUS( cfg, mikrobus ) \
53 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
54 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
55 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
63 #define PRESENCE_ERROR -1
70 #define PRESENCE_REG_TP_OBJECT_MSB 0x01
71 #define PRESENCE_REG_TP_OBJECT_MID 0x02
72 #define PRESENCE_REG_TP_OBJECT_LSB 0x03
73 #define PRESENCE_REG_TP_AMBIENT_MSB 0x03
74 #define PRESENCE_REG_TP_AMBIENT_LSB 0x04
75 #define PRESENCE_REG_TP_OBJECT_LP1_MSB 0x05
76 #define PRESENCE_REG_TP_OBJECT_LP1_MID 0x06
77 #define PRESENCE_REG_TP_OBJECT_LP1_LSB 0x07
78 #define PRESENCE_REG_TP_OBJECT_LP2_MSB 0x07
79 #define PRESENCE_REG_TP_OBJECT_LP2_MID 0x08
80 #define PRESENCE_REG_TP_OBJECT_LP2_LSB 0x09
81 #define PRESENCE_REG_TP_AMBIENT_LP3_MSB 0x0A
82 #define PRESENCE_REG_TP_AMBIENT_LP3_LSB 0x0B
83 #define PRESENCE_REG_TP_OBJECT_LP2F_MSB 0x0C
84 #define PRESENCE_REG_TP_OBJECT_LP2F_MID 0x0D
85 #define PRESENCE_REG_TP_OBJECT_LP2F_LSB 0x0E
86 #define PRESENCE_REG_TP_PRESENCE 0x0F
87 #define PRESENCE_REG_TP_MOTION 0x10
88 #define PRESENCE_REG_TP_AMBIENT_SHOCK 0x11
89 #define PRESENCE_REG_INTERRUPT_STATUS 0x12
90 #define PRESENCE_REG_CHIP_STATUS 0x13
91 #define PRESENCE_REG_LOW_PASS_TIME_1 0x14
92 #define PRESENCE_REG_LOW_PASS_TIME_2 0x15
93 #define PRESENCE_REG_TP_PRESENCE_THR 0x16
94 #define PRESENCE_REG_TP_MOTION_THR 0x17
95 #define PRESENCE_REG_TP_AMB_SHOCK_THR 0x18
96 #define PRESENCE_REG_INTERRUPT_MASK_1 0x19
97 #define PRESENCE_REG_INTERRUPT_MASK_2 0x1A
98 #define PRESENCE_REG_TIMER_INTERRUPT 0x1B
99 #define PRESENCE_REG_TP_OT_THR_1 0x1C
100 #define PRESENCE_REG_TP_OT_THR_2 0x1D
101 #define PRESENCE_REG_EEPROM_CTRL 0x1F
108 #define PRESENCE_EEPROM_PROTOCOL 0x20
109 #define PRESENCE_EEPROM_CHECKSUM_1 0x21
110 #define PRESENCE_EEPROM_CHECKSUM_2 0x22
111 #define PRESENCE_EEPROM_LOOKUP 0x29
112 #define PRESENCE_EEPROM_PTAT25_1 0x2A
113 #define PRESENCE_EEPROM_PTAT25_2 0x2B
114 #define PRESENCE_EEPROM_M_1 0x2C
115 #define PRESENCE_EEPROM_M_2 0x2D
116 #define PRESENCE_EEPROM_U0_1 0x2E
117 #define PRESENCE_EEPROM_U0_2 0x2F
118 #define PRESENCE_EEPROM_UOUT_1 0x30
119 #define PRESENCE_EEPROM_UOUT_2 0x31
120 #define PRESENCE_EEPROM_TOBJ 0x32
121 #define PRESENCE_EEPROM_SLAVE_ADDR 0x3F
128 #define PRESENCE_DEVICE_SLAVE_ADDRESS 0x0C
129 #define PRESENCE_DEVICE_GEN_CALL_ADDRESS 0x00
136 #define PRESENCE_LOW_PASS_TIME_512S 0x00
137 #define PRESENCE_LOW_PASS_TIME_256S 0x01
138 #define PRESENCE_LOW_PASS_TIME_128S 0x02
139 #define PRESENCE_LOW_PASS_TIME_64S 0x03
140 #define PRESENCE_LOW_PASS_TIME_32S 0x04
141 #define PRESENCE_LOW_PASS_TIME_16S 0x05
142 #define PRESENCE_LOW_PASS_TIME_8S 0x08
143 #define PRESENCE_LOW_PASS_TIME_4S 0x09
144 #define PRESENCE_LOW_PASS_TIME_2S 0x0A
145 #define PRESENCE_LOW_PASS_TIME_1S 0x0B
146 #define PRESENCE_LOW_PASS_TIME_0P50S 0x0C
147 #define PRESENCE_LOW_PASS_TIME_0P25S 0x0D
154 #define PRESENCE_INT_MASK1_TP_OT 0x10
155 #define PRESENCE_INT_MASK1_PRESENCE 0x08
156 #define PRESENCE_INT_MASK1_MOTION 0x04
157 #define PRESENCE_INT_MASK1_AMB_SHOCK 0x02
158 #define PRESENCE_INT_MASK1_TIMER 0x01
165 #define PRESENCE_INT_MASK2_TPOT_DIR 0x10
166 #define PRESENCE_INT_MASK2_SRC_TPOBJ_LP2 ( 0x00 << 2 )
167 #define PRESENCE_INT_MASK2_SRC_LP1_LP2 ( 0x01 << 2 )
168 #define PRESENCE_INT_MASK2_SRC_TPOBJ_LP2FROZEN ( 0x02 << 2 )
169 #define PRESENCE_INT_MASK2_SRC_LP1_LP2FROZEN ( 0x03 << 2 )
170 #define PRESENCE_INT_MASK2_CYCLE_TIME_30MS 0x00
171 #define PRESENCE_INT_MASK2_CYCLE_TIME_60MS 0x01
172 #define PRESENCE_INT_MASK2_CYCLE_TIME_120MS 0x02
173 #define PRESENCE_INT_MASK2_CYCLE_TIME_140MS 0x04
380 #endif // _PRESENCE_H_
eeprom_data_t eeprom_data
Definition: presence.h:208
pin_name_t sda
Definition: presence.h:219
i2c_master_t i2c
Definition: presence.h:203
uint8_t i2c_address
Definition: presence.h:226
uint16_t m_data
Definition: presence.h:186
uint8_t presence_get_int_state(presence_t *ctx)
Get interrupt state function.
err_t presence_ambient_temperature(presence_t *ctx, float *temperature)
Ambient Temperature.
void presence_general_call_addr(presence_t *ctx)
General call address.
digital_in_t int_pin
Definition: presence.h:200
uint8_t tobj_data
Definition: presence.h:188
Definition: presence.h:184
void presence_cfg_setup(presence_cfg_t *cfg)
Config Object Initialization function.
uint32_t uout_data
Definition: presence.h:189
err_t presence_init(presence_t *ctx, presence_cfg_t *cfg)
Initialization function.
pin_name_t int_pin
Definition: presence.h:222
Click ctx object definition.
Definition: presence.h:198
err_t presence_object_temperature(presence_t *ctx, float *temperature)
Object Temperature.
float presence_get_calib_constants(presence_t *ctx)
Calibration constant K.
err_t presence_default_cfg(presence_t *ctx)
Presence default configuration function.
uint16_t u0_data
Definition: presence.h:187
err_t presence_generic_write(presence_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
err_t presence_generic_read(presence_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint16_t checksum_data
Definition: presence.h:190
uint16_t ptat25_data
Definition: presence.h:185
uint32_t i2c_speed
Definition: presence.h:225
pin_name_t scl
Definition: presence.h:218
err_t presence_eeprom_process(presence_t *ctx)
EEPRM PROCESS.
Click configuration structure definition.
Definition: presence.h:216
uint8_t slave_address
Definition: presence.h:206