27 #define DELAY_REACT 20
30 #define GRAD_SHOCK 350000
35 s32 TestingActive = 0;
36 s32 StartingFromResetOrShockCounter = 1000;
37 s32 TimeCounterForDoubleClick = 0;
38 s32 TimeLastShock = 0;
51 void MEMS_ChipSelect( u8 State );
52 u8 MEMS_SendByte( u8 byte );
53 u32 MEMS_ReadOutXY(
void );
54 void MEMS_WakeUp(
void );
76 IRQ
void MEMS_Handler(
void )
78 static s32 delta_time_ms = 0;
80 if ( StartingFromResetOrShockCounter )
82 StartingFromResetOrShockCounter--;
84 TimeCounterForDoubleClick++;
93 Gradient2 = ( s32 )GradX * ( s32 )GradX + ( s32 )GradY * ( s32 )GradY + ( s32 )GradZ * ( s32 )GradZ;
108 #define DELAY_BETWEEN_TWO_SHOCK 200
109 #define MAX_DELAY_FOR_DOUBLECLICK 800
111 delta_time_ms = (( TimeCounterForDoubleClick - TimeLastShock ) * 1000 ) / freqTIM2[
CurrentSpeed];
113 if ( delta_time_ms > DELAY_BETWEEN_TWO_SHOCK )
115 if ( delta_time_ms < MAX_DELAY_FOR_DOUBLECLICK )
120 StartingFromResetOrShockCounter = freqTIM2[
CurrentSpeed];
126 StartingFromResetOrShockCounter = 0;
128 TimeLastShock = TimeCounterForDoubleClick;
161 *pX = MEMS_Info.
OutX - XInit;
162 *pY = MEMS_Info.
OutY - YInit;
180 s16 sX = MEMS_Info.
OutX;
181 s16 sY = MEMS_Info.
OutY;
183 if ((( sX <= -MARGIN ) && ( sY <= 0 ) && ( sX <= sY ) ) ||
184 (( sX <= - MARGIN ) && ( sY > 0 ) && ( sX <= ( -sY ) ) ) )
189 else if ((( sY <= -MARGIN ) && ( sX <= 0 ) && ( sY <= sX ) ) ||
190 (( sY <= -MARGIN ) && ( sX > 0 ) && ( sY <= ( -sX ) ) ) )
195 else if ((( sX >= MARGIN ) && ( sY <= 0 ) && ( sX >= ( -sY ) ) ) ||
196 (( sX >= MARGIN ) && ( sY > 0 ) && ( sX >= sY ) ) )
201 else if ((( sY >= MARGIN ) && ( sX <= 0 ) && ( sY >= ( -sX ) ) ) ||
202 (( sY >= MARGIN ) && ( sX > 0 ) && ( sY >= sX ) ) )