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

📄 pedometer.h

📁 一个Gesssensor 的driver
💻 H
字号:
/*
********************************************************************************
*          Copyright (C),2004-2007, Fuzhou Rockchip Electronics Co.,Ltd.
*                             All Rights Reserved
*
*Description:
*
$Header: /cvs_server/mp3_project/RK2606_4G_DEMO/pedometer/pedometer.h,v 1.6 2007/04/25 03:15:15 HuangJiliu Exp $
$Author: HuangJiliu $
$Date: 2007/04/25 03:15:15 $ 
$Revision: 1.05 Release$
********************************************************************************
*/



#ifndef _IN_PEDOMETER_H
#define _IN_PEDOMETER_H

#include "Macro.h"

#define _PEDOMETER_APP_OVER
#define ROCK2_OVERLAY

#ifndef _PEDOMETER_APP_OVER
    #define PEDOMETER_APP_CODE 
    #define PEDOMETER_APP_DATA
#else
    #define PEDOMETER_APP_CODE     __attribute__((section(".pedometer_text, \"ax\"")))
    #define PEDOMETER_APP_DATA     __attribute__((section(".pedometer_data, \"aw\"")))
    #define PEDOMETER_APP_BSS      __attribute__((section(".pedometer_bss, \"aw\"")))
#endif

#define PEDOMETER_STOP           (1<<0)
#define PEDOMETER_RUN            (1<<1)
#define PEDOMETER_PAUSE          (1<<2)

typedef struct TIME_STRUCT
{
    unsigned int TimeCounter;
    unsigned int TimeInitValue;
    void         (*TimeFunc)(void *);
    void         *FuncArg;
}TimeStruct;

//#define     TIMER_MAX_CHANNEL   8//6


typedef struct TMR_STRUCT
{
    TimeStruct   TmrTbl[TIMER_MAX_CHANNEL];
    unsigned int TmrFlag;
}TMR;


#define TIMER_DISABLE_INT   {read_creg(%imask, imask_tmp); bitclear_creg(%imask, 15);}
#define TIMER_ENABLE_INT    {write_creg(%imask, imask_tmp);}

typedef union {
    struct 
    {
    unsigned int  bMenuinital:              1,
                  bAdjustWeight:            1,
                  bAdjustBodyHeight:        1,
                  bAdjustConsume:           1,
                  bAdjustPosition:          1,
                  bInSetMode:               1,//在设置模式
                  bInRecordMode:            1,//在显示记录模式
                  bPRecordDisplayinital:    1,
                  bPRecordDisplay:          1,
                  bPInStartSwitchintal:     1,
                  bPInStartSwitchMode:      1,
                  bPInStartSwitchDisplay:   1,
                  bBatt:                    1,
                  bReserved:                3;
    }bit;
    unsigned int  word;
}PEDOMETER_DISPLAY_FLAG;

#define PEDOMETER_NEW			0
#define PEDOMETER_CONTINUE		1
#define PEDOMETER_CLEAR_RECORD 	2
#define PEDOMETER_SETTING		3
#define PEDOMETER_SET_LAST		3


//////////////////////////////////////////////////////////////
union GsensorData{
    struct {
        unsigned char 	InternalReg;
        unsigned char   	XaccMSB;
        unsigned char   	XaccLSB;
        unsigned char   	YaccMSB;
        unsigned char   	YaccLSB;
        } Bytes;
//    WORD Array[5];
} ;
#define GSENSOR_I2C_ADDRESS (0x2A)/2
#define    RFF                      0x10
#define    RFNE                     0x08
#define    TFE                      0x04
#define    TFNF                     0x02
#define    ACTIVITY                 0x01
#define    ENABLE                   0

#define SENS_WALK 	0x000800		// Memsic Referece:  0.1G
#define SENS_PEDO	0x000050		// Memsic Referece: 20H?
#define SENS_JOGG	0x000A00		//Memsic Referece:  1G
#define SENS_RUNN	0x000C00		//Memsic Referece:  2G
#define SENS_JMAX	0x000000		//
#define SENS_RMAX	0x000000		//
#define SENS_WMAX	0x000000		//

#define STRI_WALK	0x000050	
#define STRI_JOGG	0x000080	
#define STRI_RUNN	0x0000A0	

#define SAMPLE_TIME	0x000001
#define HPF_RC		0x00000F
#define LPF_RC		0x000001

#define GS_POWERON 1
#define GS_POWERDOWN 0



//#define TEST_PEDOMETER_UI

#define PEDOMETER_DISP_PAUSE		0
#define PEDOMETER_DISP_RUN		1

#define PEDOMETER_BACK_CLOLOR	0x045C//0X031F
#define PEDOMETER_YELLOW_CLOLOR	0xFFE0//0X031F

#ifdef TEST_PEDOMETER_UI
//***************************************************************************************************状态显示
#define PEDOMETER_DISP_STATE_X                       	2
#define PEDOMETER_DISP_STATE_Y                       	0

#define PEDOMETER_DISP_STATE_XSIZE                      50
#define PEDOMETER_DISP_STATE_YSIZE                      16
//***************************************************************************************************重量
#define PEDOMETER_TEXT_BODY_WEIGHT_X                    2
#define PEDOMETER_TEXT_BODY_WEIGHT_Y                    16

#define PEDOMETER_NUMBER_BODY_WEIGHT_X                  PEDOMETER_TEXT_BODY_WEIGHT_X//70
#define PEDOMETER_NUMBER_BODY_WEIGHT_Y                  PEDOMETER_TEXT_BODY_WEIGHT_Y+16
//***************************************************************************************************身高
#define PEDOMETER_TEXT_STEP_SIZE_X                    2+52+4
#define PEDOMETER_TEXT_STEP_SIZE_Y                    16//32

#define PEDOMETER_NUMBER_STEP_SIZE_X                  PEDOMETER_TEXT_STEP_SIZE_X//70
#define PEDOMETER_NUMBER_STEP_SIZE_Y                  PEDOMETER_TEXT_STEP_SIZE_Y+16
//***************************************************************************************************步数
#define PEDOMETER_TEXT_STEP_X                       	2+52+52+4+4
#define PEDOMETER_TEXT_STEP_Y                       	16//48

#define PEDOMETER_NUMBER_STEP_X                       	PEDOMETER_TEXT_STEP_X//70
#define PEDOMETER_NUMBER_STEP_Y                       	PEDOMETER_TEXT_STEP_Y+16
//***************************************************************************************************行走长度
#define PEDOMETER_TEXT_DISTANCE_X                       	2
#define PEDOMETER_TEXT_DISTANCE_Y                       	48//64

#define PEDOMETER_NUMBER_DISTANCE_X                      	PEDOMETER_TEXT_DISTANCE_X//70
#define PEDOMETER_NUMBER_DISTANCE_Y                      	PEDOMETER_TEXT_DISTANCE_Y+16
//***************************************************************************************************消耗能量
#define PEDOMETER_TEXT_CONSUME_X                       	2+52+4
#define PEDOMETER_TEXT_CONSUME_Y                       	48//80

#define PEDOMETER_NUMBER_CONSUME_X                      	PEDOMETER_TEXT_CONSUME_X//70
#define PEDOMETER_NUMBER_CONSUME_Y                      	PEDOMETER_TEXT_CONSUME_Y+16
//***************************************************************************************************消耗时间
#define PEDOMETER_TEXT_TIMER_X                       	2+52+52+4+4
#define PEDOMETER_TEXT_TIMER_Y                       	48//96

#define PEDOMETER_NUMBER_TIMER_X                      	PEDOMETER_TEXT_TIMER_X//70
#define PEDOMETER_NUMBER_TIMER_Y                      	PEDOMETER_TEXT_TIMER_Y+16
//***************************************************************************************************消耗能率(Kcal/h)
#define PEDOMETER_TEXT_CONSUMEPHOUR_X                    2
#define PEDOMETER_TEXT_CONSUMEPHOUR_Y                    80//112

#define PEDOMETER_NUMBER_CONSUMEPHOUR_X                  PEDOMETER_TEXT_CONSUMEPHOUR_X//70
#define PEDOMETER_NUMBER_CONSUMEPHOUR_Y                  PEDOMETER_TEXT_CONSUMEPHOUR_Y+16
//***************************************************************************************************当前步频
#define PEDOMETER_TEXT_STEPPMINUTE_X                    2+52+52+4
#define PEDOMETER_TEXT_STEPPMINUTE_Y                    80//128

#define PEDOMETER_NUMBER_STEPPMINUTE_X                  PEDOMETER_TEXT_STEPPMINUTE_X//70
#define PEDOMETER_NUMBER_STEPPMINUTE_Y                  PEDOMETER_TEXT_STEPPMINUTE_Y+16
//***************************************************************************************************X轴读数//For test
#define PEDOMETER_TEXT_XNUMBER_X                       	2
#define PEDOMETER_TEXT_XNUMBER_Y                       	112//144

#define PEDOMETER_NUMBER_XNUMBER_X                      2+16
#define PEDOMETER_NUMBER_XNUMBER_Y                      PEDOMETER_TEXT_XNUMBER_Y
//***************************************************************************************************Y轴读数//For test
#define PEDOMETER_TEXT_YNUMBER_X                       	2+64+16
#define PEDOMETER_TEXT_YNUMBER_Y                       	112//144

#define PEDOMETER_NUMBER_YNUMBER_X                      2+64+16+16
#define PEDOMETER_NUMBER_YNUMBER_Y                      PEDOMETER_TEXT_YNUMBER_Y
//***************************************************************************************************
#else 
//***************************************************************************************************
#define PEDOMETER_TIMER_XSIZE                      		(11+2)*(6+2)
#define PEDOMETER_TIMER_YSIZE                      		19
#define PEDOMETER_TIMER_X                       		29
#define PEDOMETER_TIMER_Y                       		53+6
//***************************************************************************************************
#define PEDOMETER_NUMBER_STEP_X                       	18
#define PEDOMETER_NUMBER_STEP_Y                       	34+3
//***************************************************************************************************
#define PEDOMETER_NUMBER_CONSUME_X                      18
#define PEDOMETER_NUMBER_CONSUME_Y                      23+3
//***************************************************************************************************
#define PEDOMETER_NUMBER_DISTANCE_X                     91
#define PEDOMETER_NUMBER_DISTANCE_Y                     27+3
#define PEDOMETER_NUMBER_DISTANCE_XSIZE					8*(6)
#define PEDOMETER_NUMBER_DISTANCE_YSIZE					16
//***************************************************************************************************
#define PEDOMETER_NUMBER_BODY_WEIGHT_X                  80
#define PEDOMETER_NUMBER_BODY_WEIGHT_Y                  39-1
//***************************************************************************************************
#define PEDOMETER_NUMBER_STEP_SIZE_X                  	80
#define PEDOMETER_NUMBER_STEP_SIZE_Y                  	69-1
//***************************************************************************************************
#define PEDOMETER_NUMBER_TARGET_CONSUME_X               80
#define PEDOMETER_NUMBER_TARGET_CONSUME_Y               99-1

//***************************************************************************************************
#define PEDOMETER_SET_TITLE_X 			24    
#define PEDOMETER_SET_TITLE_Y           0+10
#define PEDOMETER_SET_WEIGHT_X 			10    
#define PEDOMETER_SET_WEIGHT_Y          35+6
#define PEDOMETER_SET_HIGHT_X 			10    
#define PEDOMETER_SET_HIGHT_Y           65+6
#define PEDOMETER_SET_CONSUME_X 		10    
#define PEDOMETER_SET_CONSUME_Y         95+6

#define PEDOMETER_MENU_DISP_STR_X      	(PEDOMETER_WEIGHT_DISP_X + 4)
#define PEDOMETER_MENU_DISP_DTR_Y      	(PEDOMETER_WEIGHT_DISP_Y + 6)
#define PEDOMETER_MENU_DISP_LINE       	16
#define PEDOMETER_CONSUME_BAR_X 		21//16    
#define PEDOMETER_CONSUME_BAR_Y         112
#define PEDOMETER_CONSUME_BAR_XSIZE 	119   
#define PEDOMETER_CONSUME_BAR_YSIZE     6

#endif


#endif

//***************************************************************************************************
/*
$Log: pedometer.h,v $

*
*/


⌨️ 快捷键说明

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