Skip to main content

Module lvgl

Module lvgl 

Source
Expand description

Safe LVGL v9 wrappers for the oveRTOS Rust SDK.

Provides idiomatic Rust bindings matching the C++ ove::lvgl wrapper:

  • Minimal overhead — every widget is Copy + pointer-sized; per-op cost is benchmarked at https://varcain.github.io/oveRTOS/benchmarks/
  • Fluent API — method chaining via self -> Self on Copy types
  • Trait compositionLayout, Styleable, EventTarget blanket-impl on anything implementing Widget, replacing C++ CRTP mixins
  • RAIILvglGuard for lock/unlock, Style with Drop
  • no_std compatible — no allocator needed

Re-exports§

pub use crate::cell::LvCell;
pub use crate::cell::LvRefCell;

Modules§

display
Helpers querying the default LVGL display.

Structs§

Animation
Fluent builder for an LVGL animation.
Arc
LVGL arc widget — a circular gauge or slider. Track uses arc_color on LV_PART_MAIN, the filled indicator uses arc_color on LV_PART_INDICATOR, and the draggable knob uses bg_color on LV_PART_KNOB.
Bar
LVGL bar widget.
Box
Plain container object with scrolling disabled.
Button
LVGL button widget — a clickable container.
Calendar
LVGL calendar widget — month-grid date picker with optional arrow/dropdown navigation header.
Canvas
LVGL canvas — a widget backed by a user-supplied pixel buffer.
CanvasBuffer
Pixel storage for a Canvas. Borrows the buffer for the lifetime 'a.
Chart
LVGL chart widget — line / bar / scatter with multiple series and axes.
Checkbox
LVGL checkbox widget — a labelled binary toggle.
Color
RGB888 color matching lv_color_t { blue, green, red } layout.
ColorFormat
LVGL color format selector (matches LV_COLOR_FORMAT_*).
Dropdown
LVGL dropdown — click opens a popup list of options (newline-separated).
EventCtx
Borrowed view of an active lv_event_t. Valid only inside an event callback.
EventHandler
Static descriptor for a stateful event handler.
Group
RAII wrapper for an LVGL input focus group (lv_group_t).
Image
LVGL image widget.
ImageSrc
A safe LVGL image source, constructible only from 'static data.
Keyboard
LVGL on-screen keyboard. Attach to a Textarea so key presses flow into it.
Label
LVGL label widget.
Led
LVGL LED widget — a small colored indicator circle with adjustable brightness.
List
LVGL list — scrollable list of text headings and icon+text buttons.
LvglGuard
RAII guard for the LVGL mutex. Drop calls ove_lvgl_unlock().
Msgbox
LVGL message box widget — a modal dialog with optional title, body text, close button, and footer buttons.
Obj
Non-owning handle to an LVGL object (lv_obj_t *).
Roller
LVGL roller — iOS-picker-style scrollable option wheel.
Scale
LVGL scale widget — linear or radial scale with ticks and labels.
ScaleSection
Handle to an lv_scale_section_t *.
Screen
Top-level LVGL screen (display root without a parent).
Series
Handle to an lv_chart_series_t *. Owned by the Chart; non-owning copy.
Slider
LVGL slider widget. Shares the bar value/range shape and adds knob styling and drag interaction. Listen for changes with EventTarget::on_value_change.
Spinbox
LVGL spinbox — numeric stepper with + / buttons.
Spinner
LVGL spinner widget — a continuously rotating arc used as a loading indicator.
State
Reactive integer state backed by LVGL’s observer subsystem (lv_subject_t). Bind widget properties to a State and they update automatically when you call State::set.
Style
RAII wrapper around lv_style_t. Calls lv_style_reset on drop.
Switch
LVGL switch widget (binary toggle). State is tracked via STATE_CHECKED; listen for changes with EventTarget::on_value_change.
Table
LVGL table — 2D grid of cells with per-cell text.
Tabview
LVGL tabview — tabbed container with swipeable pages.
Textarea
LVGL textarea — single- or multi-line text input with placeholder, password mode, max length, and accepted-character filter.
Timer
RAII wrapper for LVGL’s built-in timer.

Enums§

FlexAlign
Flex track / item alignment (matches lv_flex_align_t).
FlexFlow
Flex flow direction.
LayoutKind
Container layout kind (matches lv_obj_set_layout argument).
Palette
LVGL palette family (matches LV_PALETTE_*).

Constants§

ALIGN_BOTTOM_LEFT
LVGL alignment constant: align to the bottom-left of the parent.
ALIGN_BOTTOM_MID
LVGL alignment constant: align to the bottom-center of the parent.
ALIGN_BOTTOM_RIGHT
LVGL alignment constant: align to the bottom-right of the parent.
ALIGN_CENTER
LVGL alignment constant: center the widget relative to its parent.
ALIGN_DEFAULT
LVGL alignment constant: default (inherit from parent).
ALIGN_LEFT_MID
LVGL alignment constant: align to the middle of the left edge.
ALIGN_RIGHT_MID
LVGL alignment constant: align to the middle of the right edge.
ALIGN_TOP_LEFT
LVGL alignment constant: align to the top-left of the parent.
ALIGN_TOP_MID
LVGL alignment constant: align to the top-center of the parent.
ALIGN_TOP_RIGHT
LVGL alignment constant: align to the top-right of the parent.
ANIM_REPEAT_INFINITE
LVGL repeat-forever sentinel for Animation::repeat_count.
CHART_AXIS_PRIMARY_X
Chart axis: primary X.
CHART_AXIS_PRIMARY_Y
Chart axis: primary Y.
CHART_AXIS_SECONDARY_X
Chart axis: secondary X.
CHART_AXIS_SECONDARY_Y
Chart axis: secondary Y.
CHART_TYPE_BAR
LVGL chart type: bar chart.
CHART_TYPE_LINE
LVGL chart type: line chart.
CHART_TYPE_NONE
LVGL chart type: no chart (empty).
CHART_TYPE_SCATTER
LVGL chart type: scatter chart.
CHART_UPDATE_MODE_CIRCULAR
Chart update mode: wrap around (circular buffer).
CHART_UPDATE_MODE_SHIFT
Chart update mode: shift existing points left when adding.
GRID_ALIGN_CENTER
Grid cell alignment: centred within the cell (LV_GRID_ALIGN_CENTER).
GRID_ALIGN_END
Grid cell alignment: flush with the cell’s end edge (LV_GRID_ALIGN_END).
GRID_ALIGN_START
Grid cell alignment: flush with the cell’s start edge (LV_GRID_ALIGN_START).
GRID_ALIGN_STRETCH
Grid cell alignment: stretch to fill the cell (LV_GRID_ALIGN_STRETCH).
GRID_CONTENT
Grid track size: size to content (LV_GRID_CONTENT). Equal to LV_COORD_MAX - 101.
GRID_TEMPLATE_LAST
Grid descriptor sentinel that terminates column/row arrays (LV_GRID_TEMPLATE_LAST). Equal to LV_COORD_MAX = (1 << 29) - 1.
KEYBOARD_MODE_NUMBER
Keyboard layout: numeric keypad.
KEYBOARD_MODE_SPECIAL
Keyboard layout: special characters.
KEYBOARD_MODE_TEXT_LOWER
Keyboard layout: lowercase QWERTY.
KEYBOARD_MODE_TEXT_UPPER
Keyboard layout: uppercase QWERTY.
PALETTE_BLUE
LVGL palette index for the blue palette family (LV_PALETTE_BLUE).
PART_INDICATOR
LVGL style selector for the indicator part (e.g. bar fill, checkbox mark).
PART_ITEMS
LVGL style selector for the items part (e.g. table cells, list items).
PART_KNOB
LVGL style selector for the knob of interactive widgets (slider, arc).
PART_MAIN
LVGL style selector for the main (background) part of a widget.
ROLLER_MODE_INFINITE
Roller mode: infinite — selection can wrap through the list repeatedly.
ROLLER_MODE_NORMAL
Roller mode: normal — selection clamps at ends of the list.
SCALE_MODE_HORIZONTAL_BOTTOM
SCALE_MODE_HORIZONTAL_TOP
LVGL scale modes (LV_SCALE_MODE_*).
SCALE_MODE_ROUND_INNER
SCALE_MODE_ROUND_OUTER
SCALE_MODE_VERTICAL_LEFT
SCALE_MODE_VERTICAL_RIGHT
SIZE_CONTENT
LVGL v9 LV_SIZE_CONTENT — sets widget to size-to-content mode. Computed from: LV_COORD_SET_SPEC(LV_COORD_MAX) where LV_COORD_TYPE_SHIFT = 29, giving ((1<<29)-1) | (1<<29).
STATE_CHECKED
LVGL state bit for checked/toggled widgets (LV_STATE_CHECKED).
TEXT_ALIGN_AUTO
Text alignment selector (LV_TEXT_ALIGN_*).
TEXT_ALIGN_CENTER
TEXT_ALIGN_LEFT
TEXT_ALIGN_RIGHT

Traits§

EventTarget
Event callback registration. Uses fn pointers for no_std compatibility. Blanket-implemented for all Widget types.
Layout
Fluent positioning, sizing, and flag manipulation. Blanket-implemented for all Widget types.
Styleable
Fluent inline style setters. Applied to LV_PART_MAIN by default. Blanket-implemented for all Widget types.
Widget
Core trait for all LVGL widget wrappers. Provides access to the raw lv_obj_t pointer. All higher-level traits (Layout, Styleable, EventTarget) are blanket-implemented for any type implementing Widget.

Functions§

animate_arc_value
Animate an Arc widget’s value from from to to over duration_ms.
animate_arc_value_playback
Animate an Arc value forward then back, looping forever.
animate_opa
Fade an object’s main-part opacity from from to to over duration_ms.
animate_scroll_y
Animate the vertical scroll position to to (no easing — direct scroll).
animate_scroll_y_playback
Animate the vertical scroll position forward then back, looping forever.
animate_translate_y
Animate the translate_y style property from from to to over duration_ms (ease-in-out).
animate_translate_y_playback
Animate translate_y forward for forward_ms then back for playback_ms, looping forever. Useful for subtle “shake” / bob animations.
animate_width
Animate an object’s width to to over duration_ms (ease-out).
animate_x
Animate an object’s X position to to over duration_ms (ease-out).
animate_y
Animate an object’s Y position to to over duration_ms (ease-out).
component_from_event
Walk up from the event’s target through the parent chain looking for any non-null user_data pointer, returning the first one found.
font_montserrat_14
Safe pointer to lv_font_montserrat_14.
font_montserrat_24
Safe pointer to lv_font_montserrat_24.
font_montserrat_32
Safe pointer to lv_font_montserrat_32.
grid_fr
Grid track size: fractional unit. grid_fr(1) means “one FR unit”. Equal to LV_COORD_MAX - 100 + x.
handler
Run the LVGL task handler.
hbox
Create a horizontal flex container.
init
Initialize LVGL via ove_lvgl_init().
layer_top
Top-most overlay layer of the default display (sits above all screens).
lock
Acquire the LVGL mutex and return an RAII guard.
path_bounce
Bounce path (lv_anim_path_bounce).
path_ease_in
Ease-in path (lv_anim_path_ease_in).
path_ease_in_out
Ease-in-out path (lv_anim_path_ease_in_out).
path_ease_out
Ease-out path (lv_anim_path_ease_out).
path_linear
Linear easing path (lv_anim_path_linear).
path_overshoot
Overshoot path (lv_anim_path_overshoot).
path_step
Step path (lv_anim_path_step).
screen_active
Get the currently active screen.
stop_animations
Stop all animations with any exec callback running on obj.
text_size
Measure the rendered size of text using font. Returns (width, height) in pixels.
tick
Feed LVGL tick counter.
vbox
Create a vertical flex container.

Type Aliases§

ImageDsc
Safe re-export of the LVGL image descriptor type, so generated asset modules (e.g. images::badge) can declare their externals without needing to reach into the ove::ffi escape hatch.