Color display code questions

@profezzorn I have purchased 3 new ST7735 displays to test out.
They are square aspect rations I thought would work for scopes in particular.

In spidisplay.h I can see the size is defined and then an “offset” is applied with InsetT. Is that what I am seeing?

i.e. the first display defined is the AdaFruit358 which has a resolution of 160x128 with no offsets applied.

template<int LAYERS,
	 class CONFIG = DisplayConfig<1>,
	 class SA = StandardDisplayAdapter<>>
using SPIDisplay_AdaFruit358 = SPIDisplay77XX<
  LAYERS,
  CONFIG,
  // HELPER
  DisplayConfigHelper<LAYERS, CONFIG, SizeT<128, 160>, SA, ST7735>,

The next display defined is the DFRobot096 which has a resolution of 160x80, however the definition is 160x128 with top and bottom offsets of 24, equaling 80 pixels in height.

template<int LAYERS,
	 class CONFIG = DisplayConfig<1, InsetT<24,24,0,0>>,
	 class SA = StandardDisplayAdapter<>>
using SPIDisplay_DFRobot096 = SPIDisplay77XX<
  LAYERS,
  CONFIG,
  // HELPER
  DisplayConfigHelper<LAYERS, CONFIG, SizeT<128, 160>, SA, ST7735>,

Why is this? Can it not just be specified at the real pixel resolution?

The displays I would like to test are 128x128 and 240x240. Do I need to apply these offsets?

I hope to give it a test in the next few days.

Usually those controllers support a certain size display, no more no less, or they can be configured, but only to certain resolutions. (Although often at runtime they can have their windows set, just not OTP…)

Smaller resolutions and different aspect ratios are created by just not connecting those “extra” pixels, so you have to feed data in where pixels actually are. Typically you can tell the display where you want to start feeding data, and then just stream data and it will handle putting it where it needs to go, but you have to know where the offset(s) are to know where to start and stop.

I’ve not messed with that particular controller, but from the few I have seen, they usually work roughly the same way.

Of course, Fredrik may have a completely different reason for this. I haven’t see his code, this is just my guess with the virtually no information I have :slight_smile:

2 Likes

That’s interesting, because I looked briefly at that controller and it only seems to support 128x160 (or 132x162, but this seems uncommon)

Well, they did come from aliexpress, so who knows. The title lists both ST7735 and ST7789.

https://www.aliexpress.us/item/3256806595253249.html

the 240x240 specs do mention that its ST7789, the 128x128 doesn’t say.

ST7789 is 320x240, so that makes more sense.

1 Like