Fix the Landscape orientation

Thanks to Damian Glinojecki
This commit is contained in:
AVartanyan 2023-09-18 21:14:06 +03:00 committed by GitHub
parent 02b0603cc6
commit 5b795f8c6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -213,13 +213,16 @@ void ssd1680_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t* buf,
BIT_CLEAR(buf[mirrored_idx], 7 - bit_index);
}
#elif defined (CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE)
byte_index = y + ((x >> 3) * EPD_PANEL_HEIGHT);
bit_index = x & 0x7;
if (color.full) {
BIT_SET(buf[byte_index], 7 - bit_index);
/* mirrored index */
uint16_t mirrored_idx = (EPD_PANEL_HEIGHT - x) + ((y >> 3) * EPD_PANEL_HEIGHT);
byte_index = x + ((y >> 3) * EPD_PANEL_HEIGHT);
bit_index = y & 0x7;
/* 1 means white, 0 means black */
/* note that the bit index is inverted in place */
if (color.full == 0) {
BIT_SET(buf[mirrored_idx - 1], 7 - bit_index);
} else {
BIT_CLEAR(buf[byte_index], 7 - bit_index);
BIT_CLEAR(buf[mirrored_idx - 1], 7 - bit_index);
}
#else
#error "Unsupported orientation used"