si114x_algorithm.h

Go to the documentation of this file.
00001 /**************************************************************************/
00017 #ifndef __SI114X_ALGORITHM_H
00018 #define __SI114X_ALGORITHM_H
00019 
00020 #include "em_device.h"
00021 #include "si114x_functions.h"
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 /***************************************************************************/
00032 /***************************************************************************/
00037 /*******************************************************************************
00038  *******************************   DEFINES   ***********************************
00039  ******************************************************************************/
00041 #define SI1147_ADDR    0xc0
00042 
00043 /*******************************************************************************
00044  *******************************   STRUCTS   ***********************************
00045  ******************************************************************************/
00046 
00050 typedef struct
00051 {
00052   u32 timestamp;         /* Timestamp to record */
00053   u16 vis;               /* VIS */
00054   u16 ir;                /* IR */
00055   u16 ps1;               /* PS1 */
00056   u16 ps2;               /* PS2 */
00057   u16 ps3;               /* PS3 */
00058   u16 aux;               /* AUX */
00059 } Si114x_Sample_TypeDef;
00060 
00063 /*******************************************************************************
00064  ********************************   ENUMS   ************************************
00065  ******************************************************************************/
00067 typedef enum
00068 {
00069   NONE,
00070   UP,
00071   DOWN,
00072   LEFT,
00073   RIGHT,
00074   TAP
00075 } gesture_t;
00076 
00077 /*******************************************************************************
00078  *****************************   PROTOTYPES   **********************************
00079  ******************************************************************************/
00080 gesture_t Si1147_NewSample(I2C_TypeDef *i2c, uint8_t addr, uint32_t timestamp);
00081 int Si1147_ConfigureDetection(I2C_TypeDef *i2c, uint8_t addr, int slow);
00082 int Si1147_SetInterruptOutputEnable(I2C_TypeDef *i2c, uint8_t addr, int enable);
00083 int Si1147_GetInterruptOutputEnable(I2C_TypeDef *i2c, uint8_t addr, int *enable);
00084 int Si1147_Detect_Device(I2C_TypeDef *i2c, uint8_t addr);
00085 int Si1147_MeasureUVAndObjectPresent(I2C_TypeDef *i2c, uint8_t addr, uint16_t *uvIndex, int* objectDetect);
00086 
00090 #ifdef __cplusplus
00091 }
00092 #endif
00093 
00094 #endif /* #define SI114X_ALGORITHM_H */