From 8452cbaecdb7ad56d09621559876682ad264b26d Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sun, 21 Feb 2021 20:50:26 +0100 Subject: [PATCH] Update display drivers --- src/drv/hasp_drv_display.cpp | 7 ++++-- src/drv/hasp_drv_touch.cpp | 7 ++++-- src/drv/tft_espi_drv.cpp | 27 ++++++++++---------- src/drv/tft_espi_drv.h | 48 +++++++++++++++++------------------- 4 files changed, 46 insertions(+), 43 deletions(-) diff --git a/src/drv/hasp_drv_display.cpp b/src/drv/hasp_drv_display.cpp index 54d96c6c..e9c18840 100644 --- a/src/drv/hasp_drv_display.cpp +++ b/src/drv/hasp_drv_display.cpp @@ -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); diff --git a/src/drv/hasp_drv_touch.cpp b/src/drv/hasp_drv_touch.cpp index 28bafd31..f2ed5b33 100644 --- a/src/drv/hasp_drv_touch.cpp +++ b/src/drv/hasp_drv_touch.cpp @@ -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; diff --git a/src/drv/tft_espi_drv.cpp b/src/drv/tft_espi_drv.cpp index dc924ba0..3ce1fce7 100644 --- a/src/drv/tft_espi_drv.cpp +++ b/src/drv/tft_espi_drv.cpp @@ -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) diff --git a/src/drv/tft_espi_drv.h b/src/drv/tft_espi_drv.h index 1bb0b4e2..c02607df 100644 --- a/src/drv/tft_espi_drv.h +++ b/src/drv/tft_espi_drv.h @@ -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 */