@ Dat - Still the same results.

This is complete code for touch controller and results of “Debug.Print(string.Concat(“i=”, i, " first=”, first, " X{", x, “} Y{”, y, “} status=”, status));" on the end of OnTouchEvent. The result of the “(first & 0xC0) >> 6)” always 0

```
public class CapacitiveTouchController
{
private InterruptPort touchInterrupt;
private I2CDevice i2cBus;
private I2CDevice.I2CTransaction[] transactions;
private byte[] addressBuffer;
private byte[] resultBuffer;
private static CapacitiveTouchController _this;
public static void Initialize(Cpu.Pin PortId)
{
if (_this == null)
_this = new CapacitiveTouchController(PortId);
}
private CapacitiveTouchController()
{
}
private CapacitiveTouchController(Cpu.Pin portId)
{
transactions = new I2CDevice.I2CTransaction[2];
resultBuffer = new byte[1];
addressBuffer = new byte[1];
i2cBus = new I2CDevice(new I2CDevice.Configuration(0x38, 400));
touchInterrupt = new InterruptPort(portId, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);
touchInterrupt.OnInterrupt += (a, b, c) => OnTouchEvent();
}
private void OnTouchEvent()
{
for (var i = 0; i < 5; i++)
{
var first = ReadRegister((byte)(3 + i * 6));
var x = ((first & 0x0F) << 8) + ReadRegister((byte)(4 + i * 6));
var y = ((ReadRegister((byte)(5 + i * 6)) & 0x0F) << 8) + ReadRegister((byte)(6 + i * 6));
if (x == 4095 && y == 4095)
return; // break;
var status = first >> 6;
if (((first & 0xC0) >> 6) == 1)
GlideTouch.RaiseTouchUpEvent(null, new GHI.Glide.TouchEventArgs(new GHI.Glide.Geom.Point(x, y)));
else
GlideTouch.RaiseTouchDownEvent(null, new GHI.Glide.TouchEventArgs(new GHI.Glide.Geom.Point(x, y)));
Debug.Print(string.Concat("i=", i, " first=", first, " X{", x, "} Y{", y, "} status=", status));
}
}
private byte ReadRegister(byte address)
{
I2CDevice.I2CTransaction[] my_transactions = new I2CDevice.I2CTransaction[1];
addressBuffer[0] = address;
my_transactions[0] = I2CDevice.CreateWriteTransaction(addressBuffer);
if (i2cBus.Execute(my_transactions, 1000) != 0)
{
my_transactions[0] = I2CDevice.CreateReadTransaction(resultBuffer);
if (i2cBus.Execute(my_transactions, 1000) != 0)
{
return this.resultBuffer[0];
}
}
return 0;
}
//private byte ReadRegister(byte address)
//{
// this.addressBuffer[0] = address;
// this.transactions[0] = I2CDevice.CreateWriteTransaction(_this.addressBuffer);
// this.transactions[1] = I2CDevice.CreateReadTransaction(_this.resultBuffer);
// this.i2cBus.Execute(_this.transactions, 1000);
// return this.resultBuffer[0];
//}
}
```

Debug.Print(string.Concat(“i=”, i, " first=", first, " X{", x, “} Y{”, y, “} status=”, status)); results for a single tap:

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{518} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1280} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2843} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0

i=0 first=3 X{772} Y{1286} status=0

i=1 first=9 X{2314} Y{2828} status=0

i=2 first=15 X{3856} Y{274} status=0

i=3 first=21 X{1302} Y{1816} status=0

i=4 first=27 X{2844} Y{3358} status=0