We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
Here is my code modification to use "Swap the 2 bytes of RGB565 color" or not, it is working for me :
` uint32_t j = 0;
/* uint16_t blue : 5; uint16_t green : 6; uint16_t red : 5;
BBBB BGGG GGGR RRRR
*/ #if LV_COLOR_16_SWAP != 1 uint32_t LD = 0; for (uint32_t i = 0; i < size; i++) { LD = buffer_16bit[i].full; mybuf[j] = (uint8_t) (((LD & 0xF800) >> 8) | ((LD & 0x8000) >> 13)); // B j++; mybuf[j] = (uint8_t) ((LD & 0x07E0) >> 3); // G j++; mybuf[j] = (uint8_t) (((LD & 0x001F) << 3) | ((LD & 0x0010) >> 2)); //R 0001 0000 -> 0000 0100 j++; } #endif
/* B = 0000 0000 BBBB B100 G = 0000 0000 GGGG GG00 R = 0000 0000 RRRR R100 */
/* uint16_t green_h : 3; 0000 0000 0000 0111 uint16_t red : 5; 0000 0000 0001 1111 uint16_t blue : 5; 0000 0000 0001 1111 uint16_t green_l : 3; 0000 0000 0000 0111
GGGR RRRR BBBB BGGG 0000 0000 000G GG00 */
#if LV_COLOR_16_SWAP == 1 for (uint32_t i = 0; i < size; i++) { mybuf[j] = (uint8_t)((buffer_16bit[i].ch.red << 3) | ((buffer_16bit[i].ch.red & 0x0010) >> 2)); j++; mybuf[j] = (uint8_t)((buffer_16bit[i].ch.green_h << 5) | ((buffer_16bit[i].ch.green_l) << 2)); j++; mybuf[j] = (uint8_t)((buffer_16bit[i].ch.blue << 3) | ((buffer_16bit[i].ch.blue & 0x0010) >> 2));; j++; } #endif
/* Column addresses */
`
I leave my comment for those wants to understand how bits are shifted.
I didn't understand while des MSB bits of red and blue are copied to LSB, if someone can explain to me.
Regards,
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
Here is my code modification to use "Swap the 2 bytes of RGB565 color" or not, it is working for me :
`
uint32_t j = 0;
/* uint16_t blue : 5;
uint16_t green : 6;
uint16_t red : 5;
*/
#if LV_COLOR_16_SWAP != 1
uint32_t LD = 0;
for (uint32_t i = 0; i < size; i++) {
LD = buffer_16bit[i].full;
mybuf[j] = (uint8_t) (((LD & 0xF800) >> 8) | ((LD & 0x8000) >> 13)); // B
j++;
mybuf[j] = (uint8_t) ((LD & 0x07E0) >> 3); // G
j++;
mybuf[j] = (uint8_t) (((LD & 0x001F) << 3) | ((LD & 0x0010) >> 2)); //R 0001 0000 -> 0000 0100
j++;
}
#endif
/*
B = 0000 0000 BBBB B100
G = 0000 0000 GGGG GG00
R = 0000 0000 RRRR R100
*/
/* uint16_t green_h : 3; 0000 0000 0000 0111
uint16_t red : 5; 0000 0000 0001 1111
uint16_t blue : 5; 0000 0000 0001 1111
uint16_t green_l : 3; 0000 0000 0000 0111
#if LV_COLOR_16_SWAP == 1
for (uint32_t i = 0; i < size; i++) {
mybuf[j] = (uint8_t)((buffer_16bit[i].ch.red << 3) | ((buffer_16bit[i].ch.red & 0x0010) >> 2));
j++;
mybuf[j] = (uint8_t)((buffer_16bit[i].ch.green_h << 5) | ((buffer_16bit[i].ch.green_l) << 2));
j++;
mybuf[j] = (uint8_t)((buffer_16bit[i].ch.blue << 3) | ((buffer_16bit[i].ch.blue & 0x0010) >> 2));;
j++;
}
#endif
`
I leave my comment for those wants to understand how bits are shifted.
I didn't understand while des MSB bits of red and blue are copied to LSB, if someone can explain to me.
Regards,
The text was updated successfully, but these errors were encountered: