Swtich screens with hardware buttons and monochrome display


I have a monochrome display and a device with four hardware (tact) buttons. Would like to use the buttons to switch screens as well as navigate between elements on specific screens.

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

I use NuttX on Nucleo L476 with a Sharp Memory LCD

What do you want to achieve?

Since this display is small and only input are these four buttons, I do not have interactive elements most of the time (I display sensor data). The idea is to be able to switch between different screens showing different values using these buttons. For example: two buttons alternate between screens associated to different sensors and the other two between “sub-screens”, which are screens with different display options of the same data.
As the device will have a special settings screen with menus, I would like to the settings screen be entered with a long press of a given button. Once inside this screen, two buttons would be used to navigate elements (up/down) and the other two to change a setting or go back (outside the settings menu).

What have you tried so far?

From what I understand from the documentation, I would need to register my input device as a keypad since this would let me send appropriate events to switch elements when inside the settings menu. However, when not on the menu, buttons should not traverse elements but directly switch screens. I see there is not “change screen” key option and also no notion of next/previous screen, so I understand changing screens should be done on my own. Where should I then place the screen loading call? Inside the read_cb? In order to avoid the keys being used to traverse elements when not on the menu, should I make littlevgl think no button was called from this callback? How can I receive the long-press event myself in this case? I understand this event is received by a focused object.

I’ve read about the idea of having transparent buttons but that really sounds a bit of a hack since it would really complicate things inside the menu system.

Code to reproduce

Screenshot and/or video

Dear v01d!

First sounds the transparent buttons don’t seems bad idea in my opinion. Now i am making an application, with more screens, and with 2 push button. Now i am in the phase of making the GUI’s basics. I made a list, wich can select the screen where I want to switch. One button to select the next list entry, and one to enter. Now I simulate it on PC, and use 2 buttons on the right of the screen. I am using their event_callback, inside the event_handler using “LV_EVENT_CLICKED” case.


Now I do not know what type of input device I will choose, but now this seems easy.
You can make the buttons own release-action int its event handler, it can be screen switch or enter to sub-menu, or back, or navigation…


Some weeks later I will have more experience about this.