Rounding area to vertical height display

Description

I am using a sharp memory display that must write whole lines. I can use the rounding (v8) or invalidate area (v9) to force the area to the display width in portrait mode. If use landscape mode (eg flip horizontal and vertical values), I cannot force the height to a fixed value. I get invalid values in my flush callback for area.

What MCU/Processor/Board and compiler are you using?

nRF52840

What do you want to achieve?

I would like to find the correct way to round the display area in landscape mode for this display.

What have you tried so far?

I have tried various values to round the display to a fixed height in landscape mode, but this seems to give invalid areas. Portrait works correctly.

Code to reproduce

In portrait mode, this works perfectly. My display is 230 (w) x (302) (h) in portrait mode. I must write the full 230 in the flush callback. This works well, forcing the width always to 230 and allowing the height to vary based on what needs to be written.

#define DISP_HOR_RES 230
#define DISP_VER_RES 302

// Rounding boundaries used instatic void event_cb(lv_event_t * e)
  a->x1 = 0;                
  a->x2 = DISP_HOR_RES - 1;

Current Issue: In landscape mode, I cannot force the area to a fixed height. The following code gives me an invalid flush area of x1=0 and x2 = 0 and a warning of:

""Can’t set draw_buf height using the round function. (Wrong round_cb or to "
“small draw_buf)”

But my buffer should be large enough as it is 230*302/2;

#define DISP_DIV 2
    lv_disp_draw_buf_init(&draw_buf, buf1, NULL,
        DISP_HOR_RES * DISP_VER_RES / DISP_DIV); /*Initialize the display buffer.*/
#define DISP_HOR_RES 302
#define DISP_VER_RES 230

// Rounding boundaries used in static void event_cb(lv_event_t * e)
    a->y1 = 0;
    a->y2 = DISP_VER_RES - 1;

Question: What is the correct way to force the display to update in vertical strips, using the full Y height with an arbitrary x width, as opposed to horizontal?

1 Like

Hey @nwluke I’m trying to get LVGL working with the Sharp Memory LCD’s also.

I haven’t had any luck getting it working yet but looks like you have a working combo.

Is there anyway you could share your code or what it took to get the Sharp Memory LCD working with LVGL?

Any help or advice is greatly appreciated :grinning:

They have an example for v8 here:

Thanks, i have those but just have no idea how to integrate it into the LVGL library.

Im using a ESP32 and platformio.

Im no expert and without an example to model im spinning my wheels lol

The solution is to write your own get_max_column function that runs instead of get_max_rows when in landscape mode. Perhaps there could also be a flag that is set at the display/driver level that indicates the rounding should use columns rather than rows.

“uint32_t get_max_column(lv_disp_t * disp, lv_coord_t area_w, lv_coord_t area_h)”