⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 motion_engine.h

📁 mtk 6225 下 重力传感器MXC6202驱动源码
💻 H
字号:
/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Memsic Corp.
*
*****************************************************************************/
/*****************************************************************************
 *
 * Filename:
 * ---------
 *  motion_engine.h
 *
 * Project:
 * --------
 * 
 *
 * Description:
 * ------------
 *  Motion sensor related interface header file
 *
 * Author:
 * -------
 * -------
 *                      
 *******************************************************************************/
#ifndef _MOTION_ENGINE_H_
#define _MOTION_ENGINE_H_

//#ifdef __MMI_MOTION_APP__
 

/***************************************************************************** 
* Include
*****************************************************************************/

/***************************************************************************** 
* Define
*****************************************************************************/
#define ENGINEMOTION_SUCCEED                        0
#define ENGINEMOTION_ERR_FAILED                     -6000

#define ENGINEMOTION_TILE_LEFT     1
#define ENGINEMOTION_TILE_RIGHT    2
#define ENGINEMOTION_TILE_UP       4
#define ENGINEMOTION_TILE_DOWN     8
#define ENGINEMOTION_TILE_ANY      0XF
#define ENGINEMOTION_TILE_LEFT_RELEASE  0X10
#define ENGINEMOTION_TILE_RIGHT_RELEASE 0X20
#define ENGINEMOTION_TILE_UP_RELEASE    0X40
#define ENGINEMOTION_TILE_DOWN_RELEASE  0X80

#define ENGINEMOTION_SHAKE_LEFT     0X100
#define ENGINEMOTION_SHAKE_RIGHT    0X200

#define ENGINEMOTION_TURNOVER       0x400

/***************************************************************************** 
* Typedef 
*****************************************************************************/
typedef enum
{
    MOTIONENGINE_SENSITIVE_LOW,
    MOTIONENGINE_SENSITIVE_NORMAL,
    MOTIONENGINE_SENSITIVE_HIGH,

    NUM_OF_MOTIONENGINE_SENSITIVE
} engineMotion_sensitive_enum;

typedef struct
{
//	LOCAL_PARA_HDR 
	kal_uint16 direction;
	kal_uint16 direction1;
	kal_int16  x;
	kal_int16  y;
	kal_int16  shakeStrength;
}engineMotion_msg_dir_struct;	

typedef void (*EngineMotion_shake_callback) (void);
typedef void (*EngineMotion_tile_callback) (S32 x, S32 y, S32 z);
typedef void (*EngineMotion_Application_callback)(void *para);

/*****************************************************************************              
* Extern Global Variable                                                                    
*****************************************************************************/

/*****************************************************************************              
* Extern Global Function                                                                    
*****************************************************************************/
extern void EngineMotion_setInstall(U16 dir);//传感器安装方向设置共8种模式
/************************************************************************
 *            左   右   上  下
 *       0     -x  +x   -y  +y
 *       1     -x  +x   +y  -y
 *
 *       2     -y  +y   +x  -x
 *       3     -y  +y   -x  +x
 *
 *       4    +x   -x   +y  -y
 *       5    +x   -x   -y  +y
 *
 *       6    +y   -y   -x  +x
 *       7    +y   -y   +x  -x
 ****************************************************************************/

extern S32 EngineMotion_init(void);
extern S32 EngineMotion_power_on(void);
extern S32 EngineMotion_power_off(void);


extern S32 EngineMotion_start_listen_tile(
                    U16 sensitive,
                    EngineMotion_Application_callback tile_event_callback);

extern S32 EngineMotion_stop_listen(void);

/* calibration */
extern S32 EngineMotion_start_cali(void);
extern S32 EngineMotion_confirm_cali(void);
extern S32 EngineMotion_cancel_cali(void);
extern S32 EngineMotion_save_cali_data(void);
extern S32 EngineMotion_load_cali_data(void);

//一般晃动处理
extern S32 EngineMotion_start_listen_shake(U16 sensitive, EngineMotion_Application_callback shake_event_callback);
//extern void EngineMotion_Shake_DataHandle(void *parameter);
//extern void EngineMotion_shake_process_hdlr(void *msg_ptr);

//八方向倾斜处理
extern S32 EngineMotion_start_listen_tile(
                    U16 sensitive,
                    EngineMotion_Application_callback tile_event_callback);


//四方向倾斜处理
extern S32 EngineMotion_start_listen_tile_4(
                    U16 sensitive,
                    EngineMotion_Application_callback tile_event_callback);

//extern void EngineMotion_Tile_DataHandle(void *parameter);
//extern void EngineMotion_Tile_process_hdlr(void *msg_ptr);

//直接获得数据
extern S32 EngineMotion_start_listen_rawdata(
                    U16 sensitive,
                    EngineMotion_Application_callback rawData_event_callback);
//extern void EngineMotion_RawData_DataHandle(void *parameter);
//extern void EngineMotion_RawData_process_hdlr(void *msg_ptr);

//晃动频率
extern S32 EngineMotion_start_listen_shakeFrq(
                    U16 sensitive,
                    EngineMotion_Application_callback shakeFrq_event_callback);
//extern void EngineMotion_ShakeFrq_DataHandle(void *parameter);
//extern void EngineMotion_ShakeFrq_process_hdlr(void *msg_ptr);

//晃动方向
extern S32 EngineMotion_start_listen_shakeDirection4(
                    U16 sensitive,U16 sensitive1,
                    EngineMotion_Application_callback shakeFrq_event_callback);

extern S32 EngineMotion_start_listen_shakeDirection(
                    U16 sensitive,
                    EngineMotion_Application_callback shakeFrq_event_callback);

extern S32 EngineMotion_start_listen_rotate(
                    U16 sensitive,
                    EngineMotion_Application_callback shakeFrq_event_callback);
extern S32 EngineMotion_start_listen_rotate4(
                    U16 sensitive,
                    EngineMotion_Application_callback shakeFrq_event_callback);
extern S32 EngineMotion_start_listen_turnOver(
            U16 sensitive,
            EngineMotion_Application_callback tile_event_callback);
extern S32 EngineMotion_start_listen_turnOver2(
            U16 sensitive,
            EngineMotion_Application_callback tile_event_callback);

extern S32 EngineMotion_start_listen_level_angle(
            U16 sensitive,
            EngineMotion_Application_callback tile_event_callback);

extern kal_int16 EngineMotion_Level_Angle_Get(void);




extern void EngineMotion_setCalibration(kal_int16  t);



//extern void EngineMotion_ShakeDirection_DataHandle(void *parameter);
//extern void EngineMotion_ShakeDirection_process_hdlr(void *msg_ptr);


//#endif /* __MMI_MOTION_APP__ */ 
#endif /* _MOTION_ENGINE_H_ */ 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -