mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-12 22:06:35 +00:00
Update driver includes
This commit is contained in:
parent
93f09dc7df
commit
a06942e446
@ -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
|
@ -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
|
||||
dev::TftSdl haspTft;
|
||||
|
||||
#endif // WINDOWS || POSIX
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -26,8 +26,6 @@
|
||||
|
||||
#include "hasplib.h"
|
||||
|
||||
|
||||
|
||||
//#include "tpcal.h"
|
||||
|
||||
//#include "Ticker.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
Import("env", "projenv")
|
||||
Import("env")
|
||||
|
||||
env.Append(
|
||||
LINKFLAGS=[
|
||||
|
@ -80,7 +80,7 @@ src_filter =
|
||||
-<SSLSocket.c>
|
||||
-<sys/>
|
||||
-<hal/>
|
||||
-<drv/>
|
||||
+<drv/>
|
||||
-<drv/touch>
|
||||
-<drv/tft>
|
||||
+<dev/>
|
||||
|
@ -101,7 +101,7 @@ src_filter =
|
||||
-<SSLSocket.c>
|
||||
-<sys/>
|
||||
-<hal/>
|
||||
-<drv/>
|
||||
+<drv/>
|
||||
-<drv/touch>
|
||||
-<drv/tft>
|
||||
+<dev/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user