mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 21:26:43 +00:00
Update display drivers
This commit is contained in:
parent
748fe57334
commit
8452cbaecd
@ -1,8 +1,11 @@
|
|||||||
|
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
||||||
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
#include "hasp_drv_display.h"
|
#include "hasp_drv_display.h"
|
||||||
#include "tft_espi_drv.h"
|
#include "tft_espi_drv.h"
|
||||||
//#include "fsmc_ili9341.h"
|
//#include "fsmc_ili9341.h"
|
||||||
|
|
||||||
void drv_display_init(lv_disp_drv_t * disp_drv, uint8_t rotation, bool invert_display)
|
void drv_display_init(lv_disp_drv_t* disp_drv, uint8_t rotation, bool invert_display)
|
||||||
{
|
{
|
||||||
/* TFT init */
|
/* TFT init */
|
||||||
#if defined(USE_FSMC)
|
#if defined(USE_FSMC)
|
||||||
@ -18,7 +21,7 @@ void drv_display_init(lv_disp_drv_t * disp_drv, uint8_t rotation, bool invert_di
|
|||||||
/* Callback used for screenshots only: */
|
/* Callback used for screenshots only: */
|
||||||
|
|
||||||
/* indirect callback to flush screenshot data to the screen */
|
/* 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)
|
void drv_display_flush_cb(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p)
|
||||||
{
|
{
|
||||||
#if defined(USE_FSMC)
|
#if defined(USE_FSMC)
|
||||||
fsmc_ili9341_flush(disp, area, color_p);
|
fsmc_ili9341_flush(disp, area, color_p);
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
||||||
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
#include "hasp_drv_touch.h"
|
#include "hasp_drv_touch.h"
|
||||||
#include "hasp/hasp.h"
|
#include "hasp/hasp.h"
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
@ -60,7 +63,7 @@ void drv_touch_init(uint8_t rotation)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool drv_touchpad_getXY(int16_t * touchX, int16_t * touchY)
|
static inline bool drv_touchpad_getXY(int16_t* touchX, int16_t* touchY)
|
||||||
{
|
{
|
||||||
bool touched;
|
bool touched;
|
||||||
int16_t normal_x;
|
int16_t normal_x;
|
||||||
@ -151,7 +154,7 @@ bool touch_rotate = false;
|
|||||||
bool touch_invert_x = false;
|
bool touch_invert_x = false;
|
||||||
bool touch_invert_y = false;
|
bool touch_invert_y = false;
|
||||||
|
|
||||||
bool drv_touch_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
|
bool drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
|
||||||
{
|
{
|
||||||
#if TOUCH_DRIVER > 0
|
#if TOUCH_DRIVER > 0
|
||||||
int16_t touchX = 0;
|
int16_t touchX = 0;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
/**
|
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
||||||
* @file tft_espi_drv.cpp
|
For full license information read the LICENSE file in the project folder */
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
@ -163,17 +161,18 @@ static void tftShowConfig(TFT_eSPI& tft)
|
|||||||
setup_t tftSetup;
|
setup_t tftSetup;
|
||||||
tft.getSetup(tftSetup);
|
tft.getSetup(tftSetup);
|
||||||
|
|
||||||
LOG_VERBOSE(TAG_TFT, F("TFT_eSPI : v%s"), tftSetup.version.c_str());
|
// LOG_VERBOSE(TAG_TFT, F("TFT_eSPI : v%s"), tftSetup.version.c_str());
|
||||||
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
// #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||||
LOG_VERBOSE(TAG_TFT, F("Processor : ESP%x"), tftSetup.esp);
|
// LOG_VERBOSE(TAG_TFT, F("Processor : ESP%x"), tftSetup.esp);
|
||||||
#else
|
// #else
|
||||||
LOG_VERBOSE(TAG_TFT, F("Processor : STM%x"), tftSetup.esp);
|
// LOG_VERBOSE(TAG_TFT, F("Processor : STM%x"), tftSetup.esp);
|
||||||
#endif
|
// #endif
|
||||||
LOG_VERBOSE(TAG_TFT, F("CPU freq. : %i MHz"), haspDevice.get_cpu_frequency());
|
// LOG_VERBOSE(TAG_TFT, F("CPU freq. : %i MHz"), haspDevice.get_cpu_frequency());
|
||||||
|
|
||||||
|
// #if defined(ARDUINO_ARCH_ESP8266)
|
||||||
|
// LOG_VERBOSE(TAG_TFT, F("Voltage : %2.2f V"), ESP.getVcc() / 918.0); // 918 empirically determined
|
||||||
|
// #endif
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
|
||||||
LOG_VERBOSE(TAG_TFT, F("Voltage : %2.2f V"), ESP.getVcc() / 918.0); // 918 empirically determined
|
|
||||||
#endif
|
|
||||||
LOG_VERBOSE(TAG_TFT, F("Transactns : %s"), (tftSetup.trans == 1) ? PSTR("Yes") : PSTR("No"));
|
LOG_VERBOSE(TAG_TFT, F("Transactns : %s"), (tftSetup.trans == 1) ? PSTR("Yes") : PSTR("No"));
|
||||||
LOG_VERBOSE(TAG_TFT, F("Interface : %s"), (tftSetup.serial == 1) ? PSTR("SPI") : PSTR("Parallel"));
|
LOG_VERBOSE(TAG_TFT, F("Interface : %s"), (tftSetup.serial == 1) ? PSTR("SPI") : PSTR("Parallel"));
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
/**
|
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
||||||
* @file tft_espi_drv.h
|
For full license information read the LICENSE file in the project folder */
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef TFT_ESPI_DRV_H
|
#ifndef TFT_ESPI_DRV_H
|
||||||
#define TFT_ESPI_DRV_H
|
#define TFT_ESPI_DRV_H
|
||||||
@ -14,20 +12,20 @@ extern "C" {
|
|||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
#ifndef LV_DRV_NO_CONF
|
#ifndef LV_DRV_NO_CONF
|
||||||
#ifdef LV_CONF_INCLUDE_SIMPLE
|
#ifdef LV_CONF_INCLUDE_SIMPLE
|
||||||
#include "lv_drv_conf.h"
|
#include "lv_drv_conf.h"
|
||||||
#else
|
#else
|
||||||
#include "../../lv_drv_conf.h"
|
#include "../../lv_drv_conf.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_TFT_ESPI
|
#if USE_TFT_ESPI
|
||||||
|
|
||||||
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
|
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
#else
|
#else
|
||||||
#include "lvgl/lvgl.h"
|
#include "lvgl/lvgl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
@ -40,21 +38,21 @@ extern "C" {
|
|||||||
/**********************
|
/**********************
|
||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
void tft_espi_init(uint8_t rotation, bool invert_display=false);
|
void tft_espi_init(uint8_t rotation, bool invert_display = false);
|
||||||
void tft_espi_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p);
|
void tft_espi_flush(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p);
|
||||||
// void tft_espi_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
|
// void tft_espi_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
|
||||||
void tft_espi_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color);
|
void tft_espi_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color);
|
||||||
void tft_espi_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
|
void tft_espi_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t* color_p);
|
||||||
|
|
||||||
#if defined(TOUCH_CS)
|
#if defined(TOUCH_CS)
|
||||||
void tft_espi_calibrate(uint16_t * calData);
|
void tft_espi_calibrate(uint16_t* calData);
|
||||||
void tft_espi_set_touch(uint16_t * calData);
|
void tft_espi_set_touch(uint16_t* calData);
|
||||||
bool tft_espi_get_touch(int16_t * touchX, int16_t * touchY, uint16_t threshold);
|
bool tft_espi_get_touch(int16_t* touchX, int16_t* touchY, uint16_t threshold);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
#endif /* USE_TFT_ESPI */
|
#endif /* USE_TFT_ESPI */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user