I am going to have to work on the touch. But the display is up and running and that is important.
Their documentation really sucks and is very inaccurate I will say that much. I am finding that I have to read over the examples they give and hopefully those are correct. At least we are making progress.
Sorry about the typos. My keyboard needs to have the switches cleaned, it’s a process to do and I have been really lazy. I am going to bite the bullet and order an old school IBM model M keyboard. Those things were bulletproof. Getting tired of having to clean and or replace keyboards every month. I have 5 English Bulldogs so I have dust and dog fur and it really mucks up mechanical keyboards made today.
give this a go for the touch driver. see if it works for ya.
Sunton.zip (149.9 KB)
I fixed the typo with the backlight as well.
Yeah, the typo is fixed but now have another error.
C:/Users/welli/suntonTest5/main/main.c: In function 'indev_cb':
C:/Users/welli/suntonTest5/main/main.c:202:58: warning: dereferencing 'void *' pointer
202 | esp_lcd_touch_handle_t tp = (esp_lcd_touch_handle_t) *indev_drv->user_data;
| ^~~~~~~~~~~~~~~~~~~~~
C:/Users/welli/suntonTest5/main/main.c:202:33: error: invalid use of void expression
202 | esp_lcd_touch_handle_t tp = (esp_lcd_touch_handle_t) *indev_drv->user_data;
| ^
C:/Users/welli/suntonTest5/main/main.c: In function 'app_main':
C:/Users/welli/suntonTest5/main/main.c:402:33: error: initializer element is not constant
402 | static lv_indev_t * indev = lv_indev_drv_register(&indev_drv);
trying to get the touch driver to play nice
1 Like
Its building without errors now, but the touch is still not working
@kisvegabor
Any way you can take a peek at this board and see why the touch isn’t working. Maybe I am forgetting to do something with it.
Could you briefly summarize the problem?
The indev is not working. If you download the latest Sunton.zip file I attached a couple of posts back and do the unzipping that is needed to get to the main.c file. The indev callback function is near the bottom. I don’t believe a callback is even taking place. I am not that familiar with LVGL8.3 and I could have mucked something up.
After searching a lot online and putting some pieces together the code is now working. Had to make some changes on the indev_cb.
Now it looks like this:
void indev_cb(lv_indev_drv_t * indev_drv, lv_indev_data_t*data)
{
esp_lcd_touch_handle_t *tp = (esp_lcd_touch_handle_t *)indev_drv->user_data;
esp_lcd_touch_read_data(*tp);
uint16_t x[1];
uint16_t y[1];
uint16_t strength[1];
uint8_t point_num = 0;
//if (esp_lcd_touch_get_coordinates(*tp, &x, &y, &strength, &point_num, 1)) {
if (esp_lcd_touch_get_coordinates(*tp, x, y, strength, &point_num, 1)) {
data->point.x = x[0];
data->point.y = y[0];
data->state = LV_INDEV_STATE_PRESSED;
} else {
data->point.x = indev_data.point.x;
data->point.y = indev_data.point.y;
data->state = LV_INDEV_STATE_RELEASED;
}
indev_data.point.x = data->point.x;
indev_data.point.y = data->point.y;
indev_data.state = data->state;
}
So i had to be arrays being passed instead of a pointer to in integer. nothing too crazy.
It’s this that is misleading
//if (esp_lcd_touch_get_coordinates(*tp, &x, &y, &strength, &point_num, 1)) {
specifically the &, it means passing the address of… so you would use & if you declared them as integers. declaring them as an array you would not need to use the &