Raspberry Pico with Monochrome SH1106 Display Driver

Raspberry Pico with Monochrome SH1106 Display Driver
Since I could not find any help with getting LVGL 9.2 up and running on a Raspberry Pico, I’ll share what I’ve gotten so far.

Repository: sdwood68/Pico_lvgl: Raspberry Pico with LVGL
Processor: RP2040
Display: Generic 128x64 monochrome OLED display with SH1106 chip and I2C interface
IDE: Visual Studio code 1.98.2
LVGL: v9.2
OS: None

What I’ve accomplished:

  • I’m able to display “Hello World”

To Do:

  • Add button scanning routine to control UI
  • Develop a basic UI

Thank you for sharing it!

Can’t figure out how to edit the first post to update my progress, so I’m adding it in the replies.

What I’ve accomplished:

  • Custom font for better look on the display
  • LVGL Menu with a title and 5 menu items.
  • Event call back for the menu allows scrolling through the menu items with up / down arrow keys.
  • Values associated with each item can be changed with the right / left arrow key.
  • Dynamically update the menu items label as the values change.

To Do

  • Learn how to use styles better.
    • Instead of the default style for a focused item in the menu that inverts the background color and text. I want it to just place a box with rounded corners around the focused item.
  • Add a default screen that has two vales that can be updated with the up/down keys for one and left/right keys for the other.
  • Enter the parameter menu on long press of the enter key.
1 Like

Hello, very sorry to use this thread to solicit some advice but I am very stuck. I regard myself as a sophisticated LVGL user and have used it in many displays. I write my own drivers and I am certain that my SPI driver is fine as I can send any colour and image Iike and it works (outside LVGL that is). My problems started with a switch to 9.2 and I have been struggling for weeks. I use RGB888, not 565, and I am told that px_map is a simple one dimensional array of uint8_t pixel data. It isn’t that. LVGL renders whatever simple objects or just colours as a header of 0xFF followed by bytes unrelated to the objects I call. I have enabled RGB888 in the lv_conf (of course) but can not see in the lv_conf template anything else I need to change but I am sure the problem is in there somewhere. The forum is of little help as everyone seems to use 565 and not 888. Sorry to impose like this, but I have had lots of success with LVGL and am trying to get 9.2 working. Thank you

Hey,
What is the value of LV_COLOR_DEPTH? If you set it to 24 the default color format will be RGB888.

Please also carefully read this migration guide as there are some driver related changes in v9.

Hello,
Very many thanks indeed, I much appreciate your time. I have used LVGL for years and I understand the requirements for RGB888 and I set that at the very start. I have fixed it, but I don’t know how! In despair I just removed random chunks of lv_conf and it suddenly worked. px_map went from a long header of OxFF followed by strange bytes to exactly the array of pixel data I was expecting. I ran a file diff to see the changes from my cut down lv_conf from the original (based on the lv_conf_template) so I can reproduce for future projects as LVGL is my graphics engine of choice. It was just the change to 9.2 which caused me a bit of confusion.
But many thanks again.

Hmm, it’s interesting. Can you share what you have changed in lv_conf.h that made it work?

Hello,
I shall do my best (but I was randomly fiddling with menuconfig - I use esp-idf as well)!
Thanks again

Oh, I see. Maybe it’s ESP related

Could be, and I use freeRTOS a lot as well. I just need to catch up with this project and get it put to bed but I will go back later and try and understand why px_map could be affected in either lv_conf or menuconfig (even though RGB888) was set from the start.
Very many thanks again for your time and interest.