0

I'm trying to use the Waveshare LCD 1.28 module found at https://www.waveshare.com/wiki/RP2040-LCD-1.28 which based upon their demo python code, the module should support RGB565 for color definitions, however this doesn't appear to be true.

There are a number of color constants defined in the code:

self.red   =   0x07E0
self.green =   0x001f
self.blue  =   0xf800

But these are not correct for RGB565, instead these should be:

self.red   =   0xf800
self.green =   0x07E0
self.blue  =   0x001f

The problem is, the incorrect values render correctly on the screen, but this means I can't easily calculate other colors.

Does anyone know how to get this display to use correct RGB565 values? Or some way of correctly calculating colors based on their RGB value to whatever format the screen is using?

I initially thought maybe they are all just shifted and the values are actually BRG, and this works to some degree, but there are some color mixes that don't come out right so it doesn't look as simple as that.

1
  • I know nothing about the hardware you have mentioned BUT the values you mentioned appear to be using a different byte order.
    – Milliways
    May 13, 2023 at 22:42

1 Answer 1

0

I have the same question. I know the display controller has at least three modes. If it is getting setup in pure RGB565

Update: The mode is best thought of as BRG565 or B5-G6-R5 Blue Red Green, five blue bits, six red bits,five green bits. The section in the manual is indexed as RGB565 It is easier to set bits in a binary string so each field in the 16 bits can be seen. Start with the example colors. In another window use python to expand hex to a string of bits and the fields and order within 16 bits will be apparent.

    # Additive Color mixing (not like crayons)
    #self.someghing = 0bBBBBBRRRRRRGGGGG
    #self.red   =   0x07E0
    self.red   =    0b0000001111100000
    self.red1   =   0b0000000000100000
    self.red3   =   0b0000000001100000
    self.red4   =   0b0000000010000000
    #self.green =   0x001f  
    self.green =    0b11111
    #self.blue  =   0xf800
    self.blue  =    0b1111100000000000 
    #self.yellow =  0x7ff  # mix R&G
    self.yellow =   0b11111111111
    self.white =    0xffff  # 0b1111111111111111

Explore colors by adding a set of these for each color of interest. In the demo code

    LCD.fill(LCD.blue)
    LCD.show()
    print("Blue")
    time.sleep(3)
2
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review
    – Chenmunka
    Jul 3, 2023 at 7:30
  • Updated -- should answer and enable progress.
    – niftymitch
    Jul 6, 2023 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.