1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
2 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial |
3 | |
4 | #pragma once |
5 | |
6 | #include "slint-platform.h" |
7 | #include "esp_lcd_touch.h" |
8 | #include "esp_lcd_types.h" |
9 | |
10 | /** |
11 | * Initialize the Slint platform for ESP-IDF |
12 | * |
13 | * This must be called before any other call to the slint library. |
14 | * |
15 | * - `size` is the size of the screen |
16 | * - `panel` is a handle to the display. |
17 | * - `touch` is a handle to the touch screen, if the device has a touch screen |
18 | * - `buffer1` is a buffer of at least the size of the frame in which the slint scene will be drawn. |
19 | * Slint will take care to flush it to the screen |
20 | * - `buffer2`, if specified, is a second buffer to be used with double buffering, |
21 | * both buffer1 and buffer2 should then be obtained with `esp_lcd_rgb_panel_get_frame_buffer` |
22 | * - `rotation` applies a transformation while rendering in the buffer |
23 | */ |
24 | void slint_esp_init(slint::PhysicalSize size, esp_lcd_panel_handle_t panel, |
25 | std::optional<esp_lcd_touch_handle_t> touch, |
26 | std::span<slint::platform::Rgb565Pixel> buffer1, |
27 | std::optional<std::span<slint::platform::Rgb565Pixel>> buffer2 = {} |
28 | #ifdef SLINT_FEATURE_EXPERIMENTAL |
29 | , |
30 | slint::platform::SoftwareRenderer::RenderingRotation rotation = {} |
31 | #endif |
32 | ); |
33 | |