Skip to content

Commit 171539a

Browse files
committed
docs: document draw_buffer and rgb565 image tuples
Replace draw_rgb565_raw documentation with draw_buffer and describe the rgb565 image tuple format for direct buffer delivery. Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
1 parent 60365e1 commit 171539a

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

docs/display-drivers.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ Developed and tested on the **Waveshare ESP32-S3 7-inch RGB Touch LCD** (800×48
352352

353353
The RGB LCD driver supports double framebuffering in PSRAM when available for
354354
tear-free rendering. It provides the standard `update` and `update_region` port
355-
commands, plus `draw_rgb565_raw` for direct RGB565 binary frame delivery.
355+
commands, plus `draw_buffer` for direct RGB565 buffer delivery from image tuples.
356356

357357
**Example:**
358358
```elixir
@@ -395,17 +395,16 @@ like progress bars or dynamic text fields where a full-screen redraw is unnecess
395395
:port.call(display, {:update_region, x, y, width, height, display_list}, 500)
396396
```
397397

398-
### draw_rgb565_raw
398+
### draw_buffer
399399

400-
Draws raw RGB565 binary pixel data directly to the display. Each pixel is 2 bytes
401-
in little-endian RGB565 format. The binary must contain exactly `width × height × 2`
402-
bytes. This is a low-level direct-buffer path for preformatted RGB565 data; the
403-
regular image tuple API remains the preferred route for encoded image assets.
400+
Draws a preformatted RGB565 buffer already resident in memory. Each pixel is 2 bytes
401+
in little-endian RGB565 format. The buffer address is passed as two 32-bit integers
402+
(low and high halves). Use with image tuples such as `{:rgb565, width, height, binary}`
403+
after loading the buffer into device memory.
404404

405405
```elixir
406406
# Draw a 100×100 pre-formatted RGB565 image at (10, 10)
407-
rgb565_binary = <<...>>
408-
:port.call(display, {:draw_rgb565_raw, 10, 10, 100, 100, rgb565_binary}, 5000)
407+
:port.call(display, {:draw_buffer, 10, 10, 100, 100, addr_low, addr_high}, 5000)
409408
```
410409

411410
## Updating the Display

docs/primitives.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ The format tag indicates the pixel format. For example, `rgba8888` means:
101101
- Byte order: R, G, B, A
102102
- Each component is 8 bits
103103

104+
`rgb565` means:
105+
- 16-bit RGB565 pixels
106+
- Byte order: little-endian
107+
- 2 bytes per pixel (`width × height × 2` bytes total)
108+
- Use with `draw_buffer` for direct framebuffer delivery on RGB LCD drivers
109+
104110
**Important:** Width and height must exactly match the dimensions of the image data in the binary.
105111
Incorrect values will result in corrupted image display.
106112

0 commit comments

Comments
 (0)