• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

CYD screen size and rotation

Q&A Forum › Category: Other › CYD screen size and rotation
0 Vote Up Vote Down
howard lewis asked 6 months ago

Another question about CYD and the tutorials/eBook for LVGL
You always set the screen size as 240 wide and 320 tall. That makes me think the screen would then be in portrait orientation. But the text and buttons are always shown with the screen in landscape mode (as I would expect).
I am trying to wrap my head around is the screen rotated 90 degrees in the code?
Further I am trying to get my touch rotation correct, but I have no idea where 0,0 should be and which way is positive for each axis.
here is what the coordinates are for each corner in all 4 different rotations.
rotation 0
27,273       30,15
      Turn On
       Toggle
205,276      212,8
———————————–
Rotation 1
199,257     15,273
       Turn ON
        Toggle
208,28       13,22
———————————–
rotation 2
203,28     211,288
        Turn On
        Toggle
26,23          27,290
———————————–
Rotation 3
25,29        222,26
       Turn On
         Toggle
24,277      220,271
———————————–
As you can see, rotation 0 and 2 seem to have X as the vertical direction and Y as the horizontal axis. Sorry I am sure there is a simple explanation so that I will understand it, but it escapes me right now.
Is the answer that we hold it sideways form the X/Y perspective? And the controls are drawn sideways?

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 6 months ago

Hi.
 
The settings we set in the code are required to display in that orientation.
For me, it also doesn’t make sense to set the widht and height like that and then, rotate the display (yes, we rotate the display 90 degrees in the code).
But because the library is set in a certain way, if we set the width and height differently, the display would not display as expected.)
 
Are the examples working as expected for you?
 
Regards,
Sara

0 Vote Up Vote Down
howard lewis answered 6 months ago

I think they are working as expected. So far everything is in the center so it would work no matter what. My question is because when I no longer want to just play with the examples, I am trying to understand how to predict where things will be on the screen.
So I think the answer is the LVGL is set up in portrait mode. Then rotated 90 degrees.after that we rotate the touchscreen to match the original screen orientation. LVGL handles the rotation for that?

0 Vote Up Vote Down
Sara Santos Staff answered 6 months ago

We also need to specify the touchscreen rotation to match the orientation of the display.
That is also set on the code.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.