Due to high demand, expect some shipping delays at this time - orders may not ship for up to 2-3 business days.
0

MEANING OF 'OFFSET' FOR ST7789 PiTFT DISPLAY?
Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Please be positive and constructive with your questions and comments.

MEANING OF 'OFFSET' FOR ST7789 PiTFT DISPLAY?

by dave__ on Sun Jan 23, 2022 7:22 pm

Hi. I recently bought a 'Mini PiTFT 1.3" - 240x240 TFT Add-on for Raspberry Pi'.

I made my way through the tutorial material, including the 'stats.py' program, which I cut and pasted from the web site. To get it to display correctly on the 240x240 display, I had to adjust the call to create the display object, which was set up for the 135 x 240 display:

Code: Select all | TOGGLE FULL SIZE
disp = st7789.ST7789(
    spi,
    cs=cs_pin,
    dc=dc_pin,
    rst=reset_pin,
    baudrate=BAUDRATE,
    width=135,
    height=240,
    x_offset=53,
    y_offset=40,
)


OK, so setting width and height to 240 seemed obvious enough. But it took some trial and error to arrive at an x_offset of 0 and a y_offset of 80.

My question is: what do those numbers represent? I assume not pixels, since if so, skipping a third of the display height doesn't seem right. And in any case, I (say) used 90 instead of 80, the display was garbled, not simply moved by an additional 10 whatevers.

I later found another body of example code, which had various offsets for different displays, and the 240x240 y_offset was given as 80, matching the value I found 'the long way round'. But the values just seemed to be magic numbers in the code.

dave__
 
Posts: 1
Joined: Sun Jan 23, 2022 6:43 pm

Please be positive and constructive with your questions and comments.