Skip to content

Commit

Permalink
Rename touch and panel to touch_handle and panel_handle and document …
Browse files Browse the repository at this point in the history
…their nullptr values
  • Loading branch information
tronical committed Jul 8, 2024
1 parent 4c432c2 commit 6750a45
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions api/cpp/esp-idf/slint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ extern "C" void app_main(void)
/* Initialize Slint's ESP platform support*/
slint_esp_init(SlintPlatformConfiguration {
.size = slint::PhysicalSize({ BSP_LCD_H_RES, BSP_LCD_V_RES }),
.panel = panel_handle,
.touch = touch_handle,
.panel_handle = panel_handle,
.touch_handle = touch_handle,
.buffer1 = buffer,
.color_swap_16 = true });

Expand Down
9 changes: 5 additions & 4 deletions api/cpp/esp-idf/slint/include/slint-esp.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ struct SlintPlatformConfiguration
/// The size of the screen in pixels.
slint::PhysicalSize size;
/// The handle to the display as previously initialized by `bsp_display_new` or
/// `esp_lcd_panel_init`.
esp_lcd_panel_handle_t panel = nullptr;
/// The touch screen handle, if the device is equipped with a touch screen.
esp_lcd_touch_handle_t touch = nullptr;
/// `esp_lcd_panel_init`. Must be set to a valid, non-null esp_lcd_panel_handle_t.
esp_lcd_panel_handle_t panel_handle = nullptr;
/// The touch screen handle, if the device is equipped with a touch screen. Set to nullptr
/// otherwise;
esp_lcd_touch_handle_t touch_handle = nullptr;
/// The buffer Slint will render into. It must have have the size of at least one frame. Slint
/// calls esp_lcd_panel_draw_bitmap to flush the buffer to the screen.
std::optional<std::span<slint::platform::Rgb565Pixel>> buffer1 = {};
Expand Down
12 changes: 6 additions & 6 deletions api/cpp/esp-idf/slint/src/slint-esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ struct EspPlatform : public slint::platform::Platform
{
EspPlatform(const SlintPlatformConfiguration &config)
: size(config.size),
panel_handle(config.panel),
touch_handle(config.touch),
panel_handle(config.panel_handle),
touch_handle(config.touch_handle),
buffer1(config.buffer1),
buffer2(config.buffer2),
color_swap_16(config.color_swap_16),
Expand Down Expand Up @@ -327,8 +327,8 @@ void slint_esp_init(slint::PhysicalSize size, esp_lcd_panel_handle_t panel,

SlintPlatformConfiguration config {
.size = size,
.panel = panel,
.touch = touch ? *touch : nullptr,
.panel_handle = panel,
.touch_handle = touch ? *touch : nullptr,
.buffer1 = buffer1,
.buffer2 = buffer2,
// For compatibility with earlier versions of Slint, we compute the value of
Expand All @@ -344,8 +344,8 @@ void slint_esp_init(slint::PhysicalSize size, esp_lcd_panel_handle_t panel,
slint::platform::SoftwareRenderer::RenderingRotation rotation)
{
SlintPlatformConfiguration config { .size = size,
.panel = panel,
.touch = touch ? *touch : nullptr,
.panel_handle = panel,
.touch_handle = touch ? *touch : nullptr,
.buffer1 = std::nullopt,
.buffer2 = std::nullopt,
.rotation = rotation,
Expand Down
4 changes: 2 additions & 2 deletions examples/carousel/esp-idf/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ extern "C" void app_main(void)

slint_esp_init(SlintPlatformConfiguration {
.size = slint::PhysicalSize({ BSP_LCD_H_RES, BSP_LCD_V_RES }),
.panel = panel_handle,
.touch = touch_handle,
.panel_handle = panel_handle,
.touch_handle = touch_handle,
.buffer1 = buffer,
.color_swap_16 = true });

Expand Down
4 changes: 2 additions & 2 deletions examples/printerdemo_mcu/esp-idf/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ extern "C" void app_main(void)

slint_esp_init(SlintPlatformConfiguration {
.size = slint::PhysicalSize({ BSP_LCD_H_RES, BSP_LCD_V_RES }),
.panel = panel_handle,
.touch = touch_handle,
.panel_handle = panel_handle,
.touch_handle = touch_handle,
.buffer1 = buffer,
.color_swap_16 = true });

Expand Down

0 comments on commit 6750a45

Please sign in to comment.