mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
remove hasp_drv_display
This commit is contained in:
parent
8ece088ce0
commit
80ed53e062
@ -1,31 +1,31 @@
|
||||
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie
|
||||
For full license information read the LICENSE file in the project folder */
|
||||
|
||||
#include "hasp_drv_display.h"
|
||||
#include "tft_espi_drv.h"
|
||||
//#include "fsmc_ili9341.h"
|
||||
// #include "hasp_drv_display.h"
|
||||
// #include "tft_espi_drv.h"
|
||||
// //#include "fsmc_ili9341.h"
|
||||
|
||||
void drv_display_init(lv_disp_drv_t* disp_drv, uint8_t rotation, bool invert_display)
|
||||
{
|
||||
/* TFT init */
|
||||
#if defined(USE_FSMC)
|
||||
fsmc_ili9341_init(rotation, invert_display);
|
||||
disp_drv->flush_cb = fsmc_ili9341_flush; // Normal callback when flushing
|
||||
// xpt2046_init(rotation);
|
||||
#else
|
||||
tft_espi_init(rotation, invert_display);
|
||||
disp_drv->flush_cb = tft_espi_flush; // Normal callback when flushing
|
||||
#endif
|
||||
}
|
||||
// void drv_display_init(lv_disp_drv_t* disp_drv, uint8_t rotation, bool invert_display)
|
||||
// {
|
||||
// /* TFT init */
|
||||
// #if defined(USE_FSMC)
|
||||
// fsmc_ili9341_init(rotation, invert_display);
|
||||
// disp_drv->flush_cb = fsmc_ili9341_flush; // Normal callback when flushing
|
||||
// // xpt2046_init(rotation);
|
||||
// #else
|
||||
// tft_espi_init(rotation, invert_display);
|
||||
// disp_drv->flush_cb = tft_espi_flush; // Normal callback when flushing
|
||||
// #endif
|
||||
// }
|
||||
|
||||
/* Callback used for screenshots only: */
|
||||
// /* Callback used for screenshots only: */
|
||||
|
||||
/* indirect callback to flush screenshot data to the screen */
|
||||
void drv_display_flush_cb(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p)
|
||||
{
|
||||
#if defined(USE_FSMC)
|
||||
fsmc_ili9341_flush(disp, area, color_p);
|
||||
#else
|
||||
tft_espi_flush(disp, area, color_p);
|
||||
#endif
|
||||
}
|
||||
// /* indirect callback to flush screenshot data to the screen */
|
||||
// void drv_display_flush_cb(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p)
|
||||
// {
|
||||
// #if defined(USE_FSMC)
|
||||
// fsmc_ili9341_flush(disp, area, color_p);
|
||||
// #else
|
||||
// tft_espi_flush(disp, area, color_p);
|
||||
// #endif
|
||||
// }
|
@ -1,7 +1,7 @@
|
||||
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie
|
||||
For full license information read the LICENSE file in the project folder */
|
||||
|
||||
#ifndef HASP_DRV_DISPLAY_H
|
||||
#if 0 // ndef HASP_DRV_DISPLAY_H
|
||||
#define HASP_DRV_DISPLAY_H
|
||||
|
||||
#include "lvgl.h"
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "hasp_drv_touch.h"
|
||||
#include "hasp/hasp.h"
|
||||
#include "drv/tft_driver.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
#if TOUCH_DRIVER == 2046
|
||||
@ -74,7 +75,7 @@ static inline bool drv_touchpad_getXY(int16_t* touchX, int16_t* touchY)
|
||||
int16_t normal_x;
|
||||
int16_t normal_y;
|
||||
#if TOUCH_DRIVER == 2046 // XPT2046 Resistive touch panel driver
|
||||
touched = tft_espi_get_touch(&normal_x, &normal_y, 300u);
|
||||
touched = haspTft.tft.getTouch((uint16_t*)&normal_x, (uint16_t*)&normal_y, 20);
|
||||
|
||||
#elif TOUCH_DRIVER == 0x2046B
|
||||
touched = XPT2046_getXY(&normal_x, &normal_y, true);
|
||||
|
@ -23,6 +23,8 @@ namespace dev {
|
||||
class TftEspi : BaseTft {
|
||||
|
||||
public:
|
||||
TFT_eSPI tft;
|
||||
|
||||
void init(int w, int h);
|
||||
void show_info();
|
||||
void splashscreen();
|
||||
@ -34,8 +36,6 @@ class TftEspi : BaseTft {
|
||||
bool is_driver_pin(uint8_t pin);
|
||||
|
||||
private:
|
||||
TFT_eSPI tft;
|
||||
|
||||
void tftOffsetInfo(uint8_t pin, uint8_t x_offset, uint8_t y_offset)
|
||||
{
|
||||
if(x_offset != 0) {
|
||||
|
@ -8,12 +8,42 @@
|
||||
|
||||
#include "hal/hasp_hal.h" // for halGpioName()
|
||||
#include "dev/device.h"
|
||||
#include "drv/tft_driver.h"
|
||||
|
||||
#include "tft_espi_drv.h"
|
||||
#include "ArduinoLog.h"
|
||||
#include "hasp_macro.h"
|
||||
|
||||
#if USE_TFT_ESPI != 0
|
||||
#if defined(TOUCH_CS)
|
||||
|
||||
void tft_espi_calibrate(uint16_t* calData)
|
||||
{
|
||||
haspTft.tft.fillScreen(TFT_BLACK);
|
||||
haspTft.tft.setCursor(20, 0);
|
||||
haspTft.tft.setTextFont(1);
|
||||
haspTft.tft.setTextSize(1);
|
||||
haspTft.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
// tft.println(PSTR("Touch corners as indicated"));
|
||||
|
||||
haspTft.tft.setTextFont(1);
|
||||
delay(500);
|
||||
haspTft.tft.calibrateTouch(calData, TFT_MAGENTA, TFT_BLACK, 15);
|
||||
haspTft.tft.setTouch(calData);
|
||||
}
|
||||
|
||||
void tft_espi_set_touch(uint16_t* calData)
|
||||
{
|
||||
haspTft.tft.setTouch(calData);
|
||||
}
|
||||
|
||||
bool tft_espi_get_touch(int16_t* touchX, int16_t* touchY, uint16_t threshold)
|
||||
{
|
||||
return haspTft.tft.getTouch((uint16_t*)touchX, (uint16_t*)touchY, threshold);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 // USE_TFT_ESPI != 0
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "TFT_eSPI.h"
|
||||
|
@ -15,8 +15,9 @@
|
||||
#include "drv/tft_driver.h"
|
||||
#include "dev/device.h"
|
||||
|
||||
#include "drv/hasp_drv_display.h"
|
||||
//#include "drv/hasp_drv_display.h"
|
||||
#include "drv/hasp_drv_touch.h"
|
||||
#include "drv/tft_espi_drv.h"
|
||||
|
||||
#include "hasp_debug.h"
|
||||
#include "hasp_config.h"
|
||||
@ -196,7 +197,7 @@ void guiSetup(void)
|
||||
// _lv_fs_init(); // lvgl File System -- not neaded, it done in lv_init() when LV_USE_FILESYSTEM is set
|
||||
LOG_VERBOSE(TAG_LVGL, F("Filesystem : Enabled"));
|
||||
lv_fs_if_init(); // auxilary file system drivers
|
||||
filesystem_list_path("S:/");
|
||||
filesystem_list_path("S:/fs/");
|
||||
#else
|
||||
LOG_VERBOSE(TAG_LVGL, F("Filesystem : Disabled"));
|
||||
#endif
|
||||
@ -626,4 +627,4 @@ void guiTakeScreenshot()
|
||||
LOG_ERROR(TAG_GUI, F("Data sent does not match header size"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user