Hi @pete-pjb,
Thank you for your suggestion, I’ll try to make it work, and see if there’s better performances,
in the DEMO of NXP there’s no ISR for the touch, and it’s working in polling and communication with touchpanel is called periodically (by the LVGL) to get the touch position and state by processing the i2C,
For me i Added an ISR_Handler and all what does is put the g_inputSignal to true, and it’s not processing i2C in isr_handler :
extern volatile bool g_InputSignal;
void GPIO_IRQHandler(void)
{
/* clear the interrupt status */
GPIO_PortClearInterruptFlags(BOARD_TOUCH_INT_GPIO, 1U << BOARD_TOUCH_INT_PIN);
/* Change state of switch. */
g_InputSignal = true;
SDK_ISR_EXIT_BARRIER;
}
and in the function called periodically by LVGL GT911_ReadRawTouchData i made a condtition if the g_InputSignal is true we need to read data from touchpanel and put a g_inputSignal to false
static status_t GT911_ReadRawTouchData(gt911_handle_t *handle, uint8_t *touchPointNum)
{
status_t status;
if (g_InputSignal)
{
status = handle->I2C_ReceiveFunc(handle->i2cAddr, GT911_REG_STAT, GT911_REG_ADDR_SIZE, >911Stat, 1);
if (kStatus_Success != status)
{
*touchPointNum = 0;
return status;
}
*touchPointNum = gt911Stat & GT911_STAT_POINT_NUMBER_MASK;
if (0U != (gt911Stat & GT911_STAT_BUF_MASK))
{
if (*touchPointNum > 0U)
{
status = handle->I2C_ReceiveFunc(handle->i2cAddr, GT911_REG_FIRST_POINT, GT911_REG_ADDR_SIZE,
(void *)handle->pointReg, (*touchPointNum) * sizeof(gt911_point_reg_t));
}
/* Must set the status register to 0 after read. */
gt911Stat = 0;
status = handle->I2C_SendFunc(handle->i2cAddr, GT911_REG_STAT, GT911_REG_ADDR_SIZE, >911Stat, 1);
}
return status;
}
What do you think about this ?
i would have many tasks to manage later, so i don’t know if it’s good for me to add another task just to handle touchpanel, while i can handle in the same task with LVGL.
I’ll try for sure to use what you suggested,
Thank you so much for your suggestion
Kind regards,
Zerba,