Documentation Index
Fetch the complete documentation index at: https://mintlify.com/The-Young-Maker/OpenMenuOS/llms.txt
Use this file to discover all available pages before exploring further.
OpenMenuOS is the central controller for the entire menu system. You instantiate it once with your button pins, call begin() in setup(), and call loop() in Arduino’s main loop. Everything else — display rendering, input routing, animations, and screen transitions — is handled internally.
Constructor
-1 (disabled), so you can create an instance without arguments and configure pins separately via setUpPin(), setDownPin(), and setSelectPin().
GPIO pin for the UP button. Pass
-1 to disable.GPIO pin for the DOWN button. Pass
-1 to disable.GPIO pin for the SELECT button. Pass
-1 to disable.Core methods
begin(Screen* mainMenu)
Initializes the TFT display and enters the main menu screen using the default display rotation.
Pointer to the root screen shown on startup.
begin(int rotation, Screen* mainMenu)
Initializes the display with an explicit rotation value before entering the main menu.
Display rotation:
0, 1, 2, or 3.Pointer to the root screen shown on startup.
loop()
Processes input and redraws the current screen. Call this every iteration of Arduino’s loop().
redirectToScreen(Screen* screen)
Navigates programmatically to any screen, pushing the current screen onto the back-navigation stack.
Pointer to the target screen.
navigateBack()
Returns to the previous screen in the navigation history stack. Has no effect if you are already at the root.
getLibraryVersion()
Returns the version string of the library.
Returns: const char* — e.g. "3.1.0"
Display configuration
setDisplayRotation(int rotation)
Sets the TFT display rotation at runtime.
Rotation value
0–3.setOptimizeDisplayUpdates(bool enabled)
Enables frame comparison before pushing canvas data to the display. When enabled, the library skips the physical display write if the rendered frame is identical to the last one, reducing flicker and CPU overhead.
Pass
true to enable optimized updates.getOptimizeDisplayUpdates()
Returns the current state of display update optimization.
Returns: bool
drawCanvasOnTFT()
Manually pushes the current canvas sprite to the physical display. You rarely need to call this directly — loop() handles it — but it is useful inside custom drawing code when you need an explicit flush.
Styling
useStylePreset(char* preset)
Applies a named built-in style preset. Available values are "Default" and "Rabbit_R1".
Preset name:
"Default" or "Rabbit_R1".useStylePreset(int preset)
Applies a style preset by its numeric index instead of its name.
Preset index (e.g.
0 for Default, 1 for Rabbit_R1).setMenuStyle(int style)
Controls how the selection highlight is rendered.
0 = outlined selection rectangle, 1 = filled selection rectangle.setSelectionBorderColor(uint16_t color)
Sets the border color of the selection rectangle using RGB565 format.
RGB565 color value (e.g.
TFT_WHITE, TFT_CYAN).setSelectionFillColor(uint16_t color)
Sets the fill color of the selection rectangle.
RGB565 color value.
setScrollbar(bool enabled)
Shows or hides the scrollbar on menu and settings screens.
true to show the scrollbar, false to hide it.setScrollbarStyle(int style)
Controls the visual appearance of the scrollbar.
0 = Default style, 1 = Modern style.setScrollbarColor(uint16_t color)
Sets the color of the scrollbar track and thumb.
RGB565 color value.
Font configuration
setMenuFont(const GFXfont* font)
Sets the regular (non-selected) text font for menu items. Accepts any Adafruit GFX-compatible font pointer.
Pointer to a GFX font struct.
setMenuFontBold(const GFXfont* font)
Sets the bold font used for the currently selected menu item.
Pointer to a GFX font struct.
Input configuration
setButtonsMode(char* mode)
Configures the active voltage level for all buttons.
"High" if buttons read HIGH when pressed; "low" if they read LOW.setEncoderPin(uint8_t clk, uint8_t dt)
Enables rotary encoder input and assigns the CLK and DT pins. Enabling an encoder also activates encoder navigation inside PopupManager.
GPIO pin connected to the encoder CLK output.
GPIO pin connected to the encoder DT output.
setUpPin(uint8_t pin)
Assigns the UP button pin at runtime, overriding the constructor value.
GPIO pin number.
setDownPin(uint8_t pin)
Assigns the DOWN button pin at runtime.
GPIO pin number.
setSelectPin(uint8_t pin)
Assigns the SELECT button pin at runtime. Also used as the encoder push-button when an encoder is configured.
GPIO pin number.
Animation and behavior
setAnimation(bool enabled)
Enables or disables scroll animations for menu item transitions.
true to enable smooth animations.setTextScroll(bool enabled)
Controls horizontal scrolling for menu item labels that are too long to fit on screen.
true to enable text scrolling.setButtonAnimation(bool enabled)
Enables or disables the visual press animation shown when a button is activated.
true to enable button animations.Boot configuration
showBootImage(bool enabled)
Controls whether a boot image is displayed during initialization.
true to show the boot image on startup.setBootImage(uint16_t* image, uint16_t h, uint16_t w)
Provides a custom boot splash image as a raw RGB565 pixel array.
Pointer to the pixel data array in RGB565 format.
Height of the image in pixels.
Width of the image in pixels.
Utility
getTftHeight()
Returns the current display height in pixels.
Returns: int
getTftWidth()
Returns the current display width in pixels.
Returns: int
UpButton()
Returns the GPIO pin number assigned to the UP button.
Returns: int
DownButton()
Returns the GPIO pin number assigned to the DOWN button.
Returns: int
SelectButton()
Returns the GPIO pin number assigned to the SELECT button.
Returns: int