Floyd-Fish / ST7789-STM32

using STM32's Hardware SPI to drive a ST7789 based IPS displayer
GNU General Public License v3.0
276 stars 55 forks source link

Start of coordinates in ST7789_ROTATION == 3 issue #31

Closed w1s3m0nk closed 3 months ago

w1s3m0nk commented 3 months ago

Hello, @Floyd-Fish,

I've bought the 240x320 display based on ST7789 driver faced the problem that in the ST7789_ROTATION == 3 mode the start of the coordinates is in the top left part of the display.

To test the true coordinates, I've used this part of code to get the visual identification where the begin and end of coordinates are located:

ST7789_DrawCircle(0, 0, 5, RED);
ST7789_DrawCircle(0, 239, 5, CYAN);
ST7789_DrawCircle(319, 0, 5, MAGENTA);

Here is the photo with some mark-up from my side: photo_5361783129209165760_y

Could you please explain/provide solution how to set 0,0 to the left bottom side of display?

Floyd-Fish commented 3 months ago

Hello w1s3m0nk, I guess there is no "harware configurable" way to set the display coordinate as you said under this rotation configuration. But in software it's easy to achieve. Just use screen's height minus the y coordinate. For example, draw a point at (x, y), then you can write ST7789_DrawPixel(x, ST7789_HEIGHT - y, color).

Hope this helps.