Skip to content

Sprite colors wrong, TFT colors OK on Arduino Due, ILI9488 SPI #3595

Discussion options

You must be logged in to vote

I found the problem. The colors need to be given in BRG instead of RGB.
Maybe there is a better solution but this function converts the color:

`
/**

  • @brief Converts a 16-bit RGB color value to BRG (Blue-Red-Green).

  • This function takes a 16-bit color value in RGB 565 format (5 bits Red, 6 bits Green, 5 bits Blue)

  • and converts it to BRG format by rearranging the color components.

  • @param color A 16-bit color value in RGB 565 format.

  • @return uint16_t The converted color value in BRG 565 format.
    */
    uint16_t rgb_to_brg(uint16_t color) {
    // Extract individual color components (5-6-5 bits)
    uint8_t r5 = (color >> 11) & 0x1F; // 5 bits for Red
    uint8_t g6 = (color >> 5) & 0x3F; // 6 bits…

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
3 replies
@PatMan6889
Comment options

@Basitadam
Comment options

@PatMan6889
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@Basitadam
Comment options

@PatMan6889
Comment options

@Basitadam
Comment options

@PatMan6889
Comment options

@Basitadam
Comment options

Answer selected by PatMan6889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants