Porting LVGL to a monochrome display (proprietary)

Porting LVGL to a monochrome display

I’m using LVGL for a proprietary application running on a POS device. The device is really small (100MHz CPU, 384KB RAM, 8MB Flash). It has a small 128x64 monochrome display and the API is just a PutPixel(x, y, color).

I read the porting guide and implemented a driver like this one:

void
display_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_p)
{
    pwInt32 x, y;
    const pwInt32 startX = area->x1;
    const pwInt32 startY = area->y1;
    const pwInt32 endX = area->x2;
    const pwInt32 endY = area->y2;

    for( x = startX; x < endX; ++x )
    {
        for( y = startY; y < endY; ++y )
        {
            uchar dot = (uchar)lv_color_to1( *color_p );
            ScrPlot( x, y, dot );
            color_p++;
        }
    }
    lv_disp_flush_ready(drv); 
}

For testing, I got this simple code from the manual:

void lv_example_label_1(void)
{
    lv_obj_t * label1 = lv_label_create(lv_scr_act());  
    lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP);
    lv_label_set_text(label1, "Hello LVGL!");
    lv_obj_set_width(label1, 64);  /*Set smaller width to make the lines wrap*/
    lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0);
    lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40);
}

Also, the code that initializes the driver and registers it is this one (DRAW_BUFFER_SIZE=1024):

static void D175_diplay_init_driver_( void )
{
    static lv_disp_draw_buf_t displayDrawBuffer_;
    static lv_color_t buffer_[DRAW_BUFFER_SIZE];
    static lv_disp_drv_t displayDriver_;
    lv_disp_draw_buf_init( &displayDrawBuffer_, buffer_, NULL,
                                                                                        DRAW_BUFFER_SIZE );

    lv_disp_drv_init( &displayDriver_ );
    displayDriver_.hor_res = LV_HOR_RES_MAX;
    displayDriver_.ver_res = LV_VER_RES_MAX;
    displayDriver_.flush_cb = D175_display_flush;
    displayDriver_.draw_buf = &displayDrawBuffer_;
    display_ = lv_disp_drv_register( &displayDriver_ );
}

Now, I’m getting this drawn in my screen:

Could you please, help me figure out what I’m doing wrong?

I ran a test writing a program that actually fills all pixels with black. The program works fine as shown in the next screenshot:

Here is the main loop of the program:

    // example:
    // fills the entire screen with black
    for( x = 0; x < 128; ++x )
    {
        for( y = 0; y < 64; ++y )
        {
            ScrPlot(x, y, 1);
        }
    }

Also, I checked the LVGL buffer and it is filled with a lot of 1’s and almost no 0. I will try to dump the buffer and see what it has.

Did you end up finding a solution to this? I have the same problem using LVGL with my 128x64 monochrome display – no matter what graphics I try to add, the screen shows black bars like the first photo.