Update display drivers

This commit is contained in:
fvanroie 2021-02-21 20:50:26 +01:00
parent 748fe57334
commit 8452cbaecd
4 changed files with 46 additions and 43 deletions

View File

@ -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 "tft_espi_drv.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 */
#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: */
/* 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)
fsmc_ili9341_flush(disp, area, color_p);

View File

@ -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/hasp.h"
#include "lvgl.h"
@ -60,7 +63,7 @@ void drv_touch_init(uint8_t rotation)
#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;
int16_t normal_x;
@ -151,7 +154,7 @@ bool touch_rotate = false;
bool touch_invert_x = 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
int16_t touchX = 0;

View File

@ -1,7 +1,5 @@
/**
* @file tft_espi_drv.cpp
*
*/
/* MIT License - Copyright (c) 2020 Francis Van Roie
For full license information read the LICENSE file in the project folder */
/*********************
* INCLUDES
@ -163,17 +161,18 @@ static void tftShowConfig(TFT_eSPI& tft)
setup_t tftSetup;
tft.getSetup(tftSetup);
LOG_VERBOSE(TAG_TFT, F("TFT_eSPI : v%s"), tftSetup.version.c_str());
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
LOG_VERBOSE(TAG_TFT, F("Processor : ESP%x"), tftSetup.esp);
#else
LOG_VERBOSE(TAG_TFT, F("Processor : STM%x"), tftSetup.esp);
#endif
LOG_VERBOSE(TAG_TFT, F("CPU freq. : %i MHz"), haspDevice.get_cpu_frequency());
// LOG_VERBOSE(TAG_TFT, F("TFT_eSPI : v%s"), tftSetup.version.c_str());
// #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
// LOG_VERBOSE(TAG_TFT, F("Processor : ESP%x"), tftSetup.esp);
// #else
// LOG_VERBOSE(TAG_TFT, F("Processor : STM%x"), tftSetup.esp);
// #endif
// 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("Interface : %s"), (tftSetup.serial == 1) ? PSTR("SPI") : PSTR("Parallel"));
#if defined(ARDUINO_ARCH_ESP8266)

View File

@ -1,7 +1,5 @@
/**
* @file tft_espi_drv.h
*
*/
/* MIT License - Copyright (c) 2020 Francis Van Roie
For full license information read the LICENSE file in the project folder */
#ifndef TFT_ESPI_DRV_H
#define TFT_ESPI_DRV_H
@ -14,20 +12,20 @@ extern "C" {
* INCLUDES
*********************/
#ifndef LV_DRV_NO_CONF
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_drv_conf.h"
#else
#include "../../lv_drv_conf.h"
#endif
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_drv_conf.h"
#else
#include "../../lv_drv_conf.h"
#endif
#endif
#if USE_TFT_ESPI
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
/*********************
* DEFINES
@ -40,21 +38,21 @@ extern "C" {
/**********************
* GLOBAL PROTOTYPES
**********************/
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_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(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_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)
void tft_espi_calibrate(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);
#endif
#if defined(TOUCH_CS)
void tft_espi_calibrate(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);
#endif
/**********************
* MACROS
**********************/
/**********************
* MACROS
**********************/
#endif /* USE_TFT_ESPI */