How to hide the blinking cursor on OLED


What MCU/Processor/Board and compiler are you using?
We are using custom board with am335x processor and “gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf” compiler.

What LVGL version are you using?
We are using v8.2.0

What do you want to achieve?
we want to hide the blinking cursor on OLED.

What have you tried so far?

  1. we have used the following API “lv_obj_clear_state(label, LV_STATE_FOCUSED);” but not able to hide the blinking cursor at the bottom of the label.

Code to reproduce

#include "lvgl/lvgl.h"
#include "lvgl/demos/lv_demos.h"
#include "lv_drivers/display/fbdev.h"
#include "lv_drivers/indev/evdev.h"
#include <unistd.h>
#include <pthread.h>
#include <time.h>
#include <sys/time.h>

#define DISP_BUF_SIZE (128 * 64)

int main(void)
    /*LittlevGL init*/

    /*Linux frame buffer device init*/

    /*A small buffer for LittlevGL to draw the screen's content*/
    static lv_color_t buf[DISP_BUF_SIZE];

    /*Initialize a descriptor for the buffer*/
    static lv_disp_draw_buf_t disp_buf;
    lv_disp_draw_buf_init(&disp_buf, buf, NULL, DISP_BUF_SIZE);

    /*Initialize and register a display driver*/
    static lv_disp_drv_t disp_drv;
    disp_drv.draw_buf   = &disp_buf;
    disp_drv.flush_cb   = fbdev_flush;

    disp_drv.hor_res    = 128;

    disp_drv.ver_res    = 64;


    /*Change the active screen's background color*/
    lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x000000), LV_PART_MAIN);

     /*Create a "Hello world!" label*/
    lv_obj_t * label = lv_label_create(lv_scr_act());

    lv_obj_clear_state(label, LV_STATE_FOCUSED);

    lv_label_set_text(label, "Hello world!");

    /*Create a white label, set its text and align it to the center*/
    lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xffffff), LV_PART_MAIN);
     lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);

    /*Handle LitlevGL tasks (tickless mode)*/
    while(1) {
//        lv_tick_inc(5);

    /*Create a Demo*/
//    lv_demo_widgets();

    return 0;
  • List item