Utilities for Pixart gesture recognition sensor PAJ7620U2 with interrupt

Dependents:   MtConnect04S_Gesture_HID

Committer:
mtmkimi
Date:
Fri Dec 30 07:26:01 2016 +0000
Revision:
0:5ab081158441
Pack PAJ7620U2 to library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mtmkimi 0:5ab081158441 1 /* Copyright (c) 2016 MtM Technology Corporation, MIT License
mtmkimi 0:5ab081158441 2 *
mtmkimi 0:5ab081158441 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
mtmkimi 0:5ab081158441 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
mtmkimi 0:5ab081158441 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
mtmkimi 0:5ab081158441 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
mtmkimi 0:5ab081158441 7 * furnished to do so, subject to the following conditions:
mtmkimi 0:5ab081158441 8 *
mtmkimi 0:5ab081158441 9 * The above copyright notice and this permission notice shall be included in all copies or
mtmkimi 0:5ab081158441 10 * substantial portions of the Software.
mtmkimi 0:5ab081158441 11 *
mtmkimi 0:5ab081158441 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
mtmkimi 0:5ab081158441 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
mtmkimi 0:5ab081158441 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
mtmkimi 0:5ab081158441 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
mtmkimi 0:5ab081158441 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
mtmkimi 0:5ab081158441 17 */
mtmkimi 0:5ab081158441 18 #ifndef PAJ7620U2_h
mtmkimi 0:5ab081158441 19 #define PAJ7620U2_h
mtmkimi 0:5ab081158441 20
mtmkimi 0:5ab081158441 21 #include "mbed.h"
mtmkimi 0:5ab081158441 22
mtmkimi 0:5ab081158441 23
mtmkimi 0:5ab081158441 24 #define PAJ7620U2_SLAVE_ADDR 0xE6
mtmkimi 0:5ab081158441 25
mtmkimi 0:5ab081158441 26
mtmkimi 0:5ab081158441 27 class PAJ7620U2 {
mtmkimi 0:5ab081158441 28 public:
mtmkimi 0:5ab081158441 29 PAJ7620U2(PinName sda, PinName scl, PinName int1 = NC);
mtmkimi 0:5ab081158441 30 uint16_t ReadIntFlag(void);
mtmkimi 0:5ab081158441 31 void IntEvent(void(*fptr)(void));
mtmkimi 0:5ab081158441 32
mtmkimi 0:5ab081158441 33 uint16_t PID;
mtmkimi 0:5ab081158441 34 uint8_t VID;
mtmkimi 0:5ab081158441 35
mtmkimi 0:5ab081158441 36 private:
mtmkimi 0:5ab081158441 37 I2C _i2c;
mtmkimi 0:5ab081158441 38 InterruptIn _int1;
mtmkimi 0:5ab081158441 39
mtmkimi 0:5ab081158441 40 void RegWrite(char reg, char val);
mtmkimi 0:5ab081158441 41 void RegRead (char reg, char *val, int len);
mtmkimi 0:5ab081158441 42 void RegReadModifyWrite(char reg, char clr_mask, char set_mask);
mtmkimi 0:5ab081158441 43 };
mtmkimi 0:5ab081158441 44
mtmkimi 0:5ab081158441 45 #endif