omap3530/beagle_drivers/byd_touch/common/controller.cpp
author Lukasz Forynski <lukasz.forynski@gmail.com>
Tue, 02 Nov 2010 00:33:23 +0000
branchBeagle_BSP_dev
changeset 95 450a8cf0c020
parent 85 d93b485c1325
permissions -rw-r--r--
updated byd touch controller handling. needs debugging and update.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
     1
// This component and the accompanying materials are made available
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
     2
// under the terms of the License "Eclipse Public License v1.0"
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
     3
// which accompanies this distribution, and is available
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
     4
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
     5
//
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
     6
// Initial Contributors:
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
     7
// lukasz.forynski@gmail.com
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
     8
//
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
     9
// Contributors:
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    10
//
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    11
// Description:
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    12
// omap3530/beagle_drivers/byd_touch/common/controller.cpp
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    13
//
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    14
#include <drivers/iic.h>
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    15
#include <drivers/iic_channel.h>
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    16
#include <assp/omap3530_assp/omap3530_gpio.h>
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    17
#include "controller.h"
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    18
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    19
//#define VERBOSE_DEBUG
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    20
#ifdef VERBOSE_DEBUG
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    21
#define LOG_FUNCTION_CALL Kern::Printf("%s()", __FUNCTION__)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    22
#else
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    23
#define LOG_FUNCTION_CALL
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    24
#endif
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    25
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    26
TTouchControllerInterface::TTouchControllerInterface() :
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    27
	iSpiTransactionHeader(KHeader),
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    28
	iSpiTxTransfer(TIicBusTransfer::EMasterWrite, KBufGranulatity, &iSpiWriteBuffer),
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    29
	iSpiRxTransfer(TIicBusTransfer::EMasterRead, KBufGranulatity, &iSpiReadBuffer),
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    30
	iSpiTransaction(&iSpiTransactionHeader, &iSpiTxTransfer)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    31
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    32
	// after all above - make the transaction full duplex using the Rx buffer
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    33
	iSpiTransaction.SetFullDuplexTrans(&iSpiRxTransfer);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    34
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    35
	// set buffer length only once..
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    36
	iSpiWriteBuffer.SetLength(iSpiWriteBuffer.MaxLength());
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    37
	iSpiReadBuffer.SetLength(iSpiReadBuffer.MaxLength());
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    38
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    39
	// and set SPI addressing / bus configuration
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    40
	iSpiBusId = 0;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    41
	SET_BUS_TYPE(iSpiBusId, DIicBusChannel::ESpi);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    42
	SET_CHAN_NUM(iSpiBusId, KSpiModule);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    43
	SET_SLAVE_ADDR(iSpiBusId, KSpiSlaveAddr);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    44
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    45
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    46
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    47
// Writes number of bytes stored in the write buffer - to the controller.
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    48
// aNumOfBytes specifies number of bytes including first byte of address.
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    49
// The write buffer should contain the data from index=1 and it's length should be set
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    50
// to number of registers to update + 1 (one byte for the address / command)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    51
TInt TTouchControllerInterface::WriteMultiple(TUint8 aStartAddress, TInt aNumBytes)
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    52
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    53
	LOG_FUNCTION_CALL;
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    54
	if(aNumBytes != iSpiWriteBuffer.Length())
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    55
		{
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    56
#ifdef VERBOSE_DEBUG
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    57
		Kern::Printf("Transfer buffers are not properly set, line: %d", __LINE__);
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    58
#endif
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    59
		return KErrArgument;
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    60
		}
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    61
	iSpiReadBuffer.SetLength(aNumBytes);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    62
	iSpiWriteBuffer[0] = KWriteCommand | (aStartAddress << 1);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    63
	return IicBus::QueueTransaction(iSpiBusId, &iSpiTransaction);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    64
	}
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    65
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    66
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    67
// Reads number of bytes and stores them into the read buffer
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    68
// aNumOfBytes specifies number of bytes (excluding first byte of address)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    69
// The read buffer will contain the received data starting from index=1 (TODO: consider MidTPtr)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    70
TInt TTouchControllerInterface::ReadMultiple(TUint8 aStartAddress, TInt aNumBytes)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    71
	{
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    72
	LOG_FUNCTION_CALL;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    73
	TInt r = KErrNone;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    74
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    75
	// if trying to read from address different that currently stored - first update the read register..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    76
	if(iCurrentReadStart != aStartAddress)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    77
		{
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    78
		r = Write(KMasterReadStartAddr, aStartAddress);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    79
		if(r != KErrNone)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    80
			{
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    81
			return r;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    82
			}
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    83
		iCurrentReadStart = aStartAddress;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    84
		}
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    85
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    86
	// make sure buffers are set to the requested size
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    87
	iSpiReadBuffer.SetLength(aNumBytes + 1);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    88
	iSpiWriteBuffer.SetLength(aNumBytes + 1);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    89
	iSpiWriteBuffer[0] = KReadCommand;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    90
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    91
	return IicBus::QueueTransaction(iSpiBusId, &iSpiTransaction);
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    92
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    93
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    94
TInt TTouchControllerInterface::Write(TUint8 aRegAddress, TUint8 aValue)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    95
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
    96
	LOG_FUNCTION_CALL;
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    97
	iSpiWriteBuffer.SetLength(2);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    98
	iSpiReadBuffer.SetLength(2);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
    99
	iSpiWriteBuffer[0] = KWriteCommand | (aRegAddress << 1);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   100
	iSpiWriteBuffer[1] = aValue;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   101
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   102
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   103
#ifdef VERBOSE_DEBUG
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   104
	for (int i = 0; i < iSpiWriteBuffer.Length(); i++)
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   105
		Kern::Printf("WR0[i]: %d", iSpiWriteBuffer[i]);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   106
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   107
	for (int i = 0; i < iSpiReadBuffer.Length(); i++)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   108
		Kern::Printf("W0[i]: %d", iSpiReadBuffer[i]);
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   109
#endif
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   110
	TInt r = IicBus::QueueTransaction(iSpiBusId, &iSpiTransaction);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   111
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   112
#ifdef VERBOSE_DEBUG
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   113
	for (int i = 0; i < iSpiReadBuffer.Length(); i++)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   114
		Kern::Printf("W1[i]: %d", iSpiReadBuffer[i]);
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   115
#endif
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   116
	return r;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   117
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   118
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   119
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   120
TInt TTouchControllerInterface::Read(TUint8 aRegAddress, TUint8& aValue)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   121
	{
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   122
	LOG_FUNCTION_CALL;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   123
	TInt r = ReadMultiple(aRegAddress, 2);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   124
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   125
	if(r == KErrNone)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   126
		{
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   127
		aValue = iSpiReadBuffer[1];
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   128
		}
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   129
	return r;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   130
	}
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   131
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   132
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   133
//(TODO: consider MidTPtr)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   134
inline TDes& TTouchControllerInterface::ReadBuff()
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   135
	{
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   136
	return iSpiReadBuffer;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   137
	}
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   138
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   139
//(TODO: consider MidTPtr)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   140
inline TDes& TTouchControllerInterface::WriteBuff()
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   141
	{
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   142
	return iSpiWriteBuffer;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   143
	}
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   144
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   145
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   146
// Touch controller implementation
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   147
TouchController::TouchController() :
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   148
	iCallback(NULL)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   149
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   150
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   151
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   152
TouchController::TouchController(TVoidCallback aCallback) :
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   153
	iCallback(aCallback)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   154
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   155
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   156
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   157
TInt TouchController::HardReset()
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   158
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   159
	LOG_FUNCTION_CALL;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   160
	TInt r = GPIO::SetPinMode(KResetPin, GPIO::EEnabled);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   161
	if(r == KErrNone)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   162
		{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   163
		r = GPIO::SetPinDirection(KResetPin, GPIO::EOutput);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   164
		if(r == KErrNone)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   165
			{
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   166
#ifdef RESET_LOW
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   167
			GPIO::SetOutputState(KResetPin, GPIO::ELow);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   168
#else
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   169
			GPIO::SetOutputState(KResetPin, GPIO::EHigh);
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   170
#endif
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   171
			Kern::NanoWait(25000); // should be > 10us
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   172
#ifdef RESET_LOW
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   173
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   174
			GPIO::SetOutputState(KResetPin, GPIO::EHigh);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   175
#else
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   176
			GPIO::SetOutputState(KResetPin, GPIO::ELow);
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   177
#endif
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   178
			}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   179
		}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   180
	return r;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   181
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   182
TInt TouchController::SoftReset()
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   183
	{
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   184
	return iInterface.Write(KControl_0, KControl_0_SWRST);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   185
	}
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   186
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   187
TInt TouchController::Configure(TTouchMode aMode)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   188
	{
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   189
	LOG_FUNCTION_CALL;
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   190
	TDes& writeBuffer = iInterface.WriteBuff();
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   191
	writeBuffer.SetLength(14);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   192
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   193
	// value for KControl_0 register in writeBuffer[1]
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   194
	switch(aMode)
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   195
		{
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   196
		case EModeSingle:
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   197
			writeBuffer[1] = KControl_0_MODE_SINGLE;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   198
			break;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   199
		case EModeMulti:
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   200
			writeBuffer[1] = KControl_0_MODE_MULTI;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   201
			break;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   202
		case EModeGesture:
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   203
			writeBuffer[1] = KControl_0_MODE_GESTURE;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   204
			break;
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   205
		}
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   206
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   207
//	const TUint8 KWindowXStart_Msb = 0x4; // R/W
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   208
//	const TUint8 KWindowXStart_Lsb = 0x5; // R/W
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   209
//	const TUint8 KWindowXStop_Msb  = 0x6; // R/W
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   210
//	const TUint8 KWindowXStop_Lsb  = 0x7; // R/W
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   211
//	const TUint8 KWindowYStart_Msb = 0x8; // R/W
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   212
//	const TUint8 KWindowYStart_Lsb = 0x9; // R/W
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   213
//	const TUint8 KWindowYStop_Msb  = 0xa; // R/W
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   214
//	const TUint8 KWindowYStop_Lsb  = 0xb; // R/W
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   215
//	const TUint8 KMasterReadStartAddr = 0xc; // R/W
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   216
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   217
	writeBuffer[2] = (TInt8)(KControl_1_PAT_100 | KControl_1_PVT_200); // KControl_1 // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   218
	writeBuffer[3] = (TInt8)(KNumColumns << KControl_2_C_SHIFT);       // KControl_2 // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   219
	writeBuffer[4] = (TInt8)(KNumRows    << KControl_3_R_SHIFT);       // KControl_3 // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   220
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   221
	writeBuffer[5] = 0; // KWindowXStart_Msb // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   222
	writeBuffer[6] = 0; // KWindowXStart_Lsb // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   223
	writeBuffer[7] = 0; // KWindowXStop_Msb // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   224
	writeBuffer[8] = 0; // KWindowXStop_Lsb // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   225
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   226
	writeBuffer[9] = 0; // KWindowYStart_Msb // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   227
	writeBuffer[10] = 0; // KWindowYStart_Lsb // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   228
	writeBuffer[11] = 0; // KWindowYStop_Msb // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   229
	writeBuffer[12] = 0; // KWindowYStop_Lsb // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   230
	writeBuffer[13] = 0; // KMasterReadStartAddr // TODO: update these values..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   231
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   232
	return iInterface.WriteMultiple(KControl_0, 14);
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   233
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   234
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   235
TInt TouchController::SetTouchMode(TTouchMode aMode)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   236
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   237
	LOG_FUNCTION_CALL;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   238
	iCtrlRegsCache[0] &= ~KControl_0_MODE_MASK; // clear all mode bits
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   239
	switch(aMode)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   240
		{
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   241
		case EModeSingle:
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   242
			iCtrlRegsCache[0] |= KControl_0_MODE_SINGLE;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   243
			break;
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   244
		case EModeMulti:
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   245
			iCtrlRegsCache[0] |= KControl_0_MODE_MULTI;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   246
			break;
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   247
		case EModeGesture:
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   248
			iCtrlRegsCache[0] |= KControl_0_MODE_GESTURE;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   249
			break;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   250
		}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   251
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   252
	return iInterface.Write(KControl_0, iCtrlRegsCache[0]);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   253
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   254
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   255
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   256
TInt TouchController::SetResolution(TResolution aResolution)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   257
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   258
	LOG_FUNCTION_CALL;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   259
	iCtrlRegsCache[0] &= ~KControl_0_RM_12; // clear all mode bits
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   260
	if(aResolution == ERes12Bits)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   261
		{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   262
		iCtrlRegsCache[0] |= KControl_0_RM_12; // set bit
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   263
		}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   264
	return iInterface.Write(KControl_0, iCtrlRegsCache[0]);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   265
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   266
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   267
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   268
TInt TouchController::SetLongerSamplingRate(TUint aRate)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   269
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   270
	LOG_FUNCTION_CALL;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   271
	iCtrlRegsCache[0] &= ~KControl_0_LST_MASK; // clear bits..
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   272
	iCtrlRegsCache[0] |= aRate & KControl_0_LST_MASK; // set new value..
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   273
	return iInterface.Write(KControl_0, iCtrlRegsCache[0]);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   274
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   275
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   276
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   277
TInt TouchController::SetIrqActiveTime(TUint aIrqActiveTime)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   278
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   279
	LOG_FUNCTION_CALL;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   280
	iCtrlRegsCache[1] &= ~KControl_1_PAT_MASK; // clear bits..
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   281
	iCtrlRegsCache[1] |= (aIrqActiveTime << KControl_1_PAT_SHIFT) & KControl_1_PAT_MASK; // set new value..
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   282
	return iInterface.Write(KControl_1, iCtrlRegsCache[1]);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   283
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   284
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   285
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   286
TInt TouchController::SetPanelVoltageStabTime(TUint aVoltageStabilizationTime)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   287
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   288
	LOG_FUNCTION_CALL;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   289
	iCtrlRegsCache[1] &= ~KControl_1_PVT_MASK; // clear bits..
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   290
	iCtrlRegsCache[1] |= (aVoltageStabilizationTime << KControl_1_PVT_SHIFT) & KControl_1_PVT_MASK; // set new value..
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   291
	return iInterface.Write(KControl_1, iCtrlRegsCache[1]);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   292
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   293
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   294
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   295
TInt TouchController::SetNumberOfColumns(TUint aNumberOfColumns)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   296
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   297
	LOG_FUNCTION_CALL;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   298
	iCtrlRegsCache[2] &= ~KControl_2_C_MASK; // clear bits..
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   299
	iCtrlRegsCache[2] |= (aNumberOfColumns << KControl_2_C_SHIFT) & KControl_2_C_MASK;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   300
	return iInterface.Write(KControl_2, iCtrlRegsCache[2]);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   301
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   302
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   303
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   304
TInt TouchController::SetNumberOfRows(TUint aNumberOfRows)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   305
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   306
	LOG_FUNCTION_CALL;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   307
	iCtrlRegsCache[3] &= ~KControl_3_R_SHIFT; // clear bits..
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   308
	iCtrlRegsCache[3] |= (aNumberOfRows << KControl_3_R_SHIFT) & KControl_3_R_MASK; // set new value..
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   309
	return iInterface.Write(KControl_3, iCtrlRegsCache[3]);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   310
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   311
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   312
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   313
TInt TouchController::EnableWindowMode(TPoint aStart, TPoint aStop)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   314
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   315
	LOG_FUNCTION_CALL;
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   316
	TDes& writeBuffer = iInterface.WriteBuff();
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   317
	writeBuffer.SetLength(9);
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   318
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   319
	// setup window points
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   320
	writeBuffer[0] = KWriteCommand | (KWindowXStart_Msb << 1); // address of first register to write..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   321
	writeBuffer[1] = (TUint8)(aStart.iX >> 8); // KWindowXStart_Msb
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   322
	writeBuffer[2] = (TUint8)(aStart.iX);      // KWindowXStart_Lsb
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   323
	writeBuffer[3] = (TUint8)(aStop.iX >> 8);  // KWindowXStop_Msb
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   324
	writeBuffer[4] = (TUint8)(aStop.iX);       // KWindowXStop_Lsb
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   325
	writeBuffer[5] = (TUint8)(aStart.iY >> 8); // KWindowYStart_Msb
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   326
	writeBuffer[6] = (TUint8)(aStart.iY);      // KWindowYStart_Lsb
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   327
	writeBuffer[7] = (TUint8)(aStop.iY >> 8);  // KWindowYStop_Msb
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   328
	writeBuffer[8] = (TUint8)(aStop.iY);       // KWindowYStop_Lsb
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   329
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   330
	return iInterface.WriteMultiple(KWindowXStart_Msb, 9);
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   331
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   332
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   333
TInt TouchController::DisableWindowMode()
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   334
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   335
	LOG_FUNCTION_CALL;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   336
	iCtrlRegsCache[1] &= ~KControl_1_WS; // clear enable bit..
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   337
	return iInterface.Write(KControl_1, iCtrlRegsCache[1]);
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   338
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   339
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   340
TInt TouchController::NumOfTouches()
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   341
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   342
	TUint8 val = 0;
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   343
	TInt r = iInterface.Read(KTouchNumberAndType, val);
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   344
	if (r == KErrNone)
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   345
		{
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   346
		r = val;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   347
		}
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   348
	return r;
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   349
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   350
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   351
TInt TouchController::GetMeasurements(TPoint* aPoints, TInt& aNumPoints)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   352
	{
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   353
	LOG_FUNCTION_CALL;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   354
	TInt r = KErrArgument;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   355
	TInt num_points = 0;
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   356
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   357
	if(aPoints)
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   358
		{
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   359
		r = iInterface.ReadMultiple(KTouchNumberAndType, 14);
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   360
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   361
		if(r == KErrNone)
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   362
			{
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   363
			TDes& readBuffer = iInterface.ReadBuff();
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   364
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   365
			// check how many points is there to read..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   366
			TUint8 val = readBuffer[1]; // TODO: update this if MidTPtr could be used..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   367
	//		Kern::Printf("KTouchNumberAndType %x", val);
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   368
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   369
			// if in multi mode - read all received, but only up to one otherwise..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   370
			num_points = val & (val & KTouchNumberAndType_MULTI ? KTouchNumberAndType_TouchNMask : 1);
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   371
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   372
			// read the coordinates..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   373
			for (TInt i = 0; i < num_points; i++) // if anything was touched at all..
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   374
				{
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   375
				// get X coordinate
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   376
				aPoints[i].iX |= TInt(readBuffer[(i << 2) + 1] << 8); // X_H
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   377
				aPoints[i].iX =  TInt(readBuffer[(i << 2) + 2]);      // X_L
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   378
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   379
				// get Y coordinate
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   380
				aPoints[i].iY |= TInt(readBuffer[(i << 2) + 3] << 8); // Yx_H
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   381
				aPoints[i].iY =  TInt(readBuffer[(i << 2) + 4]);      // Y_L
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   382
				}
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   383
95
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   384
			aNumPoints = num_points;
450a8cf0c020 updated byd touch controller handling. needs debugging and update.
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 85
diff changeset
   385
			}
85
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   386
		}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   387
	return r;
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   388
	}
d93b485c1325 updated SPI. Added template touch (byd_touch) -WORKING version,does not work-needs update as I missunderstood how the touchcontroller(chip) works. Submitting in order to share whatever there was-prior to going for holiday
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
diff changeset
   389