kopia lustrzana https://github.com/OpenRTX/OpenRTX
Added BGR565 pixel format to HX8353 display driver and graphics module
rodzic
3cdaa650c1
commit
061e698ba3
|
@ -90,7 +90,7 @@ static const GFXfont fonts[] = { TomThumb, // 5pt
|
|||
Symbols8pt7b // 8pt
|
||||
};
|
||||
|
||||
#ifdef PIX_FMT_RGB565
|
||||
#if defined(PIX_FMT_RGB565) || defined(PIX_FMT_BGR565)
|
||||
|
||||
/* This specialization is meant for an RGB565 little endian pixel format.
|
||||
* Thus, to accomodate for the endianness, the fields in struct rgb565_t have to
|
||||
|
@ -163,7 +163,7 @@ void gfx_init()
|
|||
initialized = 1;
|
||||
|
||||
// Calculate framebuffer size
|
||||
#ifdef PIX_FMT_RGB565
|
||||
#if defined(PIX_FMT_RGB565) || defined(PIX_FMT_BGR565)
|
||||
fbSize = SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(PIXEL_T);
|
||||
#elif defined PIX_FMT_BW
|
||||
fbSize = (SCREEN_HEIGHT * SCREEN_WIDTH) / 8;
|
||||
|
@ -232,7 +232,7 @@ inline void gfx_setPixel(point_t pos, color_t color)
|
|||
|| pos.x < 0 || pos.y < 0)
|
||||
return; // off the screen
|
||||
|
||||
#ifdef PIX_FMT_RGB565
|
||||
#if defined(PIX_FMT_RGB565) || defined(PIX_FMT_BGR565)
|
||||
// Blend old pixel value and new one
|
||||
if (color.alpha < 255)
|
||||
{
|
||||
|
@ -671,7 +671,7 @@ void gfx_drawBattery(point_t start, uint16_t width, uint16_t height,
|
|||
// Cap percentage to 1
|
||||
percentage = (percentage > 100) ? 100 : percentage;
|
||||
|
||||
#ifdef PIX_FMT_RGB565
|
||||
#if defined(PIX_FMT_RGB565) || defined(PIX_FMT_BGR565)
|
||||
color_t green = {0, 255, 0 , 255};
|
||||
color_t yellow = {250, 180, 19 , 255};
|
||||
color_t red = {255, 0, 0 , 255};
|
||||
|
|
|
@ -396,19 +396,32 @@ void display_init()
|
|||
* - bit 1 and 0: don't care
|
||||
*/
|
||||
|
||||
uint8_t reg;
|
||||
switch(lcd_type)
|
||||
{
|
||||
case 1:
|
||||
reg = (1 << 6) // Invert x
|
||||
| (1 << 5); // Exchange x and y
|
||||
break;
|
||||
|
||||
case 2:
|
||||
reg = (1 << 7) // Invert y
|
||||
| (1 << 6) // Invert x
|
||||
| (1 << 5); // Exchange x and y
|
||||
break;
|
||||
|
||||
default:
|
||||
reg = (1 << 7) // Invert y
|
||||
| (1 << 5); // Exchange x and y
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef PIX_FMT_BGR565
|
||||
reg |= (1 << 3); // BGR pixel format
|
||||
#endif
|
||||
|
||||
writeCmd(CMD_MADCTL);
|
||||
if(lcd_type == 1)
|
||||
{
|
||||
writeData(0x60); /* Reference case: MD-390(G) */
|
||||
}
|
||||
else if(lcd_type == 2)
|
||||
{
|
||||
writeData(0xE0); /* Reference case: MD-380V(G) */
|
||||
}
|
||||
else
|
||||
{
|
||||
writeData(0xA0); /* Reference case: MD-380 */
|
||||
}
|
||||
writeData(reg);
|
||||
|
||||
writeCmd(CMD_CASET);
|
||||
writeData(0x00);
|
||||
|
|
Ładowanie…
Reference in New Issue