adding in code
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
PAJ7620U2:PAJ7620U2.c PAJ7620U2.h
|
||||
gcc -Wall PAJ7620U2.c -o PAJ7620U2 -lbcm2835 -lm
|
||||
clean:
|
||||
rm PAJ7620U2
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
#include <bcm2835.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "PAJ7620U2.h"
|
||||
/******************* PAJ7620U2 Driver Interface *****************************/
|
||||
char I2C_readByte(char reg)
|
||||
{
|
||||
char buf[] = { reg };
|
||||
bcm2835_i2c_read_register_rs(buf, buf, 1);
|
||||
return buf[0];
|
||||
}
|
||||
unsigned short I2C_readU16(char reg)
|
||||
{
|
||||
char buf[] = { reg,0 };
|
||||
bcm2835_i2c_read_register_rs(buf, buf, 2);
|
||||
int value = buf[1] * 0x100 + buf[0];
|
||||
return value;
|
||||
}
|
||||
void I2C_writeByte(char reg, char val)
|
||||
{
|
||||
char buf[] = { reg,val };
|
||||
bcm2835_i2c_write(buf, 2);
|
||||
}
|
||||
uint8_t PAJ7620U2_init()
|
||||
{
|
||||
uint8_t i,State;
|
||||
bcm2835_i2c_begin();
|
||||
bcm2835_i2c_setSlaveAddress(PAJ7620U2_I2C_ADDRESS);
|
||||
bcm2835_i2c_set_baudrate(10000);
|
||||
bcm2835_delay(5);
|
||||
State = I2C_readByte(0x00); //Read State
|
||||
if (State != 0x20) return 0; //Wake up failed
|
||||
I2C_writeByte(PAJ_BANK_SELECT, 0); //Select Bank 0
|
||||
for (i=0;i< Init_Array;i++)
|
||||
{
|
||||
I2C_writeByte(Init_Register_Array[i][0], Init_Register_Array[i][1]);//Power up initialize
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
uint8_t i;
|
||||
unsigned short Gesture_Data;
|
||||
printf("\nGesture Sensor Test Program ...\n");
|
||||
if (!bcm2835_init()) return 1;
|
||||
bcm2835_delay(5);
|
||||
if(!PAJ7620U2_init())
|
||||
{ printf("\nGesture Sensor Error\n");
|
||||
return 0;
|
||||
}
|
||||
printf("\nGesture Sensor OK\n");
|
||||
I2C_writeByte(PAJ_BANK_SELECT, 0);//Select Bank 0
|
||||
for (i = 0; i < Gesture_Array_SIZE; i++)
|
||||
{
|
||||
I2C_writeByte(Init_Gesture_Array[i][0], Init_Gesture_Array[i][1]);//Gesture register initializes
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
Gesture_Data = I2C_readU16(PAJ_INT_FLAG1);
|
||||
if (Gesture_Data)
|
||||
{
|
||||
switch (Gesture_Data)
|
||||
{
|
||||
case PAJ_UP: printf("Up\r\n"); break;
|
||||
case PAJ_DOWN: printf("Down\r\n"); break;
|
||||
case PAJ_LEFT: printf("Left\r\n"); break;
|
||||
case PAJ_RIGHT: printf("Right\r\n"); break;
|
||||
case PAJ_FORWARD: printf("Forward\r\n"); break;
|
||||
case PAJ_BACKWARD: printf("Backward\r\n"); break;
|
||||
case PAJ_CLOCKWISE: printf("Clockwise\r\n"); break;
|
||||
case PAJ_COUNT_CLOCKWISE: printf("AntiClockwise\r\n"); break;
|
||||
case PAJ_WAVE: printf("Wave\r\n"); break;
|
||||
default: break;
|
||||
}
|
||||
Gesture_Data=0;
|
||||
bcm2835_delay(50);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
#ifndef _PAJ7620U2_
|
||||
#define _PAJ7620U2_
|
||||
|
||||
//i2c address
|
||||
#define PAJ7620U2_I2C_ADDRESS 0x73
|
||||
//Register Bank select
|
||||
#define PAJ_BANK_SELECT 0xEF /*Bank0=0x00,Bank1=0x01*/
|
||||
//Register Bank 0
|
||||
#define PAJ_SUSPEND 0x03 /*I2C suspend command (Write 0x01 to enter suspend state). I2C wake-up command is slave ID wake-up. Refer to topic ¡°I2C Bus Timing Characteristics and Protocol¡±*/
|
||||
#define PAJ_INT_FLAG1_MASK 0x41 /*Gesture detection interrupt flag mask*/
|
||||
#define PAJ_INT_FLAG2_MASK 0x42 /*Gesture/PS detection interrupt flag mask*/
|
||||
#define PAJ_INT_FLAG1 0x43 /*Gesture detection interrupt flag*/
|
||||
#define PAJ_INT_FLAG2 0x44 /*Gesture/PS detection interrupt flag*/
|
||||
#define PAJ_STATE 0x45 /*State indicator for gesture detection (Only functional at gesture detection mode)*/
|
||||
#define PAJ_PS_HIGH_THRESHOLD 0x69 /*PS hysteresis high threshold (Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_LOW_THRESHOLD 0x6A /*PS hysteresis low threshold (Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_APPROACH_STATE 0x6B /*PS approach state, Approach = 1 , (8 bits PS data >= PS high threshold), Not Approach = 0 , (8 bits PS data <= PS low threshold)(Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_DATA 0x6C /*PS 8 bit data(Only functional at gesture detection mode)*/
|
||||
#define PAJ_OBJ_BRIGHTNESS 0xB0 /*Object Brightness (Max. 255)*/
|
||||
#define PAJ_OBJ_SIZE_L 0xB1 /*Object Size(Low 8 bit)*/
|
||||
#define PAJ_OBJ_SIZE_H 0xB2 /*Object Size(High 8 bit)*/
|
||||
|
||||
//Register Bank 1
|
||||
#define PAJ_PS_GAIN 0x44 /*PS gain setting (Only functional at proximity detection mode)*/
|
||||
#define PAJ_IDLE_S1_STEP_L 0x67 /*IDLE S1 Step, for setting the S1, Response Factor(Low 8 bit)*/
|
||||
#define PAJ_IDLE_S1_STEP_H 0x68 /*IDLE S1 Step, for setting the S1, Response Factor(High 8 bit)*/
|
||||
#define PAJ_IDLE_S2_STEP_L 0x69 /*IDLE S2 Step, for setting the S2, Response Factor(Low 8 bit)*/
|
||||
#define PAJ_IDLE_S2_STEP_H 0x6A /*IDLE S2 Step, for setting the S2, Response Factor(High 8 bit)*/
|
||||
#define PAJ_OPTOS1_TIME_L 0x6B /*OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 state(Low 8 bit)*/
|
||||
#define PAJ_OPTOS2_TIME_H 0x6C /*OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 stateHigh 8 bit)*/
|
||||
#define PAJ_S1TOS2_TIME_L 0x6D /*S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 state(Low 8 bit)*/
|
||||
#define PAJ_S1TOS2_TIME_H 0x6E /*S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 stateHigh 8 bit)*/
|
||||
#define PAJ_EN 0x72 /*Enable/Disable PAJ7620U2*/
|
||||
//Gesture detection interrupt flag
|
||||
#define PAJ_UP 0x01
|
||||
#define PAJ_DOWN 0x02
|
||||
#define PAJ_LEFT 0x04
|
||||
#define PAJ_RIGHT 0x08
|
||||
#define PAJ_FORWARD 0x10
|
||||
#define PAJ_BACKWARD 0x20
|
||||
#define PAJ_CLOCKWISE 0x40
|
||||
#define PAJ_COUNT_CLOCKWISE 0x80
|
||||
#define PAJ_WAVE 0x100
|
||||
//Initialize array size
|
||||
#define Init_Array sizeof(Init_Register_Array)/2
|
||||
#define PS_Array_SIZE sizeof(Init_PS_Array)/2
|
||||
#define Gesture_Array_SIZE sizeof(Init_Gesture_Array)/2
|
||||
//Power up initialize array
|
||||
unsigned char Init_Register_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x37,0x07},
|
||||
{0x38,0x17},
|
||||
{0x39,0x06},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0x46,0x2D},
|
||||
{0x47,0x0F},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x4A,0x1E},
|
||||
{0x4C,0x20},
|
||||
{0x51,0x10},
|
||||
{0x5E,0x10},
|
||||
{0x60,0x27},
|
||||
{0x80,0x42},
|
||||
{0x81,0x44},
|
||||
{0x82,0x04},
|
||||
{0x8B,0x01},
|
||||
{0x90,0x06},
|
||||
{0x95,0x0A},
|
||||
{0x96,0x0C},
|
||||
{0x97,0x05},
|
||||
{0x9A,0x14},
|
||||
{0x9C,0x3F},
|
||||
{0xA5,0x19},
|
||||
{0xCC,0x19},
|
||||
{0xCD,0x0B},
|
||||
{0xCE,0x13},
|
||||
{0xCF,0x64},
|
||||
{0xD0,0x21},
|
||||
{0xEF,0x01},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x25,0x01},
|
||||
{0x27,0x39},
|
||||
{0x28,0x7F},
|
||||
{0x29,0x08},
|
||||
{0x3E,0xFF},
|
||||
{0x5E,0x3D},
|
||||
{0x65,0x96},
|
||||
{0x67,0x97},
|
||||
{0x69,0xCD},
|
||||
{0x6A,0x01},
|
||||
{0x6D,0x2C},
|
||||
{0x6E,0x01},
|
||||
{0x72,0x01},
|
||||
{0x73,0x35},
|
||||
{0x74,0x00},
|
||||
{0x77,0x01},
|
||||
};
|
||||
//Approaches register initialization array
|
||||
unsigned char Init_PS_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x51,0x13},
|
||||
{0x83,0x20},
|
||||
{0x84,0x20},
|
||||
{0x85,0x00},
|
||||
{0x86,0x10},
|
||||
{0x87,0x00},
|
||||
{0x88,0x05},
|
||||
{0x89,0x18},
|
||||
{0x8A,0x10},
|
||||
{0x9f,0xf8},
|
||||
{0x69,0x96},
|
||||
{0x6A,0x02},
|
||||
{0xEF,0x01},
|
||||
{0x01,0x1E},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x41,0x50},
|
||||
{0x43,0x34},
|
||||
{0x65,0xCE},
|
||||
{0x66,0x0B},
|
||||
{0x67,0xCE},
|
||||
{0x68,0x0B},
|
||||
{0x69,0xE9},
|
||||
{0x6A,0x05},
|
||||
{0x6B,0x50},
|
||||
{0x6C,0xC3},
|
||||
{0x6D,0x50},
|
||||
{0x6E,0xC3},
|
||||
{0x74,0x05},
|
||||
};
|
||||
|
||||
//Gesture register initializes array
|
||||
const unsigned char Init_Gesture_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0xEF,0x00},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x51,0x10},
|
||||
{0x83,0x20},
|
||||
{0x9F,0xF9},
|
||||
{0xEF,0x01},
|
||||
{0x01,0x1E},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x41,0x40},
|
||||
{0x43,0x30},
|
||||
{0x65,0x96},
|
||||
{0x66,0x00},
|
||||
{0x67,0x97},
|
||||
{0x68,0x01},
|
||||
{0x69,0xCD},
|
||||
{0x6A,0x01},
|
||||
{0x6B,0xB0},
|
||||
{0x6C,0x04},
|
||||
{0x6D,0x2C},
|
||||
{0x6E,0x01},
|
||||
{0x74,0x00},
|
||||
{0xEF,0x00},
|
||||
{0x41,0xFF},
|
||||
{0x42,0x01},
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
PAJ7620U2:PAJ7620U2.c PAJ7620U2.h
|
||||
gcc -Wall PAJ7620U2.c -o PAJ7620U2 -lbcm2835 -lm
|
||||
clean:
|
||||
rm PAJ7620U2
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#include <bcm2835.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "PAJ7620U2.h"
|
||||
/******************* PAJ7620U2 Driver Interface *****************************/
|
||||
char I2C_readByte(char reg)
|
||||
{
|
||||
char buf[] = { reg };
|
||||
bcm2835_i2c_read_register_rs(buf, buf, 1);
|
||||
return buf[0];
|
||||
}
|
||||
unsigned short I2C_readU16(char reg)
|
||||
{
|
||||
char buf[] = { reg,0 };
|
||||
bcm2835_i2c_read_register_rs(buf, buf, 2);
|
||||
int value = buf[1] * 0x100 + buf[0];
|
||||
return value;
|
||||
}
|
||||
void I2C_writeByte(char reg, char val)
|
||||
{
|
||||
char buf[] = { reg,val };
|
||||
bcm2835_i2c_write(buf, 2);
|
||||
}
|
||||
uint8_t PAJ7620U2_init()
|
||||
{
|
||||
uint8_t i,State;
|
||||
bcm2835_i2c_begin();
|
||||
bcm2835_i2c_setSlaveAddress(PAJ7620U2_I2C_ADDRESS);
|
||||
bcm2835_i2c_set_baudrate(10000);
|
||||
bcm2835_delay(5);
|
||||
State = I2C_readByte(0x00); //Read State
|
||||
if (State != 0x20) return 0; //Wake up failed
|
||||
I2C_writeByte(PAJ_BANK_SELECT, 0); //Select Bank 0
|
||||
for (i=0;i< Init_Array;i++)
|
||||
{
|
||||
I2C_writeByte(Init_Register_Array[i][0], Init_Register_Array[i][1]);//Power up initialize
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
uint8_t i, OBJ_BRIGHTNESS;
|
||||
unsigned short OBJ_SIZE;
|
||||
printf("\nGesture Sensor Test Program ...\n");
|
||||
if (!bcm2835_init()) return 1;
|
||||
bcm2835_delay(5);
|
||||
if(!PAJ7620U2_init())
|
||||
{ printf("\nGesture Sensor Error\n");
|
||||
return 0;
|
||||
}
|
||||
printf("\nGesture Sensor OK\n");
|
||||
I2C_writeByte(PAJ_BANK_SELECT, 0);//Select Bank 0
|
||||
for (i = 0; i < PS_Array_SIZE; i++)
|
||||
{
|
||||
I2C_writeByte(Init_PS_Array[i][0], Init_PS_Array[i][1]);//Gesture register initializes
|
||||
}
|
||||
I2C_writeByte(PAJ_BANK_SELECT, 0);
|
||||
while (1)
|
||||
{
|
||||
OBJ_BRIGHTNESS = I2C_readByte(PAJ_OBJ_BRIGHTNESS);
|
||||
OBJ_SIZE = I2C_readU16(PAJ_OBJ_SIZE_L);
|
||||
printf("Object brightness = %d ,Object size = %d\n", OBJ_BRIGHTNESS, OBJ_SIZE);//Object Brightness (Max. 255),Object Size (Max. 900)
|
||||
delay(50);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
#ifndef _PAJ7620U2_
|
||||
#define _PAJ7620U2_
|
||||
|
||||
//i2c address
|
||||
#define PAJ7620U2_I2C_ADDRESS 0x73
|
||||
//Register Bank select
|
||||
#define PAJ_BANK_SELECT 0xEF /*Bank0=0x00,Bank1=0x01*/
|
||||
//Register Bank 0
|
||||
#define PAJ_SUSPEND 0x03 /*I2C suspend command (Write 0x01 to enter suspend state). I2C wake-up command is slave ID wake-up. Refer to topic ¡°I2C Bus Timing Characteristics and Protocol¡±*/
|
||||
#define PAJ_INT_FLAG1_MASK 0x41 /*Gesture detection interrupt flag mask*/
|
||||
#define PAJ_INT_FLAG2_MASK 0x42 /*Gesture/PS detection interrupt flag mask*/
|
||||
#define PAJ_INT_FLAG1 0x43 /*Gesture detection interrupt flag*/
|
||||
#define PAJ_INT_FLAG2 0x44 /*Gesture/PS detection interrupt flag*/
|
||||
#define PAJ_STATE 0x45 /*State indicator for gesture detection (Only functional at gesture detection mode)*/
|
||||
#define PAJ_PS_HIGH_THRESHOLD 0x69 /*PS hysteresis high threshold (Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_LOW_THRESHOLD 0x6A /*PS hysteresis low threshold (Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_APPROACH_STATE 0x6B /*PS approach state, Approach = 1 , (8 bits PS data >= PS high threshold), Not Approach = 0 , (8 bits PS data <= PS low threshold)(Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_DATA 0x6C /*PS 8 bit data(Only functional at gesture detection mode)*/
|
||||
#define PAJ_OBJ_BRIGHTNESS 0xB0 /*Object Brightness (Max. 255)*/
|
||||
#define PAJ_OBJ_SIZE_L 0xB1 /*Object Size(Low 8 bit)*/
|
||||
#define PAJ_OBJ_SIZE_H 0xB2 /*Object Size(High 8 bit)*/
|
||||
|
||||
//Register Bank 1
|
||||
#define PAJ_PS_GAIN 0x44 /*PS gain setting (Only functional at proximity detection mode)*/
|
||||
#define PAJ_IDLE_S1_STEP_L 0x67 /*IDLE S1 Step, for setting the S1, Response Factor(Low 8 bit)*/
|
||||
#define PAJ_IDLE_S1_STEP_H 0x68 /*IDLE S1 Step, for setting the S1, Response Factor(High 8 bit)*/
|
||||
#define PAJ_IDLE_S2_STEP_L 0x69 /*IDLE S2 Step, for setting the S2, Response Factor(Low 8 bit)*/
|
||||
#define PAJ_IDLE_S2_STEP_H 0x6A /*IDLE S2 Step, for setting the S2, Response Factor(High 8 bit)*/
|
||||
#define PAJ_OPTOS1_TIME_L 0x6B /*OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 state(Low 8 bit)*/
|
||||
#define PAJ_OPTOS2_TIME_H 0x6C /*OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 stateHigh 8 bit)*/
|
||||
#define PAJ_S1TOS2_TIME_L 0x6D /*S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 state(Low 8 bit)*/
|
||||
#define PAJ_S1TOS2_TIME_H 0x6E /*S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 stateHigh 8 bit)*/
|
||||
#define PAJ_EN 0x72 /*Enable/Disable PAJ7620U2*/
|
||||
//Gesture detection interrupt flag
|
||||
#define PAJ_UP 0x01
|
||||
#define PAJ_DOWN 0x02
|
||||
#define PAJ_LEFT 0x04
|
||||
#define PAJ_RIGHT 0x08
|
||||
#define PAJ_FORWARD 0x10
|
||||
#define PAJ_BACKWARD 0x20
|
||||
#define PAJ_CLOCKWISE 0x40
|
||||
#define PAJ_COUNT_CLOCKWISE 0x80
|
||||
#define PAJ_WAVE 0x100
|
||||
//Initialize array size
|
||||
#define Init_Array sizeof(Init_Register_Array)/2
|
||||
#define PS_Array_SIZE sizeof(Init_PS_Array)/2
|
||||
#define Gesture_Array_SIZE sizeof(Init_Gesture_Array)/2
|
||||
//Power up initialize array
|
||||
unsigned char Init_Register_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x37,0x07},
|
||||
{0x38,0x17},
|
||||
{0x39,0x06},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0x46,0x2D},
|
||||
{0x47,0x0F},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x4A,0x1E},
|
||||
{0x4C,0x20},
|
||||
{0x51,0x10},
|
||||
{0x5E,0x10},
|
||||
{0x60,0x27},
|
||||
{0x80,0x42},
|
||||
{0x81,0x44},
|
||||
{0x82,0x04},
|
||||
{0x8B,0x01},
|
||||
{0x90,0x06},
|
||||
{0x95,0x0A},
|
||||
{0x96,0x0C},
|
||||
{0x97,0x05},
|
||||
{0x9A,0x14},
|
||||
{0x9C,0x3F},
|
||||
{0xA5,0x19},
|
||||
{0xCC,0x19},
|
||||
{0xCD,0x0B},
|
||||
{0xCE,0x13},
|
||||
{0xCF,0x64},
|
||||
{0xD0,0x21},
|
||||
{0xEF,0x01},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x25,0x01},
|
||||
{0x27,0x39},
|
||||
{0x28,0x7F},
|
||||
{0x29,0x08},
|
||||
{0x3E,0xFF},
|
||||
{0x5E,0x3D},
|
||||
{0x65,0x96},
|
||||
{0x67,0x97},
|
||||
{0x69,0xCD},
|
||||
{0x6A,0x01},
|
||||
{0x6D,0x2C},
|
||||
{0x6E,0x01},
|
||||
{0x72,0x01},
|
||||
{0x73,0x35},
|
||||
{0x74,0x00},
|
||||
{0x77,0x01},
|
||||
};
|
||||
//Approaches register initialization array
|
||||
unsigned char Init_PS_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x51,0x13},
|
||||
{0x83,0x20},
|
||||
{0x84,0x20},
|
||||
{0x85,0x00},
|
||||
{0x86,0x10},
|
||||
{0x87,0x00},
|
||||
{0x88,0x05},
|
||||
{0x89,0x18},
|
||||
{0x8A,0x10},
|
||||
{0x9f,0xf8},
|
||||
{0x69,0x96},
|
||||
{0x6A,0x02},
|
||||
{0xEF,0x01},
|
||||
{0x01,0x1E},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x41,0x50},
|
||||
{0x43,0x34},
|
||||
{0x65,0xCE},
|
||||
{0x66,0x0B},
|
||||
{0x67,0xCE},
|
||||
{0x68,0x0B},
|
||||
{0x69,0xE9},
|
||||
{0x6A,0x05},
|
||||
{0x6B,0x50},
|
||||
{0x6C,0xC3},
|
||||
{0x6D,0x50},
|
||||
{0x6E,0xC3},
|
||||
{0x74,0x05},
|
||||
};
|
||||
|
||||
//Gesture register initializes array
|
||||
const unsigned char Init_Gesture_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0xEF,0x00},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x51,0x10},
|
||||
{0x83,0x20},
|
||||
{0x9F,0xF9},
|
||||
{0xEF,0x01},
|
||||
{0x01,0x1E},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x41,0x40},
|
||||
{0x43,0x30},
|
||||
{0x65,0x96},
|
||||
{0x66,0x00},
|
||||
{0x67,0x97},
|
||||
{0x68,0x01},
|
||||
{0x69,0xCD},
|
||||
{0x6A,0x01},
|
||||
{0x6B,0xB0},
|
||||
{0x6C,0x04},
|
||||
{0x6D,0x2C},
|
||||
{0x6E,0x01},
|
||||
{0x74,0x00},
|
||||
{0xEF,0x00},
|
||||
{0x41,0xFF},
|
||||
{0x42,0x01},
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,231 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import time
|
||||
import smbus
|
||||
|
||||
#i2c address
|
||||
PAJ7620U2_I2C_ADDRESS = 0x73
|
||||
#Register Bank select
|
||||
PAJ_BANK_SELECT = 0xEF #Bank0== 0x00,Bank1== 0x01
|
||||
#Register Bank 0
|
||||
PAJ_SUSPEND = 0x03 #I2C suspend command (Write = 0x01 to enter suspend state). I2C wake-up command is slave ID wake-up. Refer to topic “I2C Bus Timing Characteristics and Protocol”
|
||||
PAJ_INT_FLAG1_MASK = 0x41 #Gesture detection interrupt flag mask
|
||||
PAJ_INT_FLAG2_MASK = 0x42 #Gesture/PS detection interrupt flag mask
|
||||
PAJ_INT_FLAG1 = 0x43 #Gesture detection interrupt flag
|
||||
PAJ_INT_FLAG2 = 0x44 #Gesture/PS detection interrupt flag
|
||||
PAJ_STATE = 0x45 #State indicator for gesture detection (Only functional at gesture detection mode)
|
||||
PAJ_PS_HIGH_THRESHOLD = 0x69 #PS hysteresis high threshold (Only functional at proximity detection mode)
|
||||
PAJ_PS_LOW_THRESHOLD = 0x6A #PS hysteresis low threshold (Only functional at proximity detection mode)
|
||||
PAJ_PS_APPROACH_STATE = 0x6B #PS approach state, Approach = 1 , (8 bits PS data >= PS high threshold), Not Approach = 0 , (8 bits PS data <= PS low threshold)(Only functional at proximity detection mode)
|
||||
PAJ_PS_DATA = 0x6C #PS 8 bit data(Only functional at gesture detection mode)
|
||||
PAJ_OBJ_BRIGHTNESS = 0xB0 #Object Brightness (Max. 255)
|
||||
PAJ_OBJ_SIZE_L = 0xB1 #Object Size(Low 8 bit)
|
||||
PAJ_OBJ_SIZE_H = 0xB2 #Object Size(High 8 bit)
|
||||
#Register Bank 1
|
||||
PAJ_PS_GAIN = 0x44 #PS gain setting (Only functional at proximity detection mode)
|
||||
PAJ_IDLE_S1_STEP_L = 0x67 #IDLE S1 Step, for setting the S1, Response Factor(Low 8 bit)
|
||||
PAJ_IDLE_S1_STEP_H = 0x68 #IDLE S1 Step, for setting the S1, Response Factor(High 8 bit)
|
||||
PAJ_IDLE_S2_STEP_L = 0x69 #IDLE S2 Step, for setting the S2, Response Factor(Low 8 bit)
|
||||
PAJ_IDLE_S2_STEP_H = 0x6A #IDLE S2 Step, for setting the S2, Response Factor(High 8 bit)
|
||||
PAJ_OPTOS1_TIME_L = 0x6B #OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 state(Low 8 bit)
|
||||
PAJ_OPTOS2_TIME_H = 0x6C #OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 stateHigh 8 bit)
|
||||
PAJ_S1TOS2_TIME_L = 0x6D #S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 state(Low 8 bit)
|
||||
PAJ_S1TOS2_TIME_H = 0x6E #S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 stateHigh 8 bit)
|
||||
PAJ_EN = 0x72 #Enable/Disable PAJ7620U2
|
||||
#Gesture detection interrupt flag
|
||||
PAJ_UP = 0x01
|
||||
PAJ_DOWN = 0x02
|
||||
PAJ_LEFT = 0x04
|
||||
PAJ_RIGHT = 0x08
|
||||
PAJ_FORWARD = 0x10
|
||||
PAJ_BACKWARD = 0x20
|
||||
PAJ_CLOCKWISE = 0x40
|
||||
PAJ_COUNT_CLOCKWISE = 0x80
|
||||
PAJ_WAVE = 0x100
|
||||
#Power up initialize array
|
||||
Init_Register_Array = (
|
||||
(0xEF,0x00),
|
||||
(0x37,0x07),
|
||||
(0x38,0x17),
|
||||
(0x39,0x06),
|
||||
(0x41,0x00),
|
||||
(0x42,0x00),
|
||||
(0x46,0x2D),
|
||||
(0x47,0x0F),
|
||||
(0x48,0x3C),
|
||||
(0x49,0x00),
|
||||
(0x4A,0x1E),
|
||||
(0x4C,0x20),
|
||||
(0x51,0x10),
|
||||
(0x5E,0x10),
|
||||
(0x60,0x27),
|
||||
(0x80,0x42),
|
||||
(0x81,0x44),
|
||||
(0x82,0x04),
|
||||
(0x8B,0x01),
|
||||
(0x90,0x06),
|
||||
(0x95,0x0A),
|
||||
(0x96,0x0C),
|
||||
(0x97,0x05),
|
||||
(0x9A,0x14),
|
||||
(0x9C,0x3F),
|
||||
(0xA5,0x19),
|
||||
(0xCC,0x19),
|
||||
(0xCD,0x0B),
|
||||
(0xCE,0x13),
|
||||
(0xCF,0x64),
|
||||
(0xD0,0x21),
|
||||
(0xEF,0x01),
|
||||
(0x02,0x0F),
|
||||
(0x03,0x10),
|
||||
(0x04,0x02),
|
||||
(0x25,0x01),
|
||||
(0x27,0x39),
|
||||
(0x28,0x7F),
|
||||
(0x29,0x08),
|
||||
(0x3E,0xFF),
|
||||
(0x5E,0x3D),
|
||||
(0x65,0x96),
|
||||
(0x67,0x97),
|
||||
(0x69,0xCD),
|
||||
(0x6A,0x01),
|
||||
(0x6D,0x2C),
|
||||
(0x6E,0x01),
|
||||
(0x72,0x01),
|
||||
(0x73,0x35),
|
||||
(0x74,0x00),
|
||||
(0x77,0x01),
|
||||
)
|
||||
#Approaches register initialization array
|
||||
Init_PS_Array = (
|
||||
(0xEF,0x00),
|
||||
(0x41,0x00),
|
||||
(0x42,0x00),
|
||||
(0x48,0x3C),
|
||||
(0x49,0x00),
|
||||
(0x51,0x13),
|
||||
(0x83,0x20),
|
||||
(0x84,0x20),
|
||||
(0x85,0x00),
|
||||
(0x86,0x10),
|
||||
(0x87,0x00),
|
||||
(0x88,0x05),
|
||||
(0x89,0x18),
|
||||
(0x8A,0x10),
|
||||
(0x9f,0xf8),
|
||||
(0x69,0x96),
|
||||
(0x6A,0x02),
|
||||
(0xEF,0x01),
|
||||
(0x01,0x1E),
|
||||
(0x02,0x0F),
|
||||
(0x03,0x10),
|
||||
(0x04,0x02),
|
||||
(0x41,0x50),
|
||||
(0x43,0x34),
|
||||
(0x65,0xCE),
|
||||
(0x66,0x0B),
|
||||
(0x67,0xCE),
|
||||
(0x68,0x0B),
|
||||
(0x69,0xE9),
|
||||
(0x6A,0x05),
|
||||
(0x6B,0x50),
|
||||
(0x6C,0xC3),
|
||||
(0x6D,0x50),
|
||||
(0x6E,0xC3),
|
||||
(0x74,0x05),
|
||||
)
|
||||
#Gesture register initializes array
|
||||
Init_Gesture_Array = (
|
||||
(0xEF,0x00),
|
||||
(0x41,0x00),
|
||||
(0x42,0x00),
|
||||
(0xEF,0x00),
|
||||
(0x48,0x3C),
|
||||
(0x49,0x00),
|
||||
(0x51,0x10),
|
||||
(0x83,0x20),
|
||||
(0x9F,0xF9),
|
||||
(0xEF,0x01),
|
||||
(0x01,0x1E),
|
||||
(0x02,0x0F),
|
||||
(0x03,0x10),
|
||||
(0x04,0x02),
|
||||
(0x41,0x40),
|
||||
(0x43,0x30),
|
||||
(0x65,0x96),
|
||||
(0x66,0x00),
|
||||
(0x67,0x97),
|
||||
(0x68,0x01),
|
||||
(0x69,0xCD),
|
||||
(0x6A,0x01),
|
||||
(0x6B,0xB0),
|
||||
(0x6C,0x04),
|
||||
(0x6D,0x2C),
|
||||
(0x6E,0x01),
|
||||
(0x74,0x00),
|
||||
(0xEF,0x00),
|
||||
(0x41,0xFF),
|
||||
(0x42,0x01),
|
||||
)
|
||||
class PAJ7620U2(object):
|
||||
def __init__(self,address=PAJ7620U2_I2C_ADDRESS):
|
||||
self._address = address
|
||||
self._bus = smbus.SMBus(1)
|
||||
time.sleep(0.5)
|
||||
if self._read_byte(0x00) == 0x20:
|
||||
print("\nGesture Sensor OK\n")
|
||||
for num in range(len(Init_Register_Array)):
|
||||
self._write_byte(Init_Register_Array[num][0],Init_Register_Array[num][1])
|
||||
else:
|
||||
print("\nGesture Sensor Error\n")
|
||||
self._write_byte(PAJ_BANK_SELECT, 0)
|
||||
for num in range(len(Init_Gesture_Array)):
|
||||
self._write_byte(Init_Gesture_Array[num][0],Init_Gesture_Array[num][1])
|
||||
def _read_byte(self,cmd):
|
||||
return self._bus.read_byte_data(self._address,cmd)
|
||||
|
||||
def _read_u16(self,cmd):
|
||||
LSB = self._bus.read_byte_data(self._address,cmd)
|
||||
MSB = self._bus.read_byte_data(self._address,cmd+1)
|
||||
return (MSB << 8) + LSB
|
||||
def _write_byte(self,cmd,val):
|
||||
self._bus.write_byte_data(self._address,cmd,val)
|
||||
def check_gesture(self):
|
||||
Gesture_Data=self._read_u16(PAJ_INT_FLAG1)
|
||||
if Gesture_Data == PAJ_UP:
|
||||
print("Up\r\n")
|
||||
elif Gesture_Data == PAJ_DOWN:
|
||||
print("Down\r\n")
|
||||
elif Gesture_Data == PAJ_LEFT:
|
||||
print("Left\r\n")
|
||||
elif Gesture_Data == PAJ_RIGHT:
|
||||
print("Right\r\n")
|
||||
elif Gesture_Data == PAJ_FORWARD:
|
||||
print("Forward\r\n")
|
||||
elif Gesture_Data == PAJ_BACKWARD:
|
||||
print("Backward\r\n")
|
||||
elif Gesture_Data == PAJ_CLOCKWISE:
|
||||
print("Clockwise\r\n")
|
||||
elif Gesture_Data == PAJ_COUNT_CLOCKWISE:
|
||||
print("AntiClockwise\r\n")
|
||||
elif Gesture_Data == PAJ_WAVE:
|
||||
print("Wave\r\n")
|
||||
return Gesture_Data
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
import time
|
||||
|
||||
print("\nGesture Sensor Test Program ...\n")
|
||||
|
||||
paj7620u2=PAJ7620U2()
|
||||
|
||||
while True:
|
||||
time.sleep(0.05)
|
||||
paj7620u2.check_gesture()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import time
|
||||
import smbus
|
||||
|
||||
#i2c address
|
||||
PAJ7620U2_I2C_ADDRESS = 0x73
|
||||
#Register Bank select
|
||||
PAJ_BANK_SELECT = 0xEF #Bank0== 0x00,Bank1== 0x01
|
||||
#Register Bank 0
|
||||
PAJ_SUSPEND = 0x03 #I2C suspend command (Write = 0x01 to enter suspend state). I2C wake-up command is slave ID wake-up. Refer to topic “I2C Bus Timing Characteristics and Protocol”
|
||||
PAJ_INT_FLAG1_MASK = 0x41 #Gesture detection interrupt flag mask
|
||||
PAJ_INT_FLAG2_MASK = 0x42 #Gesture/PS detection interrupt flag mask
|
||||
PAJ_INT_FLAG1 = 0x43 #Gesture detection interrupt flag
|
||||
PAJ_INT_FLAG2 = 0x44 #Gesture/PS detection interrupt flag
|
||||
PAJ_STATE = 0x45 #State indicator for gesture detection (Only functional at gesture detection mode)
|
||||
PAJ_PS_HIGH_THRESHOLD = 0x69 #PS hysteresis high threshold (Only functional at proximity detection mode)
|
||||
PAJ_PS_LOW_THRESHOLD = 0x6A #PS hysteresis low threshold (Only functional at proximity detection mode)
|
||||
PAJ_PS_APPROACH_STATE = 0x6B #PS approach state, Approach = 1 , (8 bits PS data >= PS high threshold), Not Approach = 0 , (8 bits PS data <= PS low threshold)(Only functional at proximity detection mode)
|
||||
PAJ_PS_DATA = 0x6C #PS 8 bit data(Only functional at gesture detection mode)
|
||||
PAJ_OBJ_BRIGHTNESS = 0xB0 #Object Brightness (Max. 255)
|
||||
PAJ_OBJ_SIZE_L = 0xB1 #Object Size(Low 8 bit)
|
||||
PAJ_OBJ_SIZE_H = 0xB2 #Object Size(High 8 bit)
|
||||
#Register Bank 1
|
||||
PAJ_PS_GAIN = 0x44 #PS gain setting (Only functional at proximity detection mode)
|
||||
PAJ_IDLE_S1_STEP_L = 0x67 #IDLE S1 Step, for setting the S1, Response Factor(Low 8 bit)
|
||||
PAJ_IDLE_S1_STEP_H = 0x68 #IDLE S1 Step, for setting the S1, Response Factor(High 8 bit)
|
||||
PAJ_IDLE_S2_STEP_L = 0x69 #IDLE S2 Step, for setting the S2, Response Factor(Low 8 bit)
|
||||
PAJ_IDLE_S2_STEP_H = 0x6A #IDLE S2 Step, for setting the S2, Response Factor(High 8 bit)
|
||||
PAJ_OPTOS1_TIME_L = 0x6B #OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 state(Low 8 bit)
|
||||
PAJ_OPTOS2_TIME_H = 0x6C #OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 stateHigh 8 bit)
|
||||
PAJ_S1TOS2_TIME_L = 0x6D #S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 state(Low 8 bit)
|
||||
PAJ_S1TOS2_TIME_H = 0x6E #S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 stateHigh 8 bit)
|
||||
PAJ_EN = 0x72 #Enable/Disable PAJ7620U2
|
||||
#Gesture detection interrupt flag
|
||||
PAJ_UP = 0x01
|
||||
PAJ_DOWN = 0x02
|
||||
PAJ_LEFT = 0x04
|
||||
PAJ_RIGHT = 0x08
|
||||
PAJ_FORWARD = 0x10
|
||||
PAJ_BACKWARD = 0x20
|
||||
PAJ_CLOCKWISE = 0x40
|
||||
PAJ_COUNT_CLOCKWISE = 0x80
|
||||
PAJ_WAVE = 0x100
|
||||
#Power up initialize array
|
||||
Init_Register_Array = (
|
||||
(0xEF,0x00),
|
||||
(0x37,0x07),
|
||||
(0x38,0x17),
|
||||
(0x39,0x06),
|
||||
(0x41,0x00),
|
||||
(0x42,0x00),
|
||||
(0x46,0x2D),
|
||||
(0x47,0x0F),
|
||||
(0x48,0x3C),
|
||||
(0x49,0x00),
|
||||
(0x4A,0x1E),
|
||||
(0x4C,0x20),
|
||||
(0x51,0x10),
|
||||
(0x5E,0x10),
|
||||
(0x60,0x27),
|
||||
(0x80,0x42),
|
||||
(0x81,0x44),
|
||||
(0x82,0x04),
|
||||
(0x8B,0x01),
|
||||
(0x90,0x06),
|
||||
(0x95,0x0A),
|
||||
(0x96,0x0C),
|
||||
(0x97,0x05),
|
||||
(0x9A,0x14),
|
||||
(0x9C,0x3F),
|
||||
(0xA5,0x19),
|
||||
(0xCC,0x19),
|
||||
(0xCD,0x0B),
|
||||
(0xCE,0x13),
|
||||
(0xCF,0x64),
|
||||
(0xD0,0x21),
|
||||
(0xEF,0x01),
|
||||
(0x02,0x0F),
|
||||
(0x03,0x10),
|
||||
(0x04,0x02),
|
||||
(0x25,0x01),
|
||||
(0x27,0x39),
|
||||
(0x28,0x7F),
|
||||
(0x29,0x08),
|
||||
(0x3E,0xFF),
|
||||
(0x5E,0x3D),
|
||||
(0x65,0x96),
|
||||
(0x67,0x97),
|
||||
(0x69,0xCD),
|
||||
(0x6A,0x01),
|
||||
(0x6D,0x2C),
|
||||
(0x6E,0x01),
|
||||
(0x72,0x01),
|
||||
(0x73,0x35),
|
||||
(0x74,0x00),
|
||||
(0x77,0x01),
|
||||
)
|
||||
#Approaches register initialization array
|
||||
Init_PS_Array = (
|
||||
(0xEF,0x00),
|
||||
(0x41,0x00),
|
||||
(0x42,0x00),
|
||||
(0x48,0x3C),
|
||||
(0x49,0x00),
|
||||
(0x51,0x13),
|
||||
(0x83,0x20),
|
||||
(0x84,0x20),
|
||||
(0x85,0x00),
|
||||
(0x86,0x10),
|
||||
(0x87,0x00),
|
||||
(0x88,0x05),
|
||||
(0x89,0x18),
|
||||
(0x8A,0x10),
|
||||
(0x9f,0xf8),
|
||||
(0x69,0x96),
|
||||
(0x6A,0x02),
|
||||
(0xEF,0x01),
|
||||
(0x01,0x1E),
|
||||
(0x02,0x0F),
|
||||
(0x03,0x10),
|
||||
(0x04,0x02),
|
||||
(0x41,0x50),
|
||||
(0x43,0x34),
|
||||
(0x65,0xCE),
|
||||
(0x66,0x0B),
|
||||
(0x67,0xCE),
|
||||
(0x68,0x0B),
|
||||
(0x69,0xE9),
|
||||
(0x6A,0x05),
|
||||
(0x6B,0x50),
|
||||
(0x6C,0xC3),
|
||||
(0x6D,0x50),
|
||||
(0x6E,0xC3),
|
||||
(0x74,0x05),
|
||||
)
|
||||
#Gesture register initializes array
|
||||
Init_Gesture_Array = (
|
||||
(0xEF,0x00),
|
||||
(0x41,0x00),
|
||||
(0x42,0x00),
|
||||
(0xEF,0x00),
|
||||
(0x48,0x3C),
|
||||
(0x49,0x00),
|
||||
(0x51,0x10),
|
||||
(0x83,0x20),
|
||||
(0x9F,0xF9),
|
||||
(0xEF,0x01),
|
||||
(0x01,0x1E),
|
||||
(0x02,0x0F),
|
||||
(0x03,0x10),
|
||||
(0x04,0x02),
|
||||
(0x41,0x40),
|
||||
(0x43,0x30),
|
||||
(0x65,0x96),
|
||||
(0x66,0x00),
|
||||
(0x67,0x97),
|
||||
(0x68,0x01),
|
||||
(0x69,0xCD),
|
||||
(0x6A,0x01),
|
||||
(0x6B,0xB0),
|
||||
(0x6C,0x04),
|
||||
(0x6D,0x2C),
|
||||
(0x6E,0x01),
|
||||
(0x74,0x00),
|
||||
(0xEF,0x00),
|
||||
(0x41,0xFF),
|
||||
(0x42,0x01),
|
||||
)
|
||||
class PAJ7620U2(object):
|
||||
def __init__(self,address=PAJ7620U2_I2C_ADDRESS):
|
||||
self._address = address
|
||||
self._bus = smbus.SMBus(1)
|
||||
time.sleep(0.5)
|
||||
if self._read_byte(0x00) == 0x20:
|
||||
print("\nGesture Sensor OK\n")
|
||||
for num in range(len(Init_Register_Array)):
|
||||
self._write_byte(Init_Register_Array[num][0],Init_Register_Array[num][1])
|
||||
else:
|
||||
print("\nGesture Sensor Error\n")
|
||||
self._write_byte(PAJ_BANK_SELECT, 0)
|
||||
for num in range(len(Init_PS_Array)):
|
||||
self._write_byte(Init_PS_Array[num][0],Init_PS_Array[num][1])
|
||||
self._write_byte(PAJ_BANK_SELECT, 0)
|
||||
def _read_byte(self,cmd):
|
||||
return self._bus.read_byte_data(self._address,cmd)
|
||||
|
||||
def _read_u16(self,cmd):
|
||||
LSB = self._bus.read_byte_data(self._address,cmd)
|
||||
MSB = self._bus.read_byte_data(self._address,cmd+1)
|
||||
return (MSB << 8) + LSB
|
||||
def _write_byte(self,cmd,val):
|
||||
self._bus.write_byte_data(self._address,cmd,val)
|
||||
def check_gesture(self):
|
||||
OBJ_BRIGHTNESS = self._read_byte(PAJ_OBJ_BRIGHTNESS)
|
||||
OBJ_SIZE = self._read_u16(PAJ_OBJ_SIZE_L)
|
||||
print(' Object brightness = %.f , Object size = %.f'%(OBJ_BRIGHTNESS,OBJ_SIZE))
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
import time
|
||||
|
||||
print("\nGesture Sensor Test Program ...\n")
|
||||
|
||||
paj7620u2=PAJ7620U2()
|
||||
|
||||
while True:
|
||||
time.sleep(0.1)
|
||||
paj7620u2.check_gesture()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
PAJ7620U2:PAJ7620U2.c PAJ7620U2.h
|
||||
gcc -Wall PAJ7620U2.c -o PAJ7620U2 -lwiringPi -lm
|
||||
clean:
|
||||
rm PAJ7620U2
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#include <wiringPi.h>
|
||||
#include <wiringPiI2C.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "PAJ7620U2.h"
|
||||
int fd;
|
||||
/******************* PAJ7620U2 Driver Interface *****************************/
|
||||
char I2C_readByte(int reg)
|
||||
{
|
||||
return wiringPiI2CReadReg8(fd, reg);
|
||||
}
|
||||
|
||||
unsigned short I2C_readU16(int reg)
|
||||
{
|
||||
return wiringPiI2CReadReg16(fd, reg);
|
||||
}
|
||||
void I2C_writeByte(int reg, int val)
|
||||
{
|
||||
wiringPiI2CWriteReg8(fd, reg, val);
|
||||
}
|
||||
unsigned char PAJ7620U2_init()
|
||||
{
|
||||
unsigned char i,State;
|
||||
fd=wiringPiI2CSetup(PAJ7620U2_I2C_ADDRESS);
|
||||
delay(5);
|
||||
State = I2C_readByte(0x00); //Read State
|
||||
if (State != 0x20) return 0; //Wake up failed
|
||||
I2C_writeByte(PAJ_BANK_SELECT, 0); //Select Bank 0
|
||||
for (i=0;i< Init_Array;i++)
|
||||
{
|
||||
I2C_writeByte(Init_Register_Array[i][0], Init_Register_Array[i][1]);//Power up initialize
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
unsigned char i;
|
||||
unsigned short Gesture_Data;
|
||||
printf("\nGesture Sensor Test Program ...\n");
|
||||
if (wiringPiSetup() < 0) return 1;
|
||||
delay(5);
|
||||
if(!PAJ7620U2_init())
|
||||
{ printf("\nGesture Sensor Error\n");
|
||||
return 0;
|
||||
}
|
||||
printf("\nGesture Sensor OK\n");
|
||||
I2C_writeByte(PAJ_BANK_SELECT, 0);//Select Bank 0
|
||||
for (i = 0; i < Gesture_Array_SIZE; i++)
|
||||
{
|
||||
I2C_writeByte(Init_Gesture_Array[i][0], Init_Gesture_Array[i][1]);//Gesture register initializes
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
Gesture_Data = I2C_readU16(PAJ_INT_FLAG1);
|
||||
|
||||
if (Gesture_Data)
|
||||
{
|
||||
switch (Gesture_Data)
|
||||
{
|
||||
case PAJ_UP: printf("Up\r\n"); break;
|
||||
case PAJ_DOWN: printf("Down\r\n"); break;
|
||||
case PAJ_LEFT: printf("Left\r\n"); break;
|
||||
case PAJ_RIGHT: printf("Right\r\n"); break;
|
||||
case PAJ_FORWARD: printf("Forward\r\n"); break;
|
||||
case PAJ_BACKWARD: printf("Backward\r\n"); break;
|
||||
case PAJ_CLOCKWISE: printf("Clockwise\r\n"); break;
|
||||
case PAJ_COUNT_CLOCKWISE: printf("AntiClockwise\r\n"); break;
|
||||
case PAJ_WAVE: printf("Wave\r\n"); break;
|
||||
default: break;
|
||||
}
|
||||
Gesture_Data=0;
|
||||
delay(50);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
#ifndef _PAJ7620U2_
|
||||
#define _PAJ7620U2_
|
||||
|
||||
//i2c address
|
||||
#define PAJ7620U2_I2C_ADDRESS 0x73
|
||||
//Register Bank select
|
||||
#define PAJ_BANK_SELECT 0xEF /*Bank0=0x00,Bank1=0x01*/
|
||||
//Register Bank 0
|
||||
#define PAJ_SUSPEND 0x03 /*I2C suspend command (Write 0x01 to enter suspend state). I2C wake-up command is slave ID wake-up. Refer to topic ¡°I2C Bus Timing Characteristics and Protocol¡±*/
|
||||
#define PAJ_INT_FLAG1_MASK 0x41 /*Gesture detection interrupt flag mask*/
|
||||
#define PAJ_INT_FLAG2_MASK 0x42 /*Gesture/PS detection interrupt flag mask*/
|
||||
#define PAJ_INT_FLAG1 0x43 /*Gesture detection interrupt flag*/
|
||||
#define PAJ_INT_FLAG2 0x44 /*Gesture/PS detection interrupt flag*/
|
||||
#define PAJ_STATE 0x45 /*State indicator for gesture detection (Only functional at gesture detection mode)*/
|
||||
#define PAJ_PS_HIGH_THRESHOLD 0x69 /*PS hysteresis high threshold (Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_LOW_THRESHOLD 0x6A /*PS hysteresis low threshold (Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_APPROACH_STATE 0x6B /*PS approach state, Approach = 1 , (8 bits PS data >= PS high threshold), Not Approach = 0 , (8 bits PS data <= PS low threshold)(Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_DATA 0x6C /*PS 8 bit data(Only functional at gesture detection mode)*/
|
||||
#define PAJ_OBJ_BRIGHTNESS 0xB0 /*Object Brightness (Max. 255)*/
|
||||
#define PAJ_OBJ_SIZE_L 0xB1 /*Object Size(Low 8 bit)*/
|
||||
#define PAJ_OBJ_SIZE_H 0xB2 /*Object Size(High 8 bit)*/
|
||||
|
||||
//Register Bank 1
|
||||
#define PAJ_PS_GAIN 0x44 /*PS gain setting (Only functional at proximity detection mode)*/
|
||||
#define PAJ_IDLE_S1_STEP_L 0x67 /*IDLE S1 Step, for setting the S1, Response Factor(Low 8 bit)*/
|
||||
#define PAJ_IDLE_S1_STEP_H 0x68 /*IDLE S1 Step, for setting the S1, Response Factor(High 8 bit)*/
|
||||
#define PAJ_IDLE_S2_STEP_L 0x69 /*IDLE S2 Step, for setting the S2, Response Factor(Low 8 bit)*/
|
||||
#define PAJ_IDLE_S2_STEP_H 0x6A /*IDLE S2 Step, for setting the S2, Response Factor(High 8 bit)*/
|
||||
#define PAJ_OPTOS1_TIME_L 0x6B /*OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 state(Low 8 bit)*/
|
||||
#define PAJ_OPTOS2_TIME_H 0x6C /*OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 stateHigh 8 bit)*/
|
||||
#define PAJ_S1TOS2_TIME_L 0x6D /*S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 state(Low 8 bit)*/
|
||||
#define PAJ_S1TOS2_TIME_H 0x6E /*S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 stateHigh 8 bit)*/
|
||||
#define PAJ_EN 0x72 /*Enable/Disable PAJ7620U2*/
|
||||
//Gesture detection interrupt flag
|
||||
#define PAJ_UP 0x01
|
||||
#define PAJ_DOWN 0x02
|
||||
#define PAJ_LEFT 0x04
|
||||
#define PAJ_RIGHT 0x08
|
||||
#define PAJ_FORWARD 0x10
|
||||
#define PAJ_BACKWARD 0x20
|
||||
#define PAJ_CLOCKWISE 0x40
|
||||
#define PAJ_COUNT_CLOCKWISE 0x80
|
||||
#define PAJ_WAVE 0x100
|
||||
//Initialize array size
|
||||
#define Init_Array sizeof(Init_Register_Array)/2
|
||||
#define PS_Array_SIZE sizeof(Init_PS_Array)/2
|
||||
#define Gesture_Array_SIZE sizeof(Init_Gesture_Array)/2
|
||||
//Power up initialize array
|
||||
unsigned char Init_Register_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x37,0x07},
|
||||
{0x38,0x17},
|
||||
{0x39,0x06},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0x46,0x2D},
|
||||
{0x47,0x0F},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x4A,0x1E},
|
||||
{0x4C,0x20},
|
||||
{0x51,0x10},
|
||||
{0x5E,0x10},
|
||||
{0x60,0x27},
|
||||
{0x80,0x42},
|
||||
{0x81,0x44},
|
||||
{0x82,0x04},
|
||||
{0x8B,0x01},
|
||||
{0x90,0x06},
|
||||
{0x95,0x0A},
|
||||
{0x96,0x0C},
|
||||
{0x97,0x05},
|
||||
{0x9A,0x14},
|
||||
{0x9C,0x3F},
|
||||
{0xA5,0x19},
|
||||
{0xCC,0x19},
|
||||
{0xCD,0x0B},
|
||||
{0xCE,0x13},
|
||||
{0xCF,0x64},
|
||||
{0xD0,0x21},
|
||||
{0xEF,0x01},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x25,0x01},
|
||||
{0x27,0x39},
|
||||
{0x28,0x7F},
|
||||
{0x29,0x08},
|
||||
{0x3E,0xFF},
|
||||
{0x5E,0x3D},
|
||||
{0x65,0x96},
|
||||
{0x67,0x97},
|
||||
{0x69,0xCD},
|
||||
{0x6A,0x01},
|
||||
{0x6D,0x2C},
|
||||
{0x6E,0x01},
|
||||
{0x72,0x01},
|
||||
{0x73,0x35},
|
||||
{0x74,0x00},
|
||||
{0x77,0x01},
|
||||
};
|
||||
//Approaches register initialization array
|
||||
unsigned char Init_PS_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x51,0x13},
|
||||
{0x83,0x20},
|
||||
{0x84,0x20},
|
||||
{0x85,0x00},
|
||||
{0x86,0x10},
|
||||
{0x87,0x00},
|
||||
{0x88,0x05},
|
||||
{0x89,0x18},
|
||||
{0x8A,0x10},
|
||||
{0x9f,0xf8},
|
||||
{0x69,0x96},
|
||||
{0x6A,0x02},
|
||||
{0xEF,0x01},
|
||||
{0x01,0x1E},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x41,0x50},
|
||||
{0x43,0x34},
|
||||
{0x65,0xCE},
|
||||
{0x66,0x0B},
|
||||
{0x67,0xCE},
|
||||
{0x68,0x0B},
|
||||
{0x69,0xE9},
|
||||
{0x6A,0x05},
|
||||
{0x6B,0x50},
|
||||
{0x6C,0xC3},
|
||||
{0x6D,0x50},
|
||||
{0x6E,0xC3},
|
||||
{0x74,0x05},
|
||||
};
|
||||
|
||||
//Gesture register initializes array
|
||||
const unsigned char Init_Gesture_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0xEF,0x00},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x51,0x10},
|
||||
{0x83,0x20},
|
||||
{0x9F,0xF9},
|
||||
{0xEF,0x01},
|
||||
{0x01,0x1E},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x41,0x40},
|
||||
{0x43,0x30},
|
||||
{0x65,0x96},
|
||||
{0x66,0x00},
|
||||
{0x67,0x97},
|
||||
{0x68,0x01},
|
||||
{0x69,0xCD},
|
||||
{0x6A,0x01},
|
||||
{0x6B,0xB0},
|
||||
{0x6C,0x04},
|
||||
{0x6D,0x2C},
|
||||
{0x6E,0x01},
|
||||
{0x74,0x00},
|
||||
{0xEF,0x00},
|
||||
{0x41,0xFF},
|
||||
{0x42,0x01},
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
PAJ7620U2:PAJ7620U2.c PAJ7620U2.h
|
||||
gcc -Wall PAJ7620U2.c -o PAJ7620U2 -lwiringPi -lm
|
||||
clean:
|
||||
rm PAJ7620U2
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#include <wiringPi.h>
|
||||
#include <wiringPiI2C.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "PAJ7620U2.h"
|
||||
int fd;
|
||||
/******************* PAJ7620U2 Driver Interface *****************************/
|
||||
char I2C_readByte(int reg)
|
||||
{
|
||||
return wiringPiI2CReadReg8(fd, reg);
|
||||
}
|
||||
|
||||
unsigned short I2C_readU16(int reg)
|
||||
{
|
||||
return wiringPiI2CReadReg16(fd, reg);
|
||||
}
|
||||
void I2C_writeByte(int reg, int val)
|
||||
{
|
||||
wiringPiI2CWriteReg8(fd, reg, val);
|
||||
}
|
||||
unsigned char PAJ7620U2_init()
|
||||
{
|
||||
unsigned char i,State;
|
||||
fd=wiringPiI2CSetup(PAJ7620U2_I2C_ADDRESS);
|
||||
delay(5);
|
||||
State = I2C_readByte(0x00); //Read State
|
||||
if (State != 0x20) return 0; //Wake up failed
|
||||
I2C_writeByte(PAJ_BANK_SELECT, 0); //Select Bank 0
|
||||
for (i=0;i< Init_Array;i++)
|
||||
{
|
||||
I2C_writeByte(Init_Register_Array[i][0], Init_Register_Array[i][1]);//Power up initialize
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
unsigned char i, OBJ_BRIGHTNESS;
|
||||
unsigned short OBJ_SIZE;
|
||||
printf("\nGesture Sensor Test Program ...\n");
|
||||
if (wiringPiSetup() < 0) return 1;
|
||||
delay(5);
|
||||
if(!PAJ7620U2_init())
|
||||
{ printf("\nGesture Sensor Error\n");
|
||||
return 0;
|
||||
}
|
||||
printf("\nGesture Sensor OK\n");
|
||||
I2C_writeByte(PAJ_BANK_SELECT, 0);//Select Bank 0
|
||||
for (i = 0; i < PS_Array_SIZE; i++)
|
||||
{
|
||||
I2C_writeByte(Init_PS_Array[i][0], Init_PS_Array[i][1]);//Gesture register initializes
|
||||
}
|
||||
I2C_writeByte(PAJ_BANK_SELECT, 0);//Select Bank 0
|
||||
while (1)
|
||||
{
|
||||
OBJ_BRIGHTNESS = I2C_readByte(PAJ_OBJ_BRIGHTNESS);
|
||||
OBJ_SIZE = I2C_readU16(PAJ_OBJ_SIZE_L);
|
||||
printf("Object brightness = %d ,Object size = %d\n", OBJ_BRIGHTNESS, OBJ_SIZE);//Object Brightness (Max. 255),Object Size (Max. 900)
|
||||
delay(50);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
#ifndef _PAJ7620U2_
|
||||
#define _PAJ7620U2_
|
||||
|
||||
//i2c address
|
||||
#define PAJ7620U2_I2C_ADDRESS 0x73
|
||||
//Register Bank select
|
||||
#define PAJ_BANK_SELECT 0xEF /*Bank0=0x00,Bank1=0x01*/
|
||||
//Register Bank 0
|
||||
#define PAJ_SUSPEND 0x03 /*I2C suspend command (Write 0x01 to enter suspend state). I2C wake-up command is slave ID wake-up. Refer to topic ¡°I2C Bus Timing Characteristics and Protocol¡±*/
|
||||
#define PAJ_INT_FLAG1_MASK 0x41 /*Gesture detection interrupt flag mask*/
|
||||
#define PAJ_INT_FLAG2_MASK 0x42 /*Gesture/PS detection interrupt flag mask*/
|
||||
#define PAJ_INT_FLAG1 0x43 /*Gesture detection interrupt flag*/
|
||||
#define PAJ_INT_FLAG2 0x44 /*Gesture/PS detection interrupt flag*/
|
||||
#define PAJ_STATE 0x45 /*State indicator for gesture detection (Only functional at gesture detection mode)*/
|
||||
#define PAJ_PS_HIGH_THRESHOLD 0x69 /*PS hysteresis high threshold (Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_LOW_THRESHOLD 0x6A /*PS hysteresis low threshold (Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_APPROACH_STATE 0x6B /*PS approach state, Approach = 1 , (8 bits PS data >= PS high threshold), Not Approach = 0 , (8 bits PS data <= PS low threshold)(Only functional at proximity detection mode)*/
|
||||
#define PAJ_PS_DATA 0x6C /*PS 8 bit data(Only functional at gesture detection mode)*/
|
||||
#define PAJ_OBJ_BRIGHTNESS 0xB0 /*Object Brightness (Max. 255)*/
|
||||
#define PAJ_OBJ_SIZE_L 0xB1 /*Object Size(Low 8 bit)*/
|
||||
#define PAJ_OBJ_SIZE_H 0xB2 /*Object Size(High 8 bit)*/
|
||||
|
||||
//Register Bank 1
|
||||
#define PAJ_PS_GAIN 0x44 /*PS gain setting (Only functional at proximity detection mode)*/
|
||||
#define PAJ_IDLE_S1_STEP_L 0x67 /*IDLE S1 Step, for setting the S1, Response Factor(Low 8 bit)*/
|
||||
#define PAJ_IDLE_S1_STEP_H 0x68 /*IDLE S1 Step, for setting the S1, Response Factor(High 8 bit)*/
|
||||
#define PAJ_IDLE_S2_STEP_L 0x69 /*IDLE S2 Step, for setting the S2, Response Factor(Low 8 bit)*/
|
||||
#define PAJ_IDLE_S2_STEP_H 0x6A /*IDLE S2 Step, for setting the S2, Response Factor(High 8 bit)*/
|
||||
#define PAJ_OPTOS1_TIME_L 0x6B /*OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 state(Low 8 bit)*/
|
||||
#define PAJ_OPTOS2_TIME_H 0x6C /*OPtoS1 Step, for setting the OPtoS1 time of operation state to standby 1 stateHigh 8 bit)*/
|
||||
#define PAJ_S1TOS2_TIME_L 0x6D /*S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 state(Low 8 bit)*/
|
||||
#define PAJ_S1TOS2_TIME_H 0x6E /*S1toS2 Step, for setting the S1toS2 time of standby 1 state to standby 2 stateHigh 8 bit)*/
|
||||
#define PAJ_EN 0x72 /*Enable/Disable PAJ7620U2*/
|
||||
//Gesture detection interrupt flag
|
||||
#define PAJ_UP 0x01
|
||||
#define PAJ_DOWN 0x02
|
||||
#define PAJ_LEFT 0x04
|
||||
#define PAJ_RIGHT 0x08
|
||||
#define PAJ_FORWARD 0x10
|
||||
#define PAJ_BACKWARD 0x20
|
||||
#define PAJ_CLOCKWISE 0x40
|
||||
#define PAJ_COUNT_CLOCKWISE 0x80
|
||||
#define PAJ_WAVE 0x100
|
||||
//Initialize array size
|
||||
#define Init_Array sizeof(Init_Register_Array)/2
|
||||
#define PS_Array_SIZE sizeof(Init_PS_Array)/2
|
||||
#define Gesture_Array_SIZE sizeof(Init_Gesture_Array)/2
|
||||
//Power up initialize array
|
||||
unsigned char Init_Register_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x37,0x07},
|
||||
{0x38,0x17},
|
||||
{0x39,0x06},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0x46,0x2D},
|
||||
{0x47,0x0F},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x4A,0x1E},
|
||||
{0x4C,0x20},
|
||||
{0x51,0x10},
|
||||
{0x5E,0x10},
|
||||
{0x60,0x27},
|
||||
{0x80,0x42},
|
||||
{0x81,0x44},
|
||||
{0x82,0x04},
|
||||
{0x8B,0x01},
|
||||
{0x90,0x06},
|
||||
{0x95,0x0A},
|
||||
{0x96,0x0C},
|
||||
{0x97,0x05},
|
||||
{0x9A,0x14},
|
||||
{0x9C,0x3F},
|
||||
{0xA5,0x19},
|
||||
{0xCC,0x19},
|
||||
{0xCD,0x0B},
|
||||
{0xCE,0x13},
|
||||
{0xCF,0x64},
|
||||
{0xD0,0x21},
|
||||
{0xEF,0x01},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x25,0x01},
|
||||
{0x27,0x39},
|
||||
{0x28,0x7F},
|
||||
{0x29,0x08},
|
||||
{0x3E,0xFF},
|
||||
{0x5E,0x3D},
|
||||
{0x65,0x96},
|
||||
{0x67,0x97},
|
||||
{0x69,0xCD},
|
||||
{0x6A,0x01},
|
||||
{0x6D,0x2C},
|
||||
{0x6E,0x01},
|
||||
{0x72,0x01},
|
||||
{0x73,0x35},
|
||||
{0x74,0x00},
|
||||
{0x77,0x01},
|
||||
};
|
||||
//Approaches register initialization array
|
||||
unsigned char Init_PS_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x51,0x13},
|
||||
{0x83,0x20},
|
||||
{0x84,0x20},
|
||||
{0x85,0x00},
|
||||
{0x86,0x10},
|
||||
{0x87,0x00},
|
||||
{0x88,0x05},
|
||||
{0x89,0x18},
|
||||
{0x8A,0x10},
|
||||
{0x9f,0xf8},
|
||||
{0x69,0x96},
|
||||
{0x6A,0x02},
|
||||
{0xEF,0x01},
|
||||
{0x01,0x1E},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x41,0x50},
|
||||
{0x43,0x34},
|
||||
{0x65,0xCE},
|
||||
{0x66,0x0B},
|
||||
{0x67,0xCE},
|
||||
{0x68,0x0B},
|
||||
{0x69,0xE9},
|
||||
{0x6A,0x05},
|
||||
{0x6B,0x50},
|
||||
{0x6C,0xC3},
|
||||
{0x6D,0x50},
|
||||
{0x6E,0xC3},
|
||||
{0x74,0x05},
|
||||
};
|
||||
|
||||
//Gesture register initializes array
|
||||
const unsigned char Init_Gesture_Array[][2] = {
|
||||
{0xEF,0x00},
|
||||
{0x41,0x00},
|
||||
{0x42,0x00},
|
||||
{0xEF,0x00},
|
||||
{0x48,0x3C},
|
||||
{0x49,0x00},
|
||||
{0x51,0x10},
|
||||
{0x83,0x20},
|
||||
{0x9F,0xF9},
|
||||
{0xEF,0x01},
|
||||
{0x01,0x1E},
|
||||
{0x02,0x0F},
|
||||
{0x03,0x10},
|
||||
{0x04,0x02},
|
||||
{0x41,0x40},
|
||||
{0x43,0x30},
|
||||
{0x65,0x96},
|
||||
{0x66,0x00},
|
||||
{0x67,0x97},
|
||||
{0x68,0x01},
|
||||
{0x69,0xCD},
|
||||
{0x6A,0x01},
|
||||
{0x6B,0xB0},
|
||||
{0x6C,0x04},
|
||||
{0x6D,0x2C},
|
||||
{0x6E,0x01},
|
||||
{0x74,0x00},
|
||||
{0xEF,0x00},
|
||||
{0x41,0xFF},
|
||||
{0x42,0x01},
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user