Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions include/graphics/driver/SDLDriver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once
#include "graphics/driver/DisplayDriver.h"

/**
* @brief For simulation on pc/raspberry
* This class provides an SDL GUI on the local desktop; dimensions are defined
* in lv_drv_conf.h Usage: define USE_SDL=1 for the rasbian/portduino target and
* link with -lSDL
*/
class SDLDriver : public DisplayDriver
{
public:
static SDLDriver &create(uint16_t width, uint16_t height);
void init(DeviceGUI *gui) override;
void task_handler(void) override;
virtual ~SDLDriver() {}

private:
SDLDriver(uint16_t width, uint16_t height);

static SDLDriver *SDLdriver;
};
7 changes: 3 additions & 4 deletions include/graphics/driver/TFTDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ template <class TFT> void TFTDriver<TFT>::init(DeviceGUI *gui)
lv_tick_set_cb(xTaskGetTickCount);
#else
// Create esp timer to call lvgl lv_tick_inc()
const esp_timer_create_args_t lvgl_tick_timer_args = {.callback = [](void *arg) { lv_tick_inc(20); }, .name = "lvgl_tick"};
const esp_timer_create_args_t lvgl_tick_timer_args = {.callback = [](void *arg) { lv_tick_inc(5); }, .name = "lvgl_tick"};
esp_timer_handle_t lvgl_tick_timer = nullptr;
ESP_ERROR_CHECK(esp_timer_create(&lvgl_tick_timer_args, &lvgl_tick_timer));
ESP_ERROR_CHECK(esp_timer_start_periodic(lvgl_tick_timer, 20000));
ESP_ERROR_CHECK(esp_timer_start_periodic(lvgl_tick_timer, 5000));
#endif
#elif defined(ARCH_PORTDUINO)
// for linux we use lv_tick_inc() in DeviceGUI::task_handler()
// lv_tick_set_cb([]() -> uint32_t { return millis(); });
lv_tick_set_cb([]() -> uint32_t { return millis(); });
#endif
}
1 change: 1 addition & 0 deletions include/graphics/driver/X11Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class X11Driver : public DisplayDriver
public:
static X11Driver &create(uint16_t width, uint16_t height);
void init(DeviceGUI *gui) override;
void task_handler(void) override;
virtual ~X11Driver() {}

private:
Expand Down
Loading