From a06942e44676ef4b39355d73645201f30a81f78b Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Wed, 10 Mar 2021 20:03:39 +0100 Subject: [PATCH] Update driver includes --- src/dev/device.cpp | 10 --- src/drv/tft_driver_sdl2.cpp | 98 +++++++++++----------- src/drv/tft_driver_sdl2.h | 20 +++-- src/drv/tft_espi_drv.cpp | 4 +- src/hasp_gui.cpp | 2 - tools/windows_build_extra.py | 2 +- user_setups/linux_sdl/linux_sdl_64bits.ini | 2 +- user_setups/win32/windows_sdl_64bits.ini | 2 +- 8 files changed, 68 insertions(+), 72 deletions(-) diff --git a/src/dev/device.cpp b/src/dev/device.cpp index dd5b7531..395a6e43 100644 --- a/src/dev/device.cpp +++ b/src/dev/device.cpp @@ -1,12 +1,2 @@ /* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ - -#include "device.h" - -#if defined(LANBONL8) -#warning Lanbon L8 -#elif defined(M5STACK) -#warning M5 Stack -#else -#warning Generic Device -#endif \ No newline at end of file diff --git a/src/drv/tft_driver_sdl2.cpp b/src/drv/tft_driver_sdl2.cpp index b0079ec2..86acce44 100644 --- a/src/drv/tft_driver_sdl2.cpp +++ b/src/drv/tft_driver_sdl2.cpp @@ -9,11 +9,14 @@ #include "display/monitor.h" #include "indev/mouse.h" +#include "drv/tft_driver.h" #include "tft_driver_sdl2.h" #include "dev/device.h" #include "hasp_debug.h" +#include "tft_driver_sdl2.h" + //#include "bootscreen.h" // Sketch tab header for xbm images namespace dev { @@ -35,62 +38,63 @@ static int tick_thread(void* data) return 0; } - void TftSdl2::init(int w, int h) - { +void TftSdl::init(int w, int h) +{ // Workaround for sdl2 `-m32` crash // https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/1775067/comments/7 #ifndef WIN32 - setenv("DBUS_FATAL_WARNINGS", "0", 1); + setenv("DBUS_FATAL_WARNINGS", "0", 1); #endif - /* Add a display - * Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/ - monitor_init(); - monitor_title(haspDevice.get_hostname()); + /* Add a display + * Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/ + monitor_init(); + monitor_title(haspDevice.get_hostname()); - /* Add the mouse as input device - * Use the 'mouse' driver which reads the PC's mouse*/ - mouse_init(); + /* Add the mouse as input device + * Use the 'mouse' driver which reads the PC's mouse*/ + mouse_init(); - /* Tick init. - * You have to call 'lv_tick_inc()' in periodically to inform LittelvGL about how much time were elapsed - * Create an SDL thread to do this*/ - SDL_CreateThread(tick_thread, "tick", NULL); - } - void TftSdl2::show_info() - { - SDL_version linked; - SDL_GetVersion(&linked); - LOG_VERBOSE(TAG_TFT, F("SDL2 : v%d.%d.%d"), linked.major, linked.minor, linked.patch); - LOG_VERBOSE(TAG_TFT, F("Driver : SDL2")); - } + /* Tick init. + * You have to call 'lv_tick_inc()' in periodically to inform LittelvGL about how much time were elapsed + * Create an SDL thread to do this*/ + SDL_CreateThread(tick_thread, "tick", NULL); +} +void TftSdl::show_info() +{ + SDL_version linked; + SDL_GetVersion(&linked); + LOG_VERBOSE(TAG_TFT, F("SDL2 : v%d.%d.%d"), linked.major, linked.minor, linked.patch); + LOG_VERBOSE(TAG_TFT, F("Driver : SDL2")); +} - void TftSdl2::splashscreen() - { - // tft.fillScreen(TFT_DARKCYAN); - // int x = (tft.width() - logoWidth) / 2; - // int y = (tft.height() - logoHeight) / 2; - // tft.drawXBitmap(x, y, bootscreen, logoWidth, logoHeight, TFT_WHITE); - } - void TftSdl2::set_rotation(uint8_t rotation) - {} - void set_invert(bool invert) - {} - static void TftSdl2::flush_pixels(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p) - { - monitor_flush(disp, area, color_p); - } - bool TftSdl2:is_driver_pin(uint8_t pin) - { - return false; - } - const char* TftSdl2::get_tft_model() - { - return "SDL2"; - } +void TftSdl::splashscreen() +{ + // tft.fillScreen(TFT_DARKCYAN); + // int x = (tft.width() - logoWidth) / 2; + // int y = (tft.height() - logoHeight) / 2; + // tft.drawXBitmap(x, y, bootscreen, logoWidth, logoHeight, TFT_WHITE); +} +void TftSdl::set_rotation(uint8_t rotation) +{} +void TftSdl::set_invert(bool invert) +{} +void TftSdl::flush_pixels(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p) +{ + monitor_flush(disp, area, color_p); +} +bool TftSdl::is_driver_pin(uint8_t pin) +{ + return false; +} +const char* TftSdl::get_tft_model() +{ + return "SDL2"; +} } // namespace dev -dev::TftSdl2 haspTft; -#endif \ No newline at end of file +dev::TftSdl haspTft; + +#endif // WINDOWS || POSIX \ No newline at end of file diff --git a/src/drv/tft_driver_sdl2.h b/src/drv/tft_driver_sdl2.h index 47cfe712..d4c453eb 100644 --- a/src/drv/tft_driver_sdl2.h +++ b/src/drv/tft_driver_sdl2.h @@ -1,34 +1,38 @@ - /* MIT License - Copyright (c) 2019-2021 Francis Van Roie - For full license information read the LICENSE file in the project folder */ +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie + For full license information read the LICENSE file in the project folder */ #ifndef HASP_SDL2_DRIVER_H #define HASP_SDL2_DRIVER_H +#include "tft_driver.h" + #if defined(WINDOWS) || defined(POSIX) +#warning Building H driver TFT SDL2 #include "lvgl.h" -#include "tft_driver.h" #include "indev/mouse.h" namespace dev { -class TftSdl2 : BaseTft { +class TftSdl : BaseTft { public: void init(int w, int h); void show_info(); void splashscreen(); + void set_rotation(uint8_t rotation); void set_invert(bool invert); - static void flush_pixels(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p); + + void flush_pixels(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p); bool is_driver_pin(uint8_t pin); + const char* get_tft_model(); }; } // namespace dev -using dev::TftSdl2; -extern dev::TftSdl2 haspTft; - #endif // defined(WINDOWS) || defined(POSIX) #endif // HASP_SDL2_DRIVER_H +using dev::TftSdl; +extern dev::TftSdl haspTft; diff --git a/src/drv/tft_espi_drv.cpp b/src/drv/tft_espi_drv.cpp index 9fdc66c6..5d1bd236 100644 --- a/src/drv/tft_espi_drv.cpp +++ b/src/drv/tft_espi_drv.cpp @@ -6,6 +6,8 @@ *********************/ #include "hasp_conf.h" +#if defined(TOUCH_CS) + #include "hal/hasp_hal.h" // for halGpioName() #include "dev/device.h" #include "drv/tft_driver.h" @@ -14,8 +16,6 @@ #include "ArduinoLog.h" #include "hasp_macro.h" -#if defined(TOUCH_CS) - void tft_espi_calibrate(uint16_t* calData) { haspTft.tft.fillScreen(TFT_BLACK); diff --git a/src/hasp_gui.cpp b/src/hasp_gui.cpp index ad9e7ba2..51942d63 100644 --- a/src/hasp_gui.cpp +++ b/src/hasp_gui.cpp @@ -26,8 +26,6 @@ #include "hasplib.h" - - //#include "tpcal.h" //#include "Ticker.h" diff --git a/tools/windows_build_extra.py b/tools/windows_build_extra.py index 72e4d78f..9d7c5810 100644 --- a/tools/windows_build_extra.py +++ b/tools/windows_build_extra.py @@ -1,4 +1,4 @@ -Import("env", "projenv") +Import("env") env.Append( LINKFLAGS=[ diff --git a/user_setups/linux_sdl/linux_sdl_64bits.ini b/user_setups/linux_sdl/linux_sdl_64bits.ini index 7587733c..33fb9537 100644 --- a/user_setups/linux_sdl/linux_sdl_64bits.ini +++ b/user_setups/linux_sdl/linux_sdl_64bits.ini @@ -80,7 +80,7 @@ src_filter = - - - - - + + - - + diff --git a/user_setups/win32/windows_sdl_64bits.ini b/user_setups/win32/windows_sdl_64bits.ini index 9245c7ca..a679a63d 100644 --- a/user_setups/win32/windows_sdl_64bits.ini +++ b/user_setups/win32/windows_sdl_64bits.ini @@ -101,7 +101,7 @@ src_filter = - - - - - + + - - +