19 #include <e32def.h> |
19 #include <e32def.h> |
20 |
20 |
21 |
21 |
22 // controller specific constants.. |
22 // controller specific constants.. |
23 const TUint KMaxNumPoints = 3; |
23 const TUint KMaxNumPoints = 3; |
|
24 |
|
25 |
|
26 const TInt KNumColumns = 0x4; // TODO update these values.. |
|
27 const TInt KNumRows = 0x4; |
|
28 |
|
29 |
24 typedef void (*TVoidCallback) (TAny*); |
30 typedef void (*TVoidCallback) (TAny*); |
25 |
31 |
26 |
32 |
27 // spi specific constants.. |
33 // spi specific constants.. |
28 const TUint KSpiPacketLength = 4; |
34 const TUint KMaxPacketLength = 16; |
29 const TUint KStartByte = 0x56 << 1; |
35 const TUint KStartByte = 0x80; |
30 const TUint KWrite = 0; |
36 const TUint KWrite = 0; |
31 const TUint KRead = 1; |
37 const TUint KRead = 1; |
32 const TUint KReadCommand = KStartByte | KRead; |
38 const TUint KReadCommand = KStartByte | KRead; |
33 const TUint KWriteCommand = KStartByte; |
39 const TUint KWriteCommand = KStartByte; |
34 const TUint KBufGranulatity = 8; |
40 const TUint KBufGranulatity = 8; |
59 class TTouchControllerInterface |
65 class TTouchControllerInterface |
60 { |
66 { |
61 public: |
67 public: |
62 inline TTouchControllerInterface(); |
68 inline TTouchControllerInterface(); |
63 inline TInt Read(TUint8 aRegAddress, TUint8& aValue); |
69 inline TInt Read(TUint8 aRegAddress, TUint8& aValue); |
|
70 inline TInt ReadMultiple(TUint8 aStartAddress, TInt aNumBytes); |
64 inline TInt Write(TUint8 aRegAddress, TUint8 aValue); |
71 inline TInt Write(TUint8 aRegAddress, TUint8 aValue); |
65 inline TInt Write(TUint8 aRegAddress, TUint8* aValues, TInt aNumOfItems); |
72 inline TInt WriteMultiple(TUint8 aStartAddress, TInt aNumBytes); |
|
73 inline TDes& ReadBuff(); |
|
74 inline TDes& WriteBuff(); |
66 |
75 |
67 |
76 |
68 private: |
77 private: |
|
78 TInt iCurrentReadStart; |
69 // SPI duplex transaction with two transfers for each direction |
79 // SPI duplex transaction with two transfers for each direction |
70 TPckgBuf<TConfigSpiV01> iSpiTransactionHeader; |
80 TPckgBuf<TConfigSpiV01> iSpiTransactionHeader; |
71 TBuf8<KSpiPacketLength> iSpiWriteBuffer; |
81 TBuf8<KMaxPacketLength> iSpiWriteBuffer; |
72 TBuf8<KSpiPacketLength> iSpiReadBuffer; |
82 TBuf8<KMaxPacketLength> iSpiReadBuffer; |
73 TIicBusTransfer iSpiTxTransfer; |
83 TIicBusTransfer iSpiTxTransfer; |
74 TIicBusTransfer iSpiRxTransfer; |
84 TIicBusTransfer iSpiRxTransfer; |
75 TIicBusTransaction iSpiTransaction; |
85 TIicBusTransaction iSpiTransaction; |
76 TInt iSpiBusId; |
86 TInt iSpiBusId; |
77 }; |
87 }; |
107 TouchController(TVoidCallback aCallback); |
117 TouchController(TVoidCallback aCallback); |
108 |
118 |
109 |
119 |
110 TInt HardReset(); |
120 TInt HardReset(); |
111 TInt SoftReset(); |
121 TInt SoftReset(); |
|
122 TInt Configure(TTouchMode aMode); |
112 TInt SetTouchMode(TTouchMode aMode); |
123 TInt SetTouchMode(TTouchMode aMode); |
113 TInt SetResolution(TResolution aResolution); |
124 TInt SetResolution(TResolution aResolution); |
114 TInt SetLongerSamplingRate(TUint aRate); |
125 TInt SetLongerSamplingRate(TUint aRate); |
115 TInt SetIrqActiveTime(TUint aIrqActiveTime); |
126 TInt SetIrqActiveTime(TUint aIrqActiveTime); |
116 TInt SetPanelVoltageStabTime(TUint aVoltageStabilizationTime); |
127 TInt SetPanelVoltageStabTime(TUint aVoltageStabilizationTime); |