PixArt / Pixart_Gesture

Fork of Pixart_Gesture by PixArt Imaging

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Gesture.h Source File

Gesture.h

00001 /*
00002  *  Pixart support 9 gesture type
00003  *
00004  */
00005 enum PIXART_GESTURE_TYPE{UP,DOWN,LEFT,RIGHT,PUSH,POLL,CLOCKWISE,COUNTER_CLOCKWISE,WAVE};
00006 
00007 /* The callback function when Gesture happen
00008    Type ==> The Gesture type recognize by Pixart's Gesture class
00009  */
00010 typedef  void (*GestureCallback)(PIXART_GESTURE_TYPE Type);
00011 
00012 class Pixart_Gesture
00013 {
00014     private:
00015        Ticker  m_ticker;
00016        I2C     *m_i2c;
00017        //Serial  *m_pc;
00018        int m_Period;
00019        uint8_t Flag_7630 ;
00020        
00021        GestureCallback m_GestureCallback;       
00022        void periodicCallback(void);       
00023        bool PAC7620_30_init();
00024        
00025        void writeRegister(uint8_t addr, uint8_t data);
00026        uint8_t readRegister(uint8_t addr);       
00027        
00028        
00029     public:           
00030        /* 
00031         * The initial function for Gesture class 
00032         * i2c ==> The I2C object from outside, the clock rate should be 400k
00033         * Period ==> The polling rate for gesture, in ms
00034         * callback ==> The call back function for gesture status
00035         * Result ==> The result for initialize
00036         */
00037        Pixart_Gesture(I2C *i2c, int Period,GestureCallback callback,bool &Result);                                             
00038 };