Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SSD1306 and SH1107 display controller, added ILI9341, SH1107 and SSD1306 sleep mode #94

Merged
merged 28 commits into from
Apr 13, 2020

Conversation

an-erd
Copy link
Contributor

@an-erd an-erd commented Apr 13, 2020

  • Added display controller SSD1306
  • Added display controller SH1107
  • Added predefined device (Wemos Lolin ESP32 OLED 128x64 with SSD1306)
  • Added predefined device (M5Stick with SH1107)
  • Merged code for display orientation (commits 900c1d1 and 42c2fd2)
  • Added SSD1306, ILI9341, SH1107 sleep mode
  • Added SSD1306 and SH1107 inverse display, and display rotation (portrait/landscape)
  • Kconfig cleanup
  • Updated README.md

C47D and others added 28 commits March 25, 2020 23:38
Added "helper" defines  CONFIG_LVGL_TFT_DISPLAY_USER_CONTROLLER_*
* Cleanup for monochrome display

* Added inverted display and landscape/portrait for ssd1306 and sh1107
* Cleanup for monochrome display

* Added inverted display and landscape/portrait for ssd1306 and sh1107

* File cleanup, remove test pragma, indentation

* Removed debug logs, removed predefined pins in Kconfig, add default to pins in Kconfig but then adkconfig entries even if not used, Readme updated
@C47D
Copy link
Collaborator

C47D commented Apr 13, 2020

Thanks a lot for the contibution @an-erd, I tested your fork over the weekend with the SSD1306 controller and it works great.

Just to be sure
https://github.com/littlevgl/lv_port_esp32/blob/ae6ab49a70744956293afcc59c85b89273c218dd/main/main.c#L76-L85

The rounder_cb and set_px_cb callbacks are only neccesary for monochrome displays? You're also setting the disp_drv.rounder_cb to disp_driver_rounder on both CONFIG_LVGL_TFT_DISPLAY_CONTROLLER_SSD1306 and CONFIG_LVGL_TFT_DISPLAY_CONTROLLER_SH1107.

Maybe we can do something like this in the disp_driver layer

void disp_driver_set_px(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)
{
#if defined CONFIG_LVGL_TFT_DISPLAY_CONTROLLER_SSD1306
    ssd1306_set_px_cb(disp_drv, buf, buf_w, x, y, color, opa);
#elif defined CONFIG_LVGL_TFT_DISPLAY_CONTROLLER_SH1107
    sh1107_set_px_cb(disp_drv, buf, buf_w, x, y, color, opa);
#endif
}

So we end up with something like this:

    static lv_color_t buf1[DISP_BUF_SIZE];
    static lv_color_t buf2[DISP_BUF_SIZE];
    static lv_disp_buf_t disp_buf;
    lv_disp_buf_init(&disp_buf, buf1, buf2, DISP_BUF_SIZE);

    lv_disp_drv_t disp_drv;
    lv_disp_drv_init(&disp_drv);
    disp_drv.flush_cb = disp_driver_flush;
    disp_drv.buffer = &disp_buf;

#ifdef CONFIG_LVGL_TFT_DISPLAY_MONOCHROME
    disp_drv.rounder_cb = disp_driver_rounder;
    disp_drv.set_px_cb = disp_driver_set_px;
#endif

    lv_disp_drv_register(&disp_drv);

I was thinking on how to remove all the lvgl setup from the app_main function and do it on the background.

What do you think?

@C47D C47D merged commit ae6ab49 into lvgl:master Apr 13, 2020
@an-erd
Copy link
Contributor Author

an-erd commented Apr 13, 2020

Yes, that's a good idea. I will implement it that way.

I use the set_px_cb because one pixel is just one bit on the monochrome displays and so it's only used for these monochrome displays. And with this the buffer can be send to the display controller directly and thus efficiently. The rounder is necessary because both display driver use columns and pages (which is a height of 8 px und thus one byte), and thus we need to send complete pages to the display controller.

@C47D
Copy link
Collaborator

C47D commented Apr 13, 2020

I use the set_px_cb because one pixel is just one bit on the monochrome displays and so it's only used for these monochrome displays. And with this the buffer can be send to the display controller directly and thus efficiently. The rounder is necessary because both display driver use columns and pages (which is a height of 8 px und thus one byte), and thus we need to send complete pages to the display controller.

Thanks for the explanation, I'm a bit behind the internal working of lvgl, need to do some toy projects to get a lot more familiar with it :)

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants