Skip to content

Conversation

kasjer
Copy link
Contributor

@kasjer kasjer commented Aug 23, 2025

This updates orientation and resolution for lvgl drivers:

  • Display drivers used incorrect direction for rotation for 90 and 270 degree. It was inconsistent with touch screen drivers resulting in swapped orientation.
  • Resistive touchscreen drivers used HOR_RES and VER_RES macros for ADC to LVGL coordinates conversions. Now those drivers use actual screen resolution since LVGL does not expect input drives to make conversion to rotation used by display.
  • There are multiply ST7789 displays that don't have 240x320 pixels (240x240, 76x284 and others). For those resolutions memory address needs to be corrected depending on orientation. Now driver by default adds offset as if visible pixels use middle of the RAM. It is still possible to specify X or Y offset that happens on some 240x240 displays where vertical offset should be set to 0

@kasjer kasjer force-pushed the kasjer/lvgl-fix-rotation branch 2 times, most recently from 0a1aec7 to 6051e0e Compare August 23, 2025 19:42
kasjer added 3 commits August 23, 2025 21:46
Driver is able to rotate screen by changing
how addresses are change when data is
transmitted.
For 90 and 270 degree rotation screen appeared
to rotate clock wise. Problem pops up when
touch screen is present and in those rotations
touch screen orientation which does not changed
did not correspond to display orientation.

Signed-off-by: Jerzy Kasenberg <[email protected]>
Driver converts values reported by xpt2046 (adc values)
and stmpe610 to screen coordinates.
It was using screen resolution reported by LV_HOR_RES
and LV_VER_RES but those values were already subject
to rotation conversion.

Input device is expected report values without rotation
conversion.

Now coordinates conversion is changed so touch screen
works in all 4 rotations.

Signed-off-by: Jerzy Kasenberg <[email protected]>
ST7789 had hardcoded configurations for few
resolutions (240x320, 240x240, 240x135)

There are other configurations available.

Now offsets are computed in runtime.
This also fixes rotation to be aligned
with other drivers.

Signed-off-by: Jerzy Kasenberg <[email protected]>
@kasjer kasjer force-pushed the kasjer/lvgl-fix-rotation branch from c99c6e3 to 5a4866d Compare August 23, 2025 19:46
@kasjer kasjer added skip-style-check Use for exceptional cases only LVGL LVGL related enhancement and removed skip-style-check Use for exceptional cases only labels Aug 23, 2025
@kasjer kasjer merged commit 355127f into apache:master Aug 28, 2025
46 of 48 checks passed
@kasjer kasjer deleted the kasjer/lvgl-fix-rotation branch August 28, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement LVGL LVGL related size/m skip-style-check Use for exceptional cases only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants