Description
What MCU/Processor/Board and compiler are you using?
NXP EVK RT1064
Using MCUExpresso IDE from NXP
I have a 480p x 272p LCD touchscreen attached to the board, I have ran other programs that involve touch on it (and previous version of LVGL) and the display works perfectly as expected.
What do you want to achieve?
Touch events to work as expected.
What have you tried so far?
Implemented touch event handling and a test button in LVGL 5.2 (works)
Implemented touch event handling and a test button in LVGL 7.0.2 (does not work as expected)
Code to reproduce
void lv_port_indev_init(void)
{
lv_indev_drv_t indev_drv;
/*------------------
* Touchpad
* -----------------*/
/*Initialize your touchpad */
DEMO_InitTouch();
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = touchpad_read;
indev_touchpad = lv_indev_drv_register(&indev_drv);
}
static void DEMO_InitTouch(void)
{
status_t status;
lpi2c_master_config_t masterConfig = {0};
/*Clock setting for LPI2C*/
CLOCK_SetMux(kCLOCK_Lpi2cMux, TOUCH_LPI2C_CLOCK_SOURCE_SELECT);
CLOCK_SetDiv(kCLOCK_Lpi2cDiv, TOUCH_LPI2C_CLOCK_SOURCE_DIVIDER);
/*
* masterConfig.debugEnable = false;
* masterConfig.ignoreAck = false;
* masterConfig.pinConfig = kLPI2C_2PinOpenDrain;
* masterConfig.baudRate_Hz = 100000U;
* masterConfig.busIdleTimeout_ns = 0;
* masterConfig.pinLowTimeout_ns = 0;
* masterConfig.sdaGlitchFilterWidth_ns = 0;
* masterConfig.sclGlitchFilterWidth_ns = 0;
*/
LPI2C_MasterGetDefaultConfig(&masterConfig);
/* Change the default baudrate configuration */
masterConfig.baudRate_Hz = TOUCH_I2C_BAUDRATE;
/* Initialize the LPI2C master peripheral */
LPI2C_MasterInit(TOUCH_I2C, &masterConfig, TOUCH_I2C_CLOCK_FREQ);
/* Initialize touch panel controller */
status = FT5406_RT_Init(&touchHandle, TOUCH_I2C);
if (status != kStatus_Success)
{
PRINTF("Touch panel init failed\n");
assert(0);
}
}
// TEST BUTTON CODE
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
lv_obj_set_size(btn, 100, 50); /*Set its size*/
lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/
lv_obj_t * label = lv_label_create(btn, NULL); /*Add a label to the button*/
lv_label_set_text(label, "Button"); /*Set the labels text*/
...
void btn_event_cb(lv_obj_t * btn, lv_event_t event)
{
if(event == LV_EVENT_CLICKED) {
printf("Clicked\n");
}
}
Screenshot and/or video
When I click the button which does display perfectly, distortion occurs at the top of the screen.
The post template says to include a video but I cannot add links, so the link is broken up below to a video of me clicking the button and the distortion appearing. Remove the spaces.
streamable . c o m /15cfz7