cancel
Showing results for 
Search instead for 
Did you mean: 

ItemSelectedCallback for scroll list is not called

OIrin.1
Associate II

Hello,

My GUI project developed with TouchGFX has got a screen with a scroll list. I want to be able to select an item from that scroll list. I used "Scroll Wheel and List Example" project as a reference as it supports item selection in the scroll list. But in my project the callback function that is called when an item is selected (ItemSelectedCallback) is not called. When I touch a desired item the list just starts trembling, trying to scroll according to micromovement of my finger on the touch panel, but there is no entrance into the selection callback.

Any help is much appreciated.

11 REPLIES 11

Here is my touch reading function:

int touchGetState (TS_State_t * state)
{
	int result = 0;
 
	uint8_t address = 0x5C;
	uint8_t data[10];
	data[0] = 64;
	result = HAL_I2C_Master_Transmit(&hi2c_touch, address << 1, data, 1, 100);
	if (HAL_OK == result)
	{
		HAL_Delay(2);
		HAL_I2C_Master_Receive(&hi2c_touch, address << 1, data, 8, 300);
	}
	state->TouchX = data[0] | (uint16_t) data[4] << 8;
	state->TouchY = data[1] | (uint16_t) data[5] << 8;
	if (state->TouchX || state->TouchY)
		result = 1;
	state->TouchDetected = result;
 
	return result;
}

and TouchGFX uses it the following way:

bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
{
    TS_State_t state;
    unsigned int time;
    touchGetState(&state);
    if (state.TouchDetected)
    {
        x = lastX = state.TouchX;
        y = lastY = state.TouchY;
        lastTime = HAL_GetTick();
        return true;
    }
 
    time = HAL_GetTick();
    if (((lastTime + 120) > time)
            && (lastX > 0) && (lastY > 0))
    {
        x = lastX;
        y = lastY;
        return true;
    }
 
    return false;
}

JTP1
Lead

Ok. What is type of touch panel IC ? Maybe you have notice that if

data[0] = 64;

result = HAL_I2C_Master_Transmit(&hi2c_touch, address << 1, data, 1, 100);

if (HAL_OK == result)

{

HAL_Delay(2);

HAL_I2C_Master_Receive(&hi2c_touch, address << 1, data, 8, 300);

}

state->TouchX = data[0] | (uint16_t) data[4] << 8;

state->TouchY = data[1] | (uint16_t) data[5] << 8;

Master_Transmit fails, you still get some weird coordinates since you set data to structure anyway. Maybe its better leave values like they are in this case, or then set zero, but not set some random value ?