123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- #ifndef _SC7A20_H
- #define _SC7A20_H
- #include "commontypedef.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- /***ʹ������ǰ�����ʵ�ʽ����������******/
- /**SC7A20��SDO �Žӵأ� 0****************/
- /**SC7A20��SDO �Žӵ�Դ��1****************/
- #define SC7A20_SDO_VDD_GND 0
- /*****************************************/
- /***ʹ������ǰ�����ʵ��IIC�����������***/
- /**SC7A20��IIC �ӿڵ�ַ���� 7bits�� 0****/
- /**SC7A20��IIC �ӿڵ�ַ���� 8bits�� 1****/
- #define SC7A20_IIC_7BITS_8BITS 0
- /*****************************************/
- #define SL_SC7A20_16BIT_8BIT 1
- /**SC7A20������λ��ѡ�� 16bits�� 1****/
- /**SC7A20������λ��ѡ�� 8bits�� 0****/
- /*****************************************/
- #define SL_6D4D2D1D_SEL 6
- #if SC7A20_SDO_VDD_GND==0
- #define SC7A20_IIC_7BITS_ADDR 0x18
- #define SC7A20_IIC_8BITS_ADDR 0x30
- #else
- #define SC7A20_IIC_7BITS_ADDR 0x19
- #define SC7A20_IIC_8BITS_ADDR 0x32
- #endif
- #if SC7A20_IIC_7BITS_8BITS==0
- #define SC7A20_IIC_ADDRESS SC7A20_IIC_7BITS_ADDR
- #else
- #define SC7A20_IIC_ADDRESS SC7A20_IIC_8BITS_ADDR
- #endif
- #define SC7A20_CHIP_ID_ADDRESS (UINT8)(0x0F)
- #define SC7A20_CHIP_ID_VALUE (UINT8)(0x11)
- #define SL_SC7A20_CTRL_REG1 (UINT8)(0x20)
- #define SL_SC7A20_CTRL_REG2 (UINT8)(0x21)
- #define SL_SC7A20_CTRL_REG3 (UINT8)(0x22)
- #define SL_SC7A20_CTRL_REG4 (UINT8)(0x23)
- #define SL_SC7A20_CTRL_REG5 (UINT8)(0x24)
- #define SL_SC7A20_CTRL_REG6 (UINT8)(0x25)
- #define SL_SC7A20_STATUS_REG (UINT8)(0x27)
- #define SL_SC7A20_OUT_X_L (UINT8)(0x28)
- #define SL_SC7A20_OUT_X_H (UINT8)(0x29)
- #define SL_SC7A20_OUT_Y_L (UINT8)(0x2A)
- #define SL_SC7A20_OUT_Y_H (UINT8)(0x2B)
- #define SL_SC7A20_OUT_Z_L (UINT8)(0x2C)
- #define SL_SC7A20_OUT_Z_H (UINT8)(0x2D)
- #define SL_SC7A20_FIFO_CTRL_REG (UINT8)(0x2E)
- #define SL_SC7A20_FIFO_SRC_REG (UINT8)(0x2F)
- #define SL_SC7A20_INT1_CFG (UINT8)(0x30)
- #define SL_SC7A20_INT1_SRC (UINT8)(0x31)
- #define SL_SC7A20_INT1_THS (UINT8)(0x32)
- #define SL_SC7A20_INT1_DURATION (UINT8)(0x33)
- #define SL_SC7A20_INT2_CFG (UINT8)(0x34)
- #define SL_SC7A20_INT2_SRC (UINT8)(0x35)
- #define SL_SC7A20_INT2_THS (UINT8)(0x36)
- #define SL_SC7A20_INT2_DURATION (UINT8)(0x37)
- #define SL_SC7A20_CLICK_CFG (UINT8)(0x38)
- #define SL_SC7A20_CLICK_SRC (UINT8)(0x39)
- #define SL_SC7A20_CLICK_THS (UINT8)(0x3A)
- #define SL_SC7A20_TIME_LIMIT (UINT8)(0x3B)
- #define SL_SC7A20_TIME_LATENCY (UINT8)(0x3C)
- #define SL_SC7A20_TIME_WINDOW (UINT8)(0x3D)
- #define SL_SC7A20_ACT_THS (UINT8)(0x3E)
- #define SL_SC7A20_ACT_DURATION (UINT8)(0x3F)
-
- /*������ȡ����ʱ�����ݼĴ�����ַ*/
- #define SL_SC7A20_DATA_OUT (UINT8)(SL_SC7A20_OUT_X_L)
- /**********����ܼĴ���**********/
- /*��ԭ��������Ա������*/
- #define SL_SC7A20_MTP_ENABLE (0x00)
- #define SL_SC7A20_MTP_CFG (UINT8)(0x1E)
- #define SL_SC7A20_MTP_VALUE (UINT8)(0x05)
- #define SL_SC7A20_SDOI2C_PU_CFG (UINT8)(0x57)
- #define SL_SC7A20_SDO_PU_MSK (UINT8)(0x08)
- #define SL_SC7A20_I2C_PU_MSK (UINT8)(0x04)
- #define SL_SC7A20_HR_ENABLE (UINT8)(0X08)
- #define SL_SC7A20_BOOT_ENABLE (UINT8)(0X80)
- /*��ԭ��������Ա������*/
- /***************���ݸ�������**���ٶȼ�ʹ��**********/
- #define SL_SC7A20_ODR_POWER_DOWN (UINT8)(0x00)
- #define SL_SC7A20_ODR_1HZ (UINT8)(0x17)
- #define SL_SC7A20_ODR_10HZ (UINT8)(0x27)
- #define SL_SC7A20_ODR_25HZ (UINT8)(0x37)
- #define SL_SC7A20_ODR_50HZ (UINT8)(0x47)
- #define SL_SC7A20_ODR_100HZ (UINT8)(0x57)
- #define SL_SC7A20_ODR_200HZ (UINT8)(0x67)
- #define SL_SC7A20_ODR_400HZ (UINT8)(0x77)
- #define SL_SC7A20_ODR_1600HZ (UINT8)(0x87)
- #define SL_SC7A20_ODR_1250HZ (UINT8)(0x97)
- #define SL_SC7A20_ODR_5000HZ (UINT8)(0x9F)
-
- #define SL_SC7A20_LOWER_POWER_ODR_1HZ (UINT8)(0x1F)
- #define SL_SC7A20_LOWER_POWER_ODR_10HZ (UINT8)(0x2F)
- #define SL_SC7A20_LOWER_POWER_ODR_25HZ (UINT8)(0x3F)
- #define SL_SC7A20_LOWER_POWER_ODR_50HZ (UINT8)(0x4F)
- #define SL_SC7A20_LOWER_POWER_ODR_100HZ (UINT8)(0x5F)
- #define SL_SC7A20_LOWER_POWER_ODR_200HZ (UINT8)(0x6F)
- #define SL_SC7A20_LOWER_POWER_ODR_400HZ (UINT8)(0x7F)
- /***************���ݸ�������**���ٶȼ�ʹ��**********/
- /***************��������������**********************/
- #define SL_SC7A20_FS_2G (UINT8)(0x00)
- #define SL_SC7A20_FS_4G (UINT8)(0x10)
- #define SL_SC7A20_FS_8G (UINT8)(0x20)
- #define SL_SC7A20_FS_16G (UINT8)(0x30)
- /***************��������������**********************/
- /***ȡֵ��0-127֮�䣬�˴�������****/
- #define SL_SC7A20_INT_THS_5PERCENT (UINT8)(0x06)
- #define SL_SC7A20_INT_THS_10PERCENT (UINT8)(0x0C)
- #define SL_SC7A20_INT_THS_20PERCENT (UINT8)(0x18)
- #define SL_SC7A20_INT_THS_40PERCENT (UINT8)(0x32)
- #define SL_SC7A20_INT_THS_80PERCENT (UINT8)(0x60)
- /***ȡֵ��0-127֮�䣬�˴������� ����ODR��λʱ��****/
- #define SL_SC7A20_INT_DURATION_2CLK (UINT8)(0x02)
- #define SL_SC7A20_INT_DURATION_5CLK (UINT8)(0x05)
- #define SL_SC7A20_INT_DURATION_10CLK (UINT8)(0x0A)
- #define SL_SC7A20_INT_DURATION_30CLK (UINT8)(0x2E)
- /***�ж���Чʱ�ĵ�ƽ���ã��ߵ�ƽ�൱�������أ��͵�ƽ�൱���½���****/
- #define SL_SC7A20_INT_ACTIVE_LOWER_LEVEL (UINT8)(0x02) //0x02:�ж�ʱINT1����� �͵�ƽ
- #define SL_SC7A20_INT_ACTIVE_HIGH_LEVEL (UINT8)(0x00) //0x00:�ж�ʱINT1����� �ߵ�ƽ
- /***�ж���Чʱ�ĵ�ƽ���ã��ߵ�ƽ�൱�������أ��͵�ƽ�൱���½���****/
- #define SL_SC7A20_INT_AOI1_INT1 (UINT8)(0x40) //AOI1 TO INT1
- #define SL_SC7A20_INT_AOI2_INT1 (UINT8)(0x20) //AOI2 TO INT1
- extern INT32 GSENSOR_WriteReg(UINT8 addr, UINT8 value);
- extern INT32 GSENSOR_ReadReg(UINT8 reg, UINT8 len, UINT8 *buf);
- INT8 SL_SC7A20_Online_Test(void);
- INT8 SL_SC7A20_BOOT(void);
- INT8 SL_SC7A20_FS_Config(UINT8 Sc7a20_FS_Reg);
- INT8 SL_SC7A20_INT_Config(void);
- INT8 SL_SC7A20_INT_RESET(void);
- INT8 SL_SC7A20_Power_Config(UINT8 Power_Config_Reg);
- #if SL_SC7A20_16BIT_8BIT==0
- INT8 SL_SC7A20_Read_XYZ_Data(INT8 *SL_SC7A20_Data_XYZ_Buf);
- #elif SL_SC7A20_16BIT_8BIT==1
- INT8 SL_SC7A20_Read_XYZ_Data(INT16 *SL_SC7A20_Data_XYZ_Buf);
- #endif
- void GsensorInit(void);
- #ifdef __cplusplus
- }
- #endif
- #endif /* _SC7A20_H */
|