* bw invert option

* invert bw
This commit is contained in:
gemu 2024-08-14 13:08:17 +02:00 committed by GitHub
parent 102428f768
commit d525200a11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 7 deletions

View File

@ -36,7 +36,7 @@ typedef struct LVGL_PARAMS {
uint8_t swap_color : 1;
uint8_t async_dma : 1; // force DMA completion before returning, avoid conflict with other devices on same bus. If set you should make sure the display is the only device on the bus
uint8_t busy_invert : 1;
uint8_t resvd_2 : 1;
uint8_t invert_bw : 1;
uint8_t resvd_3 : 1;
uint8_t resvd_4 : 1;
uint8_t resvd_5 : 1;

View File

@ -2197,12 +2197,22 @@ void uDisplay::pushColorsMono(uint16_t *data, uint16_t len, bool rgb16_swap) {
for (uint32_t y = seta_yp1; y < seta_yp2; y++) {
seta_yp1++;
for (uint32_t x = seta_xp1; x < seta_xp2; x++) {
uint16_t color = *data++;
if (bpp == 1) color = (color & rgb16_to_mono_mask) ? 1 : 0;
drawPixel(x, y, color); // todo - inline the method to save speed
len--;
if (!len) return; // failsafe - exist if len (pixel number) is exhausted
if (lvgl_param.invert_bw) {
for (uint32_t x = seta_xp1; x < seta_xp2; x++) {
uint16_t color = *data++;
if (bpp == 1) color = (color & rgb16_to_mono_mask) ? 0 : 1;
drawPixel(x, y, color); // todo - inline the method to save speed
len--;
if (!len) return; // failsafe - exist if len (pixel number) is exhausted
}
} else {
for (uint32_t x = seta_xp1; x < seta_xp2; x++) {
uint16_t color = *data++;
if (bpp == 1) color = (color & rgb16_to_mono_mask) ? 1 : 0;
drawPixel(x, y, color); // todo - inline the method to save speed
len--;
if (!len) return; // failsafe - exist if len (pixel number) is exhausted
}
}
}
}