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 IRGESTURE_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 IRGESTURE_RETVAL uint8_t
75 #define IRGESTURE_OK 0x00
76 #define IRGESTURE_INIT_ERROR 0xFF
83 #define IRGESTURE_I2C_ADDR 0x39
90 #define IRGESTURE_ENABLE 0x80
91 #define IRGESTURE_ATIME 0x81
92 #define IRGESTURE_WTIME 0x83
93 #define IRGESTURE_AILTL 0x84
94 #define IRGESTURE_AILTH 0x85
95 #define IRGESTURE_AIHTL 0x86
96 #define IRGESTURE_AIHTH 0x87
97 #define IRGESTURE_PILT 0x89
98 #define IRGESTURE_PIHT 0x8B
99 #define IRGESTURE_PERS 0x8C
100 #define IRGESTURE_CONFIG1 0x8D
101 #define IRGESTURE_PPULSE 0x8E
102 #define IRGESTURE_CONTROL 0x8F
103 #define IRGESTURE_CONFIG2 0x90
104 #define IRGESTURE_ID 0x92
105 #define IRGESTURE_STATUS 0x93
106 #define IRGESTURE_CDATAL 0x94
107 #define IRGESTURE_CDATAH 0x95
108 #define IRGESTURE_RDATAL 0x96
109 #define IRGESTURE_RDATAH 0x97
110 #define IRGESTURE_GDATAL 0x98
111 #define IRGESTURE_GDATAH 0x99
112 #define IRGESTURE_BDATAL 0x9A
113 #define IRGESTURE_BDATAH 0x9B
114 #define IRGESTURE_PDATA 0x9C
115 #define IRGESTURE_POFFSET_UR 0x9D
116 #define IRGESTURE_POFFSET_DL 0x9E
117 #define IRGESTURE_CONFIG3 0x9F
118 #define IRGESTURE_GPENTH 0xA0
119 #define IRGESTURE_GEXTH 0xA1
120 #define IRGESTURE_GCONF1 0xA2
121 #define IRGESTURE_GCONF2 0xA3
122 #define IRGESTURE_GOFFSET_U 0xA4
123 #define IRGESTURE_GOFFSET_D 0xA5
124 #define IRGESTURE_GOFFSET_L 0xA7
125 #define IRGESTURE_GOFFSET_R 0xA9
126 #define IRGESTURE_GPULSE 0xA6
127 #define IRGESTURE_GCONF3 0xAA
128 #define IRGESTURE_GCONF4 0xAB
129 #define IRGESTURE_GFLVL 0xAE
130 #define IRGESTURE_GSTATUS 0xAF
131 #define IRGESTURE_IFORCE 0xE4
132 #define IRGESTURE_PICLEAR 0xE5
133 #define IRGESTURE_CICLEAR 0xE6
134 #define IRGESTURE_AICLEAR 0xE7
135 #define IRGESTURE_GFIFO_U 0xFC
136 #define IRGESTURE_GFIFO_D 0xFD
137 #define IRGESTURE_GFIFO_L 0xFE
138 #define IRGESTURE_GFIFO_R 0xFF
145 #define DEFAULT_ATIME 219
146 #define DEFAULT_WTIME 246
147 #define DEFAULT_PROX_PPULSE 0x87
148 #define DEFAULT_GESTURE_PPULSE 0x89
149 #define DEFAULT_POFFSET_UR 0
150 #define DEFAULT_POFFSET_DL 0
151 #define DEFAULT_CONFIG1 0x60
152 #define DEFAULT_LDRIVE 0
153 #define DEFAULT_PGAIN 2
154 #define DEFAULT_AGAIN 1
155 #define DEFAULT_PILT 0
156 #define DEFAULT_PIHT 50
157 #define DEFAULT_AILT 0xFFFF
158 #define DEFAULT_AIHT 0
159 #define DEFAULT_PERS 0x11
160 #define DEFAULT_CONFIG2 0x01
161 #define DEFAULT_CONFIG3 0
162 #define DEFAULT_GPENTH 40
163 #define DEFAULT_GEXTH 30
164 #define DEFAULT_GCONF1 0x40
165 #define DEFAULT_GGAIN 2
166 #define DEFAULT_GLDRIVE 0
167 #define DEFAULT_GWTIME 1
168 #define DEFAULT_GOFFSET 0
169 #define DEFAULT_GPULSE 0xC9
170 #define DEFAULT_GCONF3 0
171 #define DEFAULT_GIEN 0
178 #define IRGESTURE_PON 0b00000001
179 #define IRGESTURE_AEN 0b00000010
180 #define IRGESTURE_PEN 0b00000100
181 #define IRGESTURE_WEN 0b00001000
182 #define IRGESTURE_AIEN 0b00010000
183 #define IRGESTURE_PIEN 0b00100000
184 #define IRGESTURE_GEN 0b01000000
185 #define IRGESTURE_GVALID 0b00000001
192 #define IRGESTURE_FAR 0x00
193 #define IRGESTURE_RIGHT 0x01
194 #define IRGESTURE_LEFT 0x02
195 #define IRGESTURE_UP 0x03
196 #define IRGESTURE_DOWN 0x04
197 #define IRGESTURE_NEAR 0x05
276 uint8_t u_data[ 32 ];
277 uint8_t d_data[ 32 ];
278 uint8_t l_data[ 32 ];
279 uint8_t r_data[ 32 ];
710 #endif // _IRGESTURE_H_
IRGESTURE_RETVAL irgesture_init(irgesture_t *ctx, irgesture_cfg_t *cfg)
Initialization function.
uint16_t lr_delta
Definition: irgesture.h:285
Click ctx object definition.
Definition: irgesture.h:210
gesture_dir_t
Direction definitions.
Definition: irgesture.h:259
Click configuration structure definition.
Definition: irgesture.h:229
uint16_t near_count
Definition: irgesture.h:288
@ DIR_NONE
Definition: irgesture.h:260
pin_name_t sda
Definition: irgesture.h:233
gesture_dir_t motion
Definition: irgesture.h:291
void irgesture_set_proxy_photo_mask(irgesture_t *ctx, uint8_t mask)
Get the current mask for enabled/disabled proximity photodiodes function.
uint16_t lr_count
Definition: irgesture.h:287
void irgesture_disable_power(irgesture_t *ctx)
Disable power sensor function.
uint16_t ud_count
Definition: irgesture.h:286
void irgesture_disable_proximity_sensor(irgesture_t *ctx)
Disable specific proximity sensors function.
uint8_t irgesture_get_proximity_gain(irgesture_t *ctx)
Get gain for proximity function.
void irgesture_disable_gesture_sensor(irgesture_t *ctx)
Disable the gesture recognition engine function.
@ DIR_LEFT
Definition: irgesture.h:261
@ DIR_NEAR
Definition: irgesture.h:265
uint16_t irgesture_read_red_light(irgesture_t *ctx)
Read RED light data function.
uint8_t irgesture_get_ambient_light_gain(irgesture_t *ctx)
Get gain for ambient light function.
@ DIR_DOWN
Definition: irgesture.h:264
uint16_t irgesture_read_blue_light(irgesture_t *ctx)
Read BLUE light data function.
void irgesture_set_proximity_gain(irgesture_t *ctx, uint8_t gain_val)
Set gain for proximity function.
void irgesture_default_cfg(irgesture_t *ctx)
Click Default Configuration function.
uint32_t i2c_speed
Definition: irgesture.h:241
void irgesture_set_led_boost(irgesture_t *ctx, uint8_t boost)
Sets the LED current boost value function.
@ ALL_STATE
Definition: irgesture.h:251
uint16_t far_count
Definition: irgesture.h:289
void irgesture_enable_power(irgesture_t *ctx)
Enable power sensor function.
@ FAR_STATE
Definition: irgesture.h:250
@ NEAR_STATE
Definition: irgesture.h:249
@ DIR_ALL
Definition: irgesture.h:267
uint16_t irgesture_read_ambient_light(irgesture_t *ctx)
Read ambient light data function.
Container for gesture data.
Definition: irgesture.h:275
pin_name_t scl
Definition: irgesture.h:232
digital_in_t int_pin
Definition: irgesture.h:213
void irgesture_set_gesture_mode(irgesture_t *ctx)
Sets the gesture mode function.
uint8_t irgesture_get_gesture_gain(irgesture_t *ctx)
Get gain for gesture function.
void irgesture_enable_gesture_sensor(irgesture_t *ctx)
Starts the gesture recognition engine function.
void irgesture_disable_light_sensor(irgesture_t *ctx)
Disable specific ambient light sensors function.
@ DIR_RIGHT
Definition: irgesture.h:262
uint8_t out_threshold
Definition: irgesture.h:283
gesture_prox_t state
Definition: irgesture.h:290
uint8_t in_threshold
Definition: irgesture.h:282
uint8_t irgesture_get_proxy_photo_mask(irgesture_t *ctx)
Get the current mask for enabled/disabled proximity photodiodes function.
uint8_t index
Definition: irgesture.h:280
i2c_master_t i2c
Definition: irgesture.h:217
pin_name_t int_pin
Definition: irgesture.h:237
void irgesture_write_data(irgesture_t *ctx, uint8_t reg_addr, uint8_t write_data)
Write function.
#define IRGESTURE_RETVAL
Definition: irgesture.h:73
uint8_t total_gestures
Definition: irgesture.h:281
void irgesture_enable_light_sensor(irgesture_t *ctx)
Enable specific ambient light sensors function.
uint8_t slave_address
Definition: irgesture.h:221
void irgesture_enable_proximity_sensor(irgesture_t *ctx)
Enable specific proximity sensors function.
@ DIR_FAR
Definition: irgesture.h:266
uint8_t irgesture_get_led_boost(irgesture_t *ctx)
Gets the LED current boost value function.
uint8_t irgesture_read_proximity_data(irgesture_t *ctx)
Read proximity data function.
uint8_t irgesture_get_interrupt(irgesture_t *ctx)
Get state of interrupt pin function.
uint16_t irgesture_read_green_light(irgesture_t *ctx)
Read GREEN light data function.
@ DIR_UP
Definition: irgesture.h:263
void irgesture_set_gesture_gain(irgesture_t *ctx, uint8_t gain_val)
Set gain for gesture function.
gesture_prox_t
Definition: irgesture.h:247
@ NA_STATE
Definition: irgesture.h:248
void irgesture_cfg_setup(irgesture_cfg_t *cfg)
Config Object Initialization function.
uint16_t ud_delta
Definition: irgesture.h:284
uint8_t irgesture_detect_gesture(irgesture_t *ctx)
Function decode a gesture event function.
gesture_dir_t irgesture_gesture_read_gesture(irgesture_t *ctx)
Processes a gesture event function.
void irgesture_set_ambient_light_gain(irgesture_t *ctx, uint8_t gain_val)
Set gain for ambient light function.
uint8_t irgesture_available(irgesture_t *ctx)
Determines if there is a gesture available function.
uint8_t irgesture_read_data(irgesture_t *ctx, uint8_t reg_addr)
Read function.
uint8_t i2c_address
Definition: irgesture.h:242