kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/wrong_bpp_for_rgb666_v4.4' into 'release/v4.4'
lcd: fix wrong bpp size of rgb666 format (v4.4) See merge request espressif/esp-idf!20032pull/9840/head
commit
67ff43c2c7
|
@ -38,7 +38,7 @@ typedef struct {
|
|||
bool reset_level;
|
||||
int x_gap;
|
||||
int y_gap;
|
||||
unsigned int bits_per_pixel;
|
||||
uint8_t fb_bits_per_pixel;
|
||||
uint8_t madctl_val; // save current value of LCD_CMD_MADCTL register
|
||||
uint8_t colmod_cal; // save surrent value of LCD_CMD_COLMOD register
|
||||
} nt35510_panel_t;
|
||||
|
@ -71,15 +71,20 @@ esp_err_t esp_lcd_new_panel_nt35510(const esp_lcd_panel_io_handle_t io, const es
|
|||
break;
|
||||
}
|
||||
|
||||
uint8_t fb_bits_per_pixel = 0;
|
||||
switch (panel_dev_config->bits_per_pixel) {
|
||||
case 16:
|
||||
case 16: // RGB565
|
||||
nt35510->colmod_cal = 0x55;
|
||||
fb_bits_per_pixel = 16;
|
||||
break;
|
||||
case 18:
|
||||
case 18: // RGB666
|
||||
nt35510->colmod_cal = 0x66;
|
||||
// each color component (R/G/B) should occupy the 6 high bits of a byte, which means 3 full bytes are required for a pixel
|
||||
fb_bits_per_pixel = 24;
|
||||
break;
|
||||
case 24:
|
||||
case 24: // RGB888
|
||||
nt35510->colmod_cal = 0x77;
|
||||
fb_bits_per_pixel = 24;
|
||||
break;
|
||||
default:
|
||||
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported pixel width");
|
||||
|
@ -87,7 +92,7 @@ esp_err_t esp_lcd_new_panel_nt35510(const esp_lcd_panel_io_handle_t io, const es
|
|||
}
|
||||
|
||||
nt35510->io = io;
|
||||
nt35510->bits_per_pixel = panel_dev_config->bits_per_pixel;
|
||||
nt35510->fb_bits_per_pixel = fb_bits_per_pixel;
|
||||
nt35510->reset_gpio_num = panel_dev_config->reset_gpio_num;
|
||||
nt35510->reset_level = panel_dev_config->flags.reset_active_high;
|
||||
nt35510->base.del = panel_nt35510_del;
|
||||
|
@ -202,7 +207,7 @@ static esp_err_t panel_nt35510_draw_bitmap(esp_lcd_panel_t *panel, int x_start,
|
|||
(y_end - 1) & 0xFF,
|
||||
}, 2);
|
||||
// transfer frame buffer
|
||||
size_t len = (x_end - x_start) * (y_end - y_start) * nt35510->bits_per_pixel / 8;
|
||||
size_t len = (x_end - x_start) * (y_end - y_start) * nt35510->fb_bits_per_pixel / 8;
|
||||
esp_lcd_panel_io_tx_color(io, LCD_CMD_RAMWR << 8, color_data, len);
|
||||
|
||||
return ESP_OK;
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef struct {
|
|||
bool reset_level;
|
||||
int x_gap;
|
||||
int y_gap;
|
||||
unsigned int bits_per_pixel;
|
||||
uint8_t fb_bits_per_pixel;
|
||||
uint8_t madctl_val; // save current value of LCD_CMD_MADCTL register
|
||||
uint8_t colmod_cal; // save surrent value of LCD_CMD_COLMOD register
|
||||
} st7789_panel_t;
|
||||
|
@ -71,12 +71,16 @@ esp_err_t esp_lcd_new_panel_st7789(const esp_lcd_panel_io_handle_t io, const esp
|
|||
break;
|
||||
}
|
||||
|
||||
uint8_t fb_bits_per_pixel = 0;
|
||||
switch (panel_dev_config->bits_per_pixel) {
|
||||
case 16:
|
||||
case 16: // RGB565
|
||||
st7789->colmod_cal = 0x55;
|
||||
fb_bits_per_pixel = 16;
|
||||
break;
|
||||
case 18:
|
||||
case 18: // RGB666
|
||||
st7789->colmod_cal = 0x66;
|
||||
// each color component (R/G/B) should occupy the 6 high bits of a byte, which means 3 full bytes are required for a pixel
|
||||
fb_bits_per_pixel = 24;
|
||||
break;
|
||||
default:
|
||||
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported pixel width");
|
||||
|
@ -84,7 +88,7 @@ esp_err_t esp_lcd_new_panel_st7789(const esp_lcd_panel_io_handle_t io, const esp
|
|||
}
|
||||
|
||||
st7789->io = io;
|
||||
st7789->bits_per_pixel = panel_dev_config->bits_per_pixel;
|
||||
st7789->fb_bits_per_pixel = fb_bits_per_pixel;
|
||||
st7789->reset_gpio_num = panel_dev_config->reset_gpio_num;
|
||||
st7789->reset_level = panel_dev_config->flags.reset_active_high;
|
||||
st7789->base.del = panel_st7789_del;
|
||||
|
@ -186,7 +190,7 @@ static esp_err_t panel_st7789_draw_bitmap(esp_lcd_panel_t *panel, int x_start, i
|
|||
(y_end - 1) & 0xFF,
|
||||
}, 4);
|
||||
// transfer frame buffer
|
||||
size_t len = (x_end - x_start) * (y_end - y_start) * st7789->bits_per_pixel / 8;
|
||||
size_t len = (x_end - x_start) * (y_end - y_start) * st7789->fb_bits_per_pixel / 8;
|
||||
esp_lcd_panel_io_tx_color(io, LCD_CMD_RAMWR, color_data, len);
|
||||
|
||||
return ESP_OK;
|
||||
|
|
Ładowanie…
Reference in New Issue