Skip to content

ST7735 color depth LUTs not defaulted after a SWRESET #16

@Pachelbel1414

Description

@Pachelbel1414

I'm able to get the ST7735 display to be corrupted by doing simultaneous writes from multiple threads (I know this is bad).
What occurs is the color depth lookup tables are getting corrupted. According to the Sitronix datasheet, the LUTs are not defaulted on a SWRESET, only on power up or HWRESET. So app restart or even "sudo reboot" is not enough to correct it.

I was able to account for this by adding code to default the LUTs to the ST7735 module's _init() function.

    ST7735_RGBSET = 0x2D

    # update color depth lookup tables for 16-bit 565 color.
    # these are only reset to defaults after a 
    # power on or HW reset (not a SW reset).
    self.command(ST7735_RGBSET)    # Set color LUT (0x2D)
    # red (5-bit, 32 colors)
    for color in range(0, 32, 2):
        self.data(color)
    for color in range(33, 64, 2):
        self.data(color)
    # green (6-bit, 64 colors)
    for color in range(0, 64):
        self.data(color)
    # blue (5-bit, 32 colors)
    for color in range(0, 32, 2):
        self.data(color)
    for color in range(33, 64, 2):
        self.data(color)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions