Hi Michael,
Thanks for your reply.
Since I'm not confident with arduino boards and their framework, I'll give you some more info on the subject at hand.
I'm developing on an Atmel SAM4sXplained Pro board (ATSAM4SD32C - Cortex M4) using bare metal gcc/g++.
first, when the FT5x06 raises the INT pin (by pulling it to low level), this code reads the registers:
m_pTwi->Read(FT5X06_TWI_ADDRESS, 0, 1, 3, (uint8_t*)&m_TouchData);
if(m_TouchData.TDStatus & 0x0F)
{
m_pTwi->Read(FT5X06_TWI_ADDRESS, 3, 1, ((m_TouchData.TDStatus) & 0x0F) * 6, (uint8_t*)&m_TouchData.TouchPoints);
(new SPg_TouchEvent(&m_TouchData, NULL))->InsertEvent();
}
The latency from the FT lowering the INT pin until reaching this code is approx. 160µS and m_pTwi->read is defined asvoid Read(const uint8_t& devAddr, const uint32_t& internalAddress, const uint8_t& internalAddressSize, uint16_t count, uint8_t* buffer);
The above code reads the actual touchdata for the number of touchpositions indicated in TD_STATUS.
The touchdata is then forwarded (via a messaging system) to this routine, decoding each touchposition :
void SPg_GUI::OnTouch(uint32_t value, void* pointer)
{
SPg_FT5X06::Data* pTouchData = (SPg_FT5X06::Data*)pointer;
if(pTouchData)
{
for(uint8_t i = 0; i < (pTouchData->TDStatus & 0x0F); i++)
{
SPg_FT5X06::TouchPointData TouchPoint = pTouchData->TouchPoints[i];
SPg_Point location((((TouchPoint.Touch1_XH & 0x0F) * 0x100) + TouchPoint.Touch1_XL), (((TouchPoint.Touch1_YH & 0x0F) * 0x100) + TouchPoint.Touch1_YL));
m_pTFT->DrawPixel(location, SPg_Color::BRIGHTGREEN);
switch(TouchPoint.Touch1_XH >> 6)
{
case 0: // Put Down
{
m_pMainFrame->FindTopmostFrameAt(location)->OnTouchDown(location);
break;
}
case 1: // Put Up
{
m_pMainFrame->FindTopmostFrameAt(location)->OnTouchUp(location);
break;
}
case 2: // Contact
{
m_pMainFrame->FindTopmostFrameAt(location)->OnTouchContact(location);
break;
}
default: // Reserved
{
__BKPT();
}
}
}
}
}
Well, I receive 'Put Down' events and 'Contact' events, but never a 'Put Up' event...
What am I doing wrong?
Thanks