GLCD Rotation

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In another thread, meslomp wrote:
note that you can also most likely rotate the display, it has an inverse X and inverse Y bit in a register by swapping these you can write test in any direction you want ans this will give the orientation of the display.

 

https://www.avrfreaks.net/comment...

 

I have an idea for a project which could be in one of six orientations (a hexagonal box that could be "standing" on any one of the six edges).

 

There would be a display, so this would need to be able to rotate the "content" to these six orientations.

 

So I'm wondering if there are LCD controllers which can do the rotation "internally" - or if I'd have to do it in code ?

 

If I have to do it in code, I guess meslomp's tip would mean I'd only actually need to do three rotations - and then use the "inverse X / Y" to get the other three ... ?

 

 

It's all just conjecture at the moment.

 

This topic has a solution.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Jul 26, 2018 - 07:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As far as I can remember, KS0108 and T6963C have fixed orientations.
Since these are monochrome controllers it is practical to keep a buffer in SRAM. Many libraries manipulate the buffer and simply blit the buffer in one go. So all you need to do is have a blit function for the orientation that you want.
.
Colour displays would need massive mirror buffers. And blitting a large colour screen takes lots of millliseconds. TFT controllers can rearrange everything via hardware registers. Likewise OLED controllers.
.
Your project is using six 60 degree rotations instead of four 90 degree rotations. I am not aware of any hardware controller that can do 60 degrees. You will have to do a lot of maths yourself.
.
David.

Last Edited: Sat. Nov 11, 2017 - 12:26 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you drawing text or objects?

 

What is the resolution of the display?

 

Unless you are using a relatively high resolution display I'd suspect a 60' rotation will result in a lot of poorly formed characters with jagged edges.

 

A "quick" test of this on a display with your intended resolution and a few characters of text might be in order.

 

JC

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
Are you drawing text or objects?

 

What is the resolution of the display?

These details may be on the back of the next envelope ...

 

Unless you are using a relatively high resolution display I'd suspect a 60' rotation will result in a lot of poorly formed characters with jagged edges.

quite possibly...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I do not seem to get to 6 rotations, but only 4 as you can not see through the display the rear (mirrored) see through is normally not present.

 

but other than that you can make the text readable any way you hold the display by just setting the bits correct.

with another controller that we use in a display at work, we use it in 4 different ways, depending on the customer needs "portrait or landscape" and on what side (Left or right vs top or bottom) of the PCB we can better connect the display to the PCB. Sometimes it is more convenient for us to have the display mounted on the left/top side and sometimes on the right/bottom side. All they then do in FW is adjust the values of the x and Y parameter and the display is readable again.

Note that when you do that you also have to keep in mind how many characters/pixels you have available in x and y direction in the specific configuration except when you have a square display.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

meslomp wrote:
I do not seem to get to 6 rotations

Like this:

 

 

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If that is what you are trying to do, it is trivial.
Make an array for your six colours.
Draw 6 filledTriangles using an appropriate index into your array.
.
I thought that you wanted to rotate a complex image like a photo. Even drawing text at an angle is awkward,
I normally think of GLCD as a monochrome LCD like KS0108.
.
Oh, and I think that some TFT controllers can use a colour Palette. So you would only need to draw the hexagon once. Change the Palette to display the different "rotation".
.
David.

Last Edited: Mon. Nov 13, 2017 - 11:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
If that is what you are trying to do,

No - it's just to illustrate the 6 rotations.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So my original understanding was correct. It is not only compute intensive but it does not always look very good.
It is probably easier to redraw in the new orientation than trying to rotate an existing image.
.
Algorithms exist. Google for " image rotation". Shear 30 degrees horizontally and then shear 30 degrees vertically.
.
David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
Algorithms exist. 

Of course.

 

The point of my question was to see if there are any controllers which have it built-in.

 

So far, it seems not ...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not any small GLCD or TFT controllers that I am aware of.
I guess that the display controller in your PC can do all sorts of clever things with enough horsepower and memory.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...