author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 09 Jun 2010 11:10:19 +0300 | |
branch | RCL_3 |
changeset 36 | bbf8bed59bcb |
parent 0 | a41df078684a |
permissions | -rw-r--r-- |
36
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1 |
// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 2 |
// All rights reserved. |
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32\include\drivers\xyin.h |
|
15 |
// Generic digitiser driver header |
|
16 |
// |
|
17 |
// |
|
18 |
||
19 |
/** |
|
20 |
@file |
|
21 |
@internalComponent |
|
22 |
*/ |
|
23 |
||
24 |
#ifndef __M32XYIN_H__ |
|
25 |
#define __M32XYIN_H__ |
|
26 |
#include <kernel/kpower.h> |
|
27 |
#include <platform.h> |
|
28 |
#include <e32hal.h> |
|
29 |
||
36
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
30 |
|
0 | 31 |
#ifdef _DEBUG |
32 |
//#define __DIGITISER_DEBUG1__ |
|
33 |
//#define __DIGITISER_DEBUG2__ |
|
34 |
#endif |
|
35 |
#ifdef __DIGITISER_DEBUG1__ |
|
36 |
#define __KTRACE_XY1(s) s; |
|
37 |
#else |
|
38 |
#define __KTRACE_XY1(s) |
|
39 |
#endif |
|
40 |
#ifdef __DIGITISER_DEBUG2__ |
|
41 |
#define __KTRACE_XY2(s) s; |
|
42 |
#else |
|
43 |
#define __KTRACE_XY2(s) |
|
44 |
#endif |
|
45 |
||
46 |
/** |
|
47 |
@internalComponent |
|
48 |
*/ |
|
49 |
const TInt KMaxXYSamples=4; |
|
50 |
||
51 |
/** |
|
52 |
@publishedPartner |
|
53 |
@released |
|
54 |
*/ |
|
55 |
struct SDigitiserConfig |
|
56 |
{ |
|
57 |
TInt iPenDownDiscard; // number of samples to discard on entering the detection volume (area if 2 dimensional) |
|
58 |
TInt iPenUpDiscard; // number of samples to discard on leaving the detection volume (area if 2 dimensional) |
|
59 |
TInt iDriveXRise; // number of milliseconds to wait when driving horizontal edges |
|
60 |
TInt iDriveYRise; // number of milliseconds to wait when driving vertical edges |
|
61 |
TInt iMinX; // minimum valid X value |
|
62 |
TInt iMaxX; // maximum valid X value |
|
63 |
TInt iSpreadX; // maximum valid X spread |
|
64 |
TInt iMinY; // minimum valid Y value |
|
65 |
TInt iMaxY; // maximum valid Y value |
|
66 |
TInt iSpreadY; // maximum valid Y spread |
|
67 |
TInt iMaxJumpX; // maximum X movement per sample (pixels) |
|
68 |
TInt iMaxJumpY; // maximum Y movement per sample (pixels) |
|
69 |
TInt iAccThresholdX; // accumulated offset in pixels to cause movement in X direction |
|
70 |
TInt iAccThresholdY; // accumulated offset in pixels to cause movement in Y direction |
|
71 |
TInt iNumXYSamples; // number of samples to average |
|
72 |
TBool iDisregardMinMax; // TRUE if we want to disregard minimum and maximum |
|
73 |
}; |
|
74 |
||
75 |
/** |
|
76 |
@publishedPartner |
|
77 |
@prototype |
|
78 |
*/ |
|
79 |
struct SDigitiserConfigV01 |
|
80 |
{ |
|
81 |
SDigitiserConfig i2dConfig; |
|
82 |
TInt iMinZ; // minimum valid Z value (distance to screen): 0 when lighlty touching (no pressure applied) |
|
83 |
TInt iMaxZ; // maximum valid Z value: positive for distance to screen, negative for pressure |
|
84 |
TInt iSpreadZ; // maximum valid Z spread (in distance to screen units) |
|
85 |
TInt iMaxJumpZ; // maximum Z movement per sample (in distance to screen units) |
|
86 |
TInt iAccThresholdX; // accumulated offset in distance to screen units to cause movement in Z direction |
|
87 |
}; |
|
88 |
||
89 |
/** |
|
90 |
@publishedPartner |
|
91 |
@released |
|
92 |
*/ |
|
93 |
NONSHARABLE_CLASS(DDigitiser) : public DPowerHandler |
|
94 |
{ |
|
95 |
public: |
|
96 |
/** |
|
97 |
@internalComponent |
|
98 |
*/ |
|
99 |
enum TState |
|
100 |
{ |
|
101 |
EIdle=0, // waiting for pen to go down |
|
102 |
EDiscardOnPenDown, // discarding just after pen down |
|
103 |
EBufferFilling, // buffer filling with samples |
|
104 |
EBufferFull, // delay line is now full |
|
105 |
EPenDown, // pen-down event has been delivered |
|
106 |
}; |
|
107 |
public: |
|
108 |
// initialisation |
|
109 |
static DDigitiser* New(); |
|
110 |
DDigitiser(); |
|
111 |
TInt Create(); |
|
112 |
virtual TInt DoCreate()=0; |
|
113 |
public: |
|
114 |
// signals from hardware-dependent code |
|
115 |
void RawSampleValid(); |
|
116 |
void PenUp(); |
|
117 |
public: |
|
118 |
// signals to hardware-dependent code |
|
119 |
virtual void WaitForPenDown()=0; |
|
120 |
virtual void WaitForPenUp()=0; |
|
121 |
virtual void WaitForPenUpDebounce()=0; |
|
122 |
virtual void DigitiserOn()=0; |
|
123 |
virtual void DigitiserOff()=0; |
|
124 |
public: |
|
125 |
// machine-configuration related things |
|
126 |
virtual TInt DigitiserToScreen(const TPoint& aDigitiserPoint, TPoint& aScreenPoint)=0; |
|
127 |
virtual void ScreenToDigitiser(TInt& aX, TInt& aY)=0; |
|
128 |
virtual TInt SetXYInputCalibration(const TDigitizerCalibration& aCalibration)=0; |
|
129 |
virtual TInt CalibrationPoints(TDigitizerCalibration& aCalibration)=0; |
|
130 |
virtual TInt SaveXYInputCalibration()=0; |
|
131 |
virtual TInt RestoreXYInputCalibration(TDigitizerCalibrationType aType)=0; |
|
132 |
virtual void DigitiserInfo(TDigitiserInfoV01& aInfo)=0; |
|
133 |
public: |
|
134 |
// Generic stuff |
|
135 |
/** |
|
136 |
@internalComponent |
|
137 |
*/ |
|
138 |
void ProcessRawSample(); |
|
139 |
/** |
|
140 |
@internalComponent |
|
141 |
*/ |
|
142 |
void ProcessPenUp(); |
|
143 |
/** |
|
144 |
@internalComponent |
|
145 |
*/ |
|
146 |
TBool SamplesToPoint(TPoint& aPoint); |
|
147 |
/** |
|
148 |
@internalComponent |
|
149 |
*/ |
|
150 |
TInt DelayAndConvertSample(const TPoint& aSample, TPoint& aScreenPoint); |
|
151 |
/** |
|
152 |
@internalComponent |
|
153 |
*/ |
|
154 |
void IssuePenDownEvent(); |
|
155 |
/** |
|
156 |
@internalComponent |
|
157 |
*/ |
|
158 |
void IssuePenUpEvent(); |
|
159 |
void IssuePenMoveEvent(const TPoint& aPoint); |
|
160 |
virtual void FilterPenMove(const TPoint& aPoint)=0; |
|
161 |
virtual void ResetPenMoveFilter()=0; |
|
162 |
/** |
|
163 |
@internalComponent |
|
164 |
*/ |
|
165 |
virtual TInt HalFunction(TInt aFunction, TAny* a1, TAny* a2); |
|
166 |
/** |
|
167 |
@internalComponent |
|
168 |
*/ |
|
169 |
void HandleMsg(TMessageBase* aMsg); |
|
170 |
public: |
|
171 |
TDfcQue* iDfcQ; |
|
172 |
TMessageQue iMsgQ; |
|
173 |
TDfc iSampleDfc; // called when a raw sample is available |
|
174 |
TDfc iPenUpDfc; // called when the pen goes up |
|
175 |
TInt iX[KMaxXYSamples]; // raw X samples from hardware |
|
176 |
TInt iY[KMaxXYSamples]; // raw Y samples from hardware |
|
177 |
SDigitiserConfig iCfg; // configuration |
|
178 |
TInt iBufferIndex; // delay line index |
|
179 |
TPoint* iBuffer; // delay line for samples |
|
180 |
TPoint iLastPos; // last pen position |
|
181 |
TState iState; |
|
182 |
TInt iCount; |
|
183 |
TUint8 iPointerOn; |
|
36
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
184 |
TInt iOrientation; // HALData::TDigitizerOrientation |
0 | 185 |
}; |
186 |
||
187 |
||
188 |
||
189 |
#endif |