Update driver includes

This commit is contained in:
fvanroie 2021-03-10 20:03:39 +01:00
parent 93f09dc7df
commit a06942e446
8 changed files with 68 additions and 72 deletions

View File

@ -1,12 +1,2 @@
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie /* MIT License - Copyright (c) 2019-2021 Francis Van Roie
For full license information read the LICENSE file in the project folder */ 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

View File

@ -9,11 +9,14 @@
#include "display/monitor.h" #include "display/monitor.h"
#include "indev/mouse.h" #include "indev/mouse.h"
#include "drv/tft_driver.h"
#include "tft_driver_sdl2.h" #include "tft_driver_sdl2.h"
#include "dev/device.h" #include "dev/device.h"
#include "hasp_debug.h" #include "hasp_debug.h"
#include "tft_driver_sdl2.h"
//#include "bootscreen.h" // Sketch tab header for xbm images //#include "bootscreen.h" // Sketch tab header for xbm images
namespace dev { namespace dev {
@ -35,62 +38,63 @@ static int tick_thread(void* data)
return 0; return 0;
} }
void TftSdl2::init(int w, int h) void TftSdl::init(int w, int h)
{ {
// Workaround for sdl2 `-m32` crash // Workaround for sdl2 `-m32` crash
// https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/1775067/comments/7 // https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/1775067/comments/7
#ifndef WIN32 #ifndef WIN32
setenv("DBUS_FATAL_WARNINGS", "0", 1); setenv("DBUS_FATAL_WARNINGS", "0", 1);
#endif #endif
/* Add a display /* Add a display
* Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/ * Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/
monitor_init(); monitor_init();
monitor_title(haspDevice.get_hostname()); monitor_title(haspDevice.get_hostname());
/* Add the mouse as input device /* Add the mouse as input device
* Use the 'mouse' driver which reads the PC's mouse*/ * Use the 'mouse' driver which reads the PC's mouse*/
mouse_init(); mouse_init();
/* Tick init. /* Tick init.
* You have to call 'lv_tick_inc()' in periodically to inform LittelvGL about how much time were elapsed * 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*/ * Create an SDL thread to do this*/
SDL_CreateThread(tick_thread, "tick", NULL); SDL_CreateThread(tick_thread, "tick", NULL);
} }
void TftSdl2::show_info() void TftSdl::show_info()
{ {
SDL_version linked; SDL_version linked;
SDL_GetVersion(&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("SDL2 : v%d.%d.%d"), linked.major, linked.minor, linked.patch);
LOG_VERBOSE(TAG_TFT, F("Driver : SDL2")); LOG_VERBOSE(TAG_TFT, F("Driver : SDL2"));
} }
void TftSdl2::splashscreen() void TftSdl::splashscreen()
{ {
// tft.fillScreen(TFT_DARKCYAN); // tft.fillScreen(TFT_DARKCYAN);
// int x = (tft.width() - logoWidth) / 2; // int x = (tft.width() - logoWidth) / 2;
// int y = (tft.height() - logoHeight) / 2; // int y = (tft.height() - logoHeight) / 2;
// tft.drawXBitmap(x, y, bootscreen, logoWidth, logoHeight, TFT_WHITE); // tft.drawXBitmap(x, y, bootscreen, logoWidth, logoHeight, TFT_WHITE);
} }
void TftSdl2::set_rotation(uint8_t rotation) void TftSdl::set_rotation(uint8_t rotation)
{} {}
void set_invert(bool invert) void TftSdl::set_invert(bool invert)
{} {}
static void TftSdl2::flush_pixels(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p) 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); monitor_flush(disp, area, color_p);
} }
bool TftSdl2:is_driver_pin(uint8_t pin) bool TftSdl::is_driver_pin(uint8_t pin)
{ {
return false; return false;
} }
const char* TftSdl2::get_tft_model() const char* TftSdl::get_tft_model()
{ {
return "SDL2"; return "SDL2";
} }
} // namespace dev } // namespace dev
dev::TftSdl2 haspTft; dev::TftSdl haspTft;
#endif
#endif // WINDOWS || POSIX

View File

@ -1,34 +1,38 @@
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie /* MIT License - Copyright (c) 2019-2021 Francis Van Roie
For full license information read the LICENSE file in the project folder */ For full license information read the LICENSE file in the project folder */
#ifndef HASP_SDL2_DRIVER_H #ifndef HASP_SDL2_DRIVER_H
#define HASP_SDL2_DRIVER_H #define HASP_SDL2_DRIVER_H
#include "tft_driver.h"
#if defined(WINDOWS) || defined(POSIX) #if defined(WINDOWS) || defined(POSIX)
#warning Building H driver TFT SDL2
#include "lvgl.h" #include "lvgl.h"
#include "tft_driver.h"
#include "indev/mouse.h" #include "indev/mouse.h"
namespace dev { namespace dev {
class TftSdl2 : BaseTft { class TftSdl : BaseTft {
public: public:
void init(int w, int h); void init(int w, int h);
void show_info(); void show_info();
void splashscreen(); void splashscreen();
void set_rotation(uint8_t rotation); void set_rotation(uint8_t rotation);
void set_invert(bool invert); 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); bool is_driver_pin(uint8_t pin);
const char* get_tft_model(); const char* get_tft_model();
}; };
} // namespace dev } // namespace dev
using dev::TftSdl2;
extern dev::TftSdl2 haspTft;
#endif // defined(WINDOWS) || defined(POSIX) #endif // defined(WINDOWS) || defined(POSIX)
#endif // HASP_SDL2_DRIVER_H #endif // HASP_SDL2_DRIVER_H
using dev::TftSdl;
extern dev::TftSdl haspTft;

View File

@ -6,6 +6,8 @@
*********************/ *********************/
#include "hasp_conf.h" #include "hasp_conf.h"
#if defined(TOUCH_CS)
#include "hal/hasp_hal.h" // for halGpioName() #include "hal/hasp_hal.h" // for halGpioName()
#include "dev/device.h" #include "dev/device.h"
#include "drv/tft_driver.h" #include "drv/tft_driver.h"
@ -14,8 +16,6 @@
#include "ArduinoLog.h" #include "ArduinoLog.h"
#include "hasp_macro.h" #include "hasp_macro.h"
#if defined(TOUCH_CS)
void tft_espi_calibrate(uint16_t* calData) void tft_espi_calibrate(uint16_t* calData)
{ {
haspTft.tft.fillScreen(TFT_BLACK); haspTft.tft.fillScreen(TFT_BLACK);

View File

@ -26,8 +26,6 @@
#include "hasplib.h" #include "hasplib.h"
//#include "tpcal.h" //#include "tpcal.h"
//#include "Ticker.h" //#include "Ticker.h"

View File

@ -1,4 +1,4 @@
Import("env", "projenv") Import("env")
env.Append( env.Append(
LINKFLAGS=[ LINKFLAGS=[

View File

@ -80,7 +80,7 @@ src_filter =
-<SSLSocket.c> -<SSLSocket.c>
-<sys/> -<sys/>
-<hal/> -<hal/>
-<drv/> +<drv/>
-<drv/touch> -<drv/touch>
-<drv/tft> -<drv/tft>
+<dev/> +<dev/>

View File

@ -101,7 +101,7 @@ src_filter =
-<SSLSocket.c> -<SSLSocket.c>
-<sys/> -<sys/>
-<hal/> -<hal/>
-<drv/> +<drv/>
-<drv/touch> -<drv/touch>
-<drv/tft> -<drv/tft>
+<dev/> +<dev/>