Use correct option for color inversion

This commit is contained in:
Tomas Rezucha 2021-02-12 10:39:58 +01:00
parent 4e0667a065
commit 849afed80d
5 changed files with 33 additions and 33 deletions

View file

@ -62,8 +62,8 @@ void sh1107_init(void)
{0x81, {0}, 0}, // Set display contrast
{0x2F, {0}, 0}, // ...value
{0x20, {0}, 0}, // Set memory mode
{0xA0, {0}, 0}, // Non-rotated display
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
{0xA0, {0}, 0}, // Non-rotated display
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
{0xC8, {0}, 0}, // flipped vertical
#elif defined CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT
{0xC7, {0}, 0}, // flipped vertical
@ -82,11 +82,11 @@ void sh1107_init(void)
{0xDA, {0}, 0}, // Set com pins
{0x12, {0}, 0}, // ...value
{0xA4, {0}, 0}, // output ram to display
#if defined CONFIG_LV_INVERT_DISPLAY
#if defined CONFIG_LV_INVERT_COLORS
{0xA7, {0}, 0}, // inverted display
#else
{0xA6, {0}, 0}, // Non-inverted display
#endif
#endif
{0xAF, {0}, 0}, // Turn display on
{0, {0}, 0xff},
};
@ -116,14 +116,14 @@ void sh1107_init(void)
}
void sh1107_set_px_cb(struct _disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
lv_color_t color, lv_opa_t opa)
lv_color_t color, lv_opa_t opa)
{
/* buf_w will be ignored, the configured CONFIG_LV_DISPLAY_HEIGHT and _WIDTH,
and CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE and _PORTRAIT will be used. */
and CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE and _PORTRAIT will be used. */
uint16_t byte_index = 0;
uint8_t bit_index = 0;
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
byte_index = y + (( x>>3 ) * LV_VER_RES_MAX);
bit_index = x & 0x7;
#elif defined CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT
@ -146,10 +146,10 @@ void sh1107_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
uint32_t size = 0;
void *ptr;
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
row1 = area->x1>>3;
row2 = area->x2>>3;
#else
#else
row1 = area->y1>>3;
row2 = area->y2>>3;
#endif
@ -158,9 +158,9 @@ void sh1107_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
sh1107_send_cmd(0x00 | columnLow); // Set Lower Column Start Address for Page Addressing Mode
sh1107_send_cmd(0xB0 | i); // Set Page Start Address for Page Addressing Mode
size = area->y2 - area->y1 + 1;
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
ptr = color_map + i * LV_VER_RES_MAX;
#else
#else
ptr = color_map + i * LV_HOR_RES_MAX;
#endif
if(i != row2){