Skip to content

Commit 953cf40

Browse files
committed
docs: clarify RGB LCD driver commands
Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
1 parent 66bc514 commit 953cf40

1 file changed

Lines changed: 34 additions & 11 deletions

File tree

docs/display-drivers.md

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,16 @@ These sequences are highly specific to each display model and typically come fro
324324

325325
### RGB LCD Panels (esp_lcd,rgb)
326326

327-
RGB LCD panels driven through the ESP32-S3 RGB LCD peripheral. Requires ESP-IDF 5 or later.
327+
RGB LCD panels driven through the ESP32-S3 RGB LCD peripheral. Requires ESP-IDF 5 or later and is compiled only for `esp32s3` targets.
328328

329329
Developed and tested on the **Waveshare ESP32-S3 7-inch RGB Touch LCD** (800×480, 16-bit RGB565 parallel interface).
330330

331331
**Compatible strings:** `"esp_lcd,rgb"` or `"waveshare,esp32-s3-touch-lcd-7"`
332332

333+
**Note:** The Waveshare compatible string names the board/display model. This driver covers the RGB LCD panel path; touch input is handled separately.
334+
335+
Other ESP32 targets do not pull in the `esp_lcd` dependency or the RGB LCD driver source.
336+
333337
| Option | Type | Description | Default |
334338
|--------|------|-------------|---------|
335339
| `width` | integer | Display width in pixels | 800 |
@@ -395,28 +399,47 @@ like progress bars or dynamic text fields where a full-screen redraw is unnecess
395399
:port.call(display, {:update_region, x, y, width, height, display_list}, 500)
396400
```
397401

402+
When using transparent or anti-aliased text in a region update, include a solid
403+
background item behind the updated area in the display list. Transparent pixels
404+
are resolved against lower display-list items; without a solid background,
405+
results may depend on previous framebuffer contents.
406+
407+
### register_font
408+
409+
Registers a uFont binary under an atom handle. Use the same handle later in text
410+
items or `measure_text` calls.
411+
412+
```elixir
413+
font_binary = File.read!("NotoSans.ufont")
414+
:port.call(display, {:register_font, :noto_sans_24, font_binary}, 5000)
415+
```
416+
398417
### measure_text
399418

400-
Returns the pixel width and height of a text string for a registered uFont handle.
401-
Use this to size marquee regions or layout before building a display list.
419+
Returns the pixel width and height of a binary text string for a registered
420+
uFont handle. Use this to size marquee regions or layout before building a
421+
display list. Unknown font handles currently return `{:ok, 0, 0}`.
402422

403423
```elixir
404-
# {:ok, width, height} or {:error, reason}
405-
:port.call(display, {:measure_text, :default16px, "Hello"}, 500)
424+
# Returns {:ok, width, height}; allocation failure returns :error.
425+
:port.call(display, {:measure_text, :noto_sans_24, "Hello"}, 500)
406426
```
407427

408428
### draw_buffer
409429

410-
Draws a preformatted RGB565 buffer already resident in memory. Each pixel is 2 bytes
411-
in little-endian RGB565 format. The buffer address is passed as two 32-bit integers
412-
(low and high halves). Use with image tuples such as `{:rgb565, width, height, binary}`
413-
after loading the buffer into device memory.
430+
Draws a preformatted RGB565 binary. Each pixel is 2 bytes in little-endian
431+
RGB565 format. The binary size must be exactly `width × height × 2` bytes.
432+
Use this with image tuples such as `{:rgb565, width, height, binary}`.
414433

415434
```elixir
416-
# Draw a 100×100 pre-formatted RGB565 image at (10, 10)
417-
:port.call(display, {:draw_buffer, 10, 10, 100, 100, addr_low, addr_high}, 5000)
435+
# Draw a 100×100 preformatted RGB565 image at (10, 10)
436+
:port.call(display, {:draw_buffer, 10, 10, 100, 100, rgb565_binary}, 5000)
418437
```
419438

439+
Advanced native callers may also pass a pointer form as
440+
`{:draw_buffer, x, y, width, height, addr_low, addr_high}` when the RGB565 buffer
441+
is already resident in device memory.
442+
420443
## Updating the Display
421444

422445
Once configured, update the display using the display port:

0 commit comments

Comments
 (0)