kopia lustrzana https://github.com/espressif/esp-idf
fixed misaligned data transfer for ssd1306
(cherry picked from commit 46a2bf8ac9
)
(cherry picked from commit b95304829af55174c0c8ac1b9c561e0319896d5b)
pull/9730/head
rodzic
f0a3ccc732
commit
197f916383
|
@ -134,11 +134,16 @@ static esp_err_t panel_io_i2c_tx_buffer(esp_lcd_panel_io_t *io, int lcd_cmd, con
|
||||||
ESP_GOTO_ON_ERROR(i2c_master_write_byte(cmd_link, is_param ? i2c_panel_io->control_phase_cmd : i2c_panel_io->control_phase_data, true),
|
ESP_GOTO_ON_ERROR(i2c_master_write_byte(cmd_link, is_param ? i2c_panel_io->control_phase_cmd : i2c_panel_io->control_phase_data, true),
|
||||||
err, TAG, "write control phase failed"); // control phase
|
err, TAG, "write control phase failed"); // control phase
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// some displays don't want any additional commands on data transfers
|
||||||
|
if (lcd_cmd != -1)
|
||||||
|
{
|
||||||
uint8_t cmds[4] = {BYTESHIFT(lcd_cmd, 3), BYTESHIFT(lcd_cmd, 2), BYTESHIFT(lcd_cmd, 1), BYTESHIFT(lcd_cmd, 0)};
|
uint8_t cmds[4] = {BYTESHIFT(lcd_cmd, 3), BYTESHIFT(lcd_cmd, 2), BYTESHIFT(lcd_cmd, 1), BYTESHIFT(lcd_cmd, 0)};
|
||||||
size_t cmds_size = i2c_panel_io->lcd_cmd_bits / 8;
|
size_t cmds_size = i2c_panel_io->lcd_cmd_bits / 8;
|
||||||
if (cmds_size > 0 && cmds_size <= sizeof(cmds)) {
|
if (cmds_size > 0 && cmds_size <= sizeof(cmds)) {
|
||||||
ESP_GOTO_ON_ERROR(i2c_master_write(cmd_link, cmds + (sizeof(cmds) - cmds_size), cmds_size, true), err, TAG, "write LCD cmd failed");
|
ESP_GOTO_ON_ERROR(i2c_master_write(cmd_link, cmds + (sizeof(cmds) - cmds_size), cmds_size, true), err, TAG, "write LCD cmd failed");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
ESP_GOTO_ON_ERROR(i2c_master_write(cmd_link, buffer, buffer_size, true), err, TAG, "write data failed");
|
ESP_GOTO_ON_ERROR(i2c_master_write(cmd_link, buffer, buffer_size, true), err, TAG, "write data failed");
|
||||||
|
|
|
@ -167,7 +167,7 @@ static esp_err_t panel_ssd1306_draw_bitmap(esp_lcd_panel_t *panel, int x_start,
|
||||||
}, 2);
|
}, 2);
|
||||||
// transfer frame buffer
|
// transfer frame buffer
|
||||||
size_t len = (y_end - y_start) * (x_end - x_start) * ssd1306->bits_per_pixel / 8;
|
size_t len = (y_end - y_start) * (x_end - x_start) * ssd1306->bits_per_pixel / 8;
|
||||||
esp_lcd_panel_io_tx_color(io, 0, color_data, len);
|
esp_lcd_panel_io_tx_color(io, -1, color_data, len);
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue