Elcdx.Driver.TextRenderer (elcdx v0.1.1)
View SourceHandles text rendering and formatting for the LCD display.
This module provides single-line text rendering with horizontal scrolling for text that exceeds the display width. Multi-line rendering and text wrapping have been removed to keep the implementation simple and focused.
Responsibilities
- Render text at current cursor position
- Handle horizontal scrolling for long text
- Control cursor visibility during rendering
- Truncate text when scrolling is disabled
Features
- Single-line Rendering: Text is rendered at current cursor position only
- Horizontal Scrolling: Long text scrolls horizontally with animation
- Text Truncation: Truncates text when scrolling is disabled
- No Multi-line: Text never wraps or moves to next line
Summary
Functions
Main entry point for printing text with options.
Functions
Main entry point for printing text with options.
Text is always rendered at the current cursor position. If the text is longer than the remaining space on the current line, it will either scroll horizontally (if scroll is enabled) or be truncated (if scroll is disabled).
Parameters
state: The driver state structtext: Text to display (single line only, newlines ignored)opts: Display options:show_cursor- Show cursor during display (default: false):scroll- Enable horizontal scrolling for long text (default: true)
Returns
:ok on success, {:error, reason} on failure.
Behavior
- Text longer than remaining space will scroll horizontally if
:scrollis true - Text longer than remaining space will be truncated if
:scrollis false - Newline characters in text are ignored (treated as regular characters)
- Cursor position is not automatically advanced to next line