mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
Move tftShowConfig and halGpioName
This commit is contained in:
parent
be7568c145
commit
e5826894ac
@ -6,6 +6,8 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../src/hasp_hal.h" // for halGpioName()
|
||||
#include "ArduinoLog.h"
|
||||
#include "tft_espi_drv.h"
|
||||
|
||||
#if USE_TFT_ESPI != 0
|
||||
@ -15,12 +17,12 @@
|
||||
|
||||
#include LV_DRV_DISP_INCLUDE
|
||||
#include LV_DRV_DELAY_INCLUDE
|
||||
#include "../../src/hasp_tft.h"
|
||||
#include "bootscreen.h" // Sketch tab header for xbm images
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define TAG_TFT 22
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -29,6 +31,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void tftShowConfig(TFT_eSPI & tft);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -64,7 +67,7 @@ void tft_espi_init(uint8_t rotation)
|
||||
tft.initDMA(); // Initialise the DMA engine (tested with STM32F446 and STM32F767)
|
||||
#endif
|
||||
|
||||
tftSetup(tft);
|
||||
tftShowConfig(tft);
|
||||
}
|
||||
|
||||
void tft_espi_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p)
|
||||
@ -129,4 +132,115 @@ bool tft_espi_get_touch(uint16_t * touchX, uint16_t * touchY, uint16_t threshold
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
ADC_MODE(ADC_VCC); // tftShowConfig measures the voltage on the pin
|
||||
#endif
|
||||
|
||||
static void tftOffsetInfo(uint8_t pin, uint8_t x_offset, uint8_t y_offset)
|
||||
{
|
||||
if(x_offset != 0) {
|
||||
Log.verbose(TAG_TFT, F("R%u x offset = %i"), pin, x_offset);
|
||||
}
|
||||
if(y_offset != 0) {
|
||||
Log.verbose(TAG_TFT, F("R%u y offset = %i"), pin, y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
static void tftPinInfo(const __FlashStringHelper * pinfunction, int8_t pin)
|
||||
{
|
||||
if(pin != -1) {
|
||||
char buffer[64];
|
||||
snprintf_P(buffer, sizeof(buffer), PSTR("%-11s: %s (GPIO %02d)"), pinfunction, halGpioName(pin).c_str(), pin);
|
||||
Log.verbose(TAG_TFT, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
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"), halGetCpuFreqMHz());
|
||||
|
||||
#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)
|
||||
Log.verbose(TAG_TFT, F("SPI overlap: %s"), (tftSetup.overlap == 1) ? PSTR("Yes") : PSTR("No"));
|
||||
#endif
|
||||
|
||||
if(tftSetup.tft_driver != 0xE9D) // For ePaper displays the size is defined in the sketch
|
||||
{
|
||||
Log.verbose(TAG_TFT, F("Driver : %s"), halDisplayDriverName().c_str()); // tftSetup.tft_driver);
|
||||
Log.verbose(TAG_TFT, F("Resolution : %ix%i"), tftSetup.tft_width, tftSetup.tft_height);
|
||||
} else if(tftSetup.tft_driver == 0xE9D)
|
||||
Log.verbose(TAG_TFT, F("Driver = ePaper"));
|
||||
|
||||
// Offsets, not all used yet
|
||||
tftOffsetInfo(0, tftSetup.r0_x_offset, tftSetup.r0_y_offset);
|
||||
tftOffsetInfo(1, tftSetup.r1_x_offset, tftSetup.r1_y_offset);
|
||||
tftOffsetInfo(2, tftSetup.r2_x_offset, tftSetup.r2_y_offset);
|
||||
tftOffsetInfo(3, tftSetup.r3_x_offset, tftSetup.r3_y_offset);
|
||||
/* replaced by tftOffsetInfo
|
||||
// if(tftSetup.r1_x_offset != 0) Serial.printf("R1 x offset = %i \n", tftSetup.r1_x_offset);
|
||||
// if(tftSetup.r1_y_offset != 0) Serial.printf("R1 y offset = %i \n", tftSetup.r1_y_offset);
|
||||
// if(tftSetup.r2_x_offset != 0) Serial.printf("R2 x offset = %i \n", tftSetup.r2_x_offset);
|
||||
// if(tftSetup.r2_y_offset != 0) Serial.printf("R2 y offset = %i \n", tftSetup.r2_y_offset);
|
||||
// if(tftSetup.r3_x_offset != 0) Serial.printf("R3 x offset = %i \n", tftSetup.r3_x_offset);
|
||||
// if(tftSetup.r3_y_offset != 0) Serial.printf("R3 y offset = %i \n", tftSetup.r3_y_offset);
|
||||
*/
|
||||
|
||||
tftPinInfo(F("MOSI"), tftSetup.pin_tft_mosi);
|
||||
tftPinInfo(F("MISO"), tftSetup.pin_tft_miso);
|
||||
tftPinInfo(F("SCLK"), tftSetup.pin_tft_clk);
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
if(tftSetup.overlap == true) {
|
||||
Log.verbose(TAG_TFT, F("Overlap selected, following pins MUST be used:"));
|
||||
|
||||
Log.verbose(TAG_TFT, F("MOSI : SD1 (GPIO 8)"));
|
||||
Log.verbose(TAG_TFT, F("MISO : SD0 (GPIO 7)"));
|
||||
Log.verbose(TAG_TFT, F("SCK : CLK (GPIO 6)"));
|
||||
Log.verbose(TAG_TFT, F("TFT_CS : D3 (GPIO 0)"));
|
||||
|
||||
Log.verbose(TAG_TFT, F("TFT_DC and TFT_RST pins can be tftSetup defined"));
|
||||
}
|
||||
#endif
|
||||
|
||||
tftPinInfo(F("TFT_CS"), tftSetup.pin_tft_cs);
|
||||
tftPinInfo(F("TFT_DC"), tftSetup.pin_tft_dc);
|
||||
tftPinInfo(F("TFT_RST"), tftSetup.pin_tft_rst);
|
||||
|
||||
tftPinInfo(F("TOUCH_CS"), tftSetup.pin_tch_cs);
|
||||
|
||||
tftPinInfo(F("TFT_WR"), tftSetup.pin_tft_wr);
|
||||
tftPinInfo(F("TFT_RD"), tftSetup.pin_tft_rd);
|
||||
|
||||
tftPinInfo(F("TFT_D0"), tftSetup.pin_tft_d0);
|
||||
tftPinInfo(F("TFT_D1"), tftSetup.pin_tft_d1);
|
||||
tftPinInfo(F("TFT_D2"), tftSetup.pin_tft_d2);
|
||||
tftPinInfo(F("TFT_D3"), tftSetup.pin_tft_d3);
|
||||
tftPinInfo(F("TFT_D4"), tftSetup.pin_tft_d4);
|
||||
tftPinInfo(F("TFT_D5"), tftSetup.pin_tft_d5);
|
||||
tftPinInfo(F("TFT_D6"), tftSetup.pin_tft_d6);
|
||||
tftPinInfo(F("TFT_D7"), tftSetup.pin_tft_d7);
|
||||
|
||||
if(tftSetup.serial == 1) {
|
||||
Log.verbose(TAG_TFT, F("Display SPI freq. : %d.%d MHz"), tftSetup.tft_spi_freq / 10,
|
||||
tftSetup.tft_spi_freq % 10);
|
||||
}
|
||||
if(tftSetup.pin_tch_cs != -1) {
|
||||
Log.verbose(TAG_TFT, F("Touch SPI freq. : %d.%d MHz"), tftSetup.tch_spi_freq / 10,
|
||||
tftSetup.tch_spi_freq % 10);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
||||
For full license information read the LICENSE file in the project folder */
|
||||
|
||||
|
||||
#include "AceButton.h"
|
||||
#include "lv_conf.h" // For timing defines
|
||||
|
||||
@ -428,121 +427,6 @@ hasp_gpio_config_t gpioGetPinConfig(uint8_t num)
|
||||
return gpioConfig[num];
|
||||
}
|
||||
|
||||
String gpioName(uint8_t gpio)
|
||||
{
|
||||
#if defined(STM32F4xx)
|
||||
String ioName;
|
||||
uint16_t name = digitalPin[gpio];
|
||||
uint8_t num = name % 16;
|
||||
switch(name / 16) {
|
||||
case PortName::PortA:
|
||||
ioName = F("PA");
|
||||
break;
|
||||
case PortName::PortB:
|
||||
ioName = F("PB");
|
||||
break;
|
||||
#if defined GPIOC_BASE
|
||||
case PortName::PortC:
|
||||
ioName = F("PC");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOD_BASE
|
||||
case PortName::PortD:
|
||||
ioName = F("PD");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOE_BASE
|
||||
case PortName::PortE:
|
||||
ioName = F("PE");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOF_BASE
|
||||
case PortName::PortF:
|
||||
ioName = F("PF");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOG_BASE
|
||||
case PortName::PortG:
|
||||
ioName = F("PG");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOH_BASE
|
||||
case PortName::PortH:
|
||||
ioName = F("PH");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOI_BASE
|
||||
case PortName::PortI:
|
||||
ioName = F("PI");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOJ_BASE
|
||||
case PortName::PortJ:
|
||||
ioName = F("PJ");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOK_BASE
|
||||
case PortName::PortK:
|
||||
ioName = F("PK");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOZ_BASE
|
||||
case PortName::PortZ:
|
||||
ioName = F("PZ");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ioName = F("P?");
|
||||
}
|
||||
ioName += num;
|
||||
ioName += F(" (io");
|
||||
ioName += gpio;
|
||||
ioName += F(")");
|
||||
return ioName;
|
||||
#endif
|
||||
|
||||
// For ESP32 pin labels on boards use the GPIO number
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
return /*String(F("gpio")) +*/ String(gpio);
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
// For ESP8266 the pin labels are not the same as the GPIO number
|
||||
// These are for the NodeMCU pin definitions:
|
||||
// GPIO Dxx
|
||||
switch(gpio) {
|
||||
case 16:
|
||||
return F("D0");
|
||||
case 5:
|
||||
return F("D1");
|
||||
case 4:
|
||||
return F("D2");
|
||||
case 0:
|
||||
return F("D3");
|
||||
case 2:
|
||||
return F("D4");
|
||||
case 14:
|
||||
return F("D5");
|
||||
case 12:
|
||||
return F("D6");
|
||||
case 13:
|
||||
return F("D7");
|
||||
case 15:
|
||||
return F("D8");
|
||||
case 3:
|
||||
return F("TX");
|
||||
case 1:
|
||||
return F("RX");
|
||||
// case 9:
|
||||
// return F("D11");
|
||||
// case 10:
|
||||
// return F("D12");
|
||||
default:
|
||||
return F("D?"); // Invalid pin
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool gpioGetConfig(const JsonObject & settings)
|
||||
{
|
||||
|
@ -22,7 +22,6 @@ void gpioSetup(void);
|
||||
void IRAM_ATTR gpioLoop(void);
|
||||
void gpio_set_group_outputs(uint8_t groupid, uint8_t eventid);
|
||||
|
||||
String gpioName(uint8_t gpio);
|
||||
bool gpioSavePinConfig(uint8_t config_num, uint8_t pin, uint8_t type, uint8_t group, uint8_t pinfunc);
|
||||
bool gpioIsSystemPin(uint8_t gpio);
|
||||
bool gpioInUse(uint8_t gpio);
|
||||
|
116
src/hasp_hal.cpp
116
src/hasp_hal.cpp
@ -346,4 +346,120 @@ String halDisplayDriverName()
|
||||
return F("RM68140");
|
||||
#endif
|
||||
return F("Unknown");
|
||||
}
|
||||
|
||||
|
||||
String halGpioName(uint8_t gpio)
|
||||
{
|
||||
#if defined(STM32F4xx)
|
||||
String ioName;
|
||||
uint16_t name = digitalPin[gpio];
|
||||
uint8_t num = name % 16;
|
||||
switch(name / 16) {
|
||||
case PortName::PortA:
|
||||
ioName = F("PA");
|
||||
break;
|
||||
case PortName::PortB:
|
||||
ioName = F("PB");
|
||||
break;
|
||||
#if defined GPIOC_BASE
|
||||
case PortName::PortC:
|
||||
ioName = F("PC");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOD_BASE
|
||||
case PortName::PortD:
|
||||
ioName = F("PD");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOE_BASE
|
||||
case PortName::PortE:
|
||||
ioName = F("PE");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOF_BASE
|
||||
case PortName::PortF:
|
||||
ioName = F("PF");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOG_BASE
|
||||
case PortName::PortG:
|
||||
ioName = F("PG");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOH_BASE
|
||||
case PortName::PortH:
|
||||
ioName = F("PH");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOI_BASE
|
||||
case PortName::PortI:
|
||||
ioName = F("PI");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOJ_BASE
|
||||
case PortName::PortJ:
|
||||
ioName = F("PJ");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOK_BASE
|
||||
case PortName::PortK:
|
||||
ioName = F("PK");
|
||||
break;
|
||||
#endif
|
||||
#if defined GPIOZ_BASE
|
||||
case PortName::PortZ:
|
||||
ioName = F("PZ");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ioName = F("P?");
|
||||
}
|
||||
ioName += num;
|
||||
ioName += F(" (io");
|
||||
ioName += gpio;
|
||||
ioName += F(")");
|
||||
return ioName;
|
||||
#endif
|
||||
|
||||
// For ESP32 pin labels on boards use the GPIO number
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
return /*String(F("gpio")) +*/ String(gpio);
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
// For ESP8266 the pin labels are not the same as the GPIO number
|
||||
// These are for the NodeMCU pin definitions:
|
||||
// GPIO Dxx
|
||||
switch(gpio) {
|
||||
case 16:
|
||||
return F("D0");
|
||||
case 5:
|
||||
return F("D1");
|
||||
case 4:
|
||||
return F("D2");
|
||||
case 0:
|
||||
return F("D3");
|
||||
case 2:
|
||||
return F("D4");
|
||||
case 14:
|
||||
return F("D5");
|
||||
case 12:
|
||||
return F("D6");
|
||||
case 13:
|
||||
return F("D7");
|
||||
case 15:
|
||||
return F("D8");
|
||||
case 3:
|
||||
return F("TX");
|
||||
case 1:
|
||||
return F("RX");
|
||||
// case 9:
|
||||
// return F("D11");
|
||||
// case 10:
|
||||
// return F("D12");
|
||||
default:
|
||||
return F("D?"); // Invalid pin
|
||||
}
|
||||
#endif
|
||||
}
|
@ -17,5 +17,6 @@ String halGetMacAddress(int start, const char * seperator);
|
||||
uint16_t halGetCpuFreqMHz(void);
|
||||
String halFormatBytes(size_t bytes);
|
||||
String halDisplayDriverName(void);
|
||||
String halGpioName(uint8_t gpio);
|
||||
|
||||
#endif
|
@ -1241,7 +1241,7 @@ void webHandleGpioConfig()
|
||||
hasp_gpio_config_t conf = gpioGetPinConfig(id);
|
||||
if((conf.pin == gpio) && gpioConfigInUse(id) && gpioInUse(gpio) && !gpioIsSystemPin(gpio)) {
|
||||
httpMessage += F("<tr><td>");
|
||||
httpMessage += gpioName(gpio);
|
||||
httpMessage += halGpioName(gpio);
|
||||
httpMessage += F("</td><td>");
|
||||
|
||||
switch(conf.type) {
|
||||
@ -1342,7 +1342,7 @@ void webHandleGpioOptions()
|
||||
|
||||
for(uint8_t io = 0; io < NUM_DIGITAL_PINS; io++) {
|
||||
if(((conf.pin == io) || !gpioInUse(io)) && !gpioIsSystemPin(io)) {
|
||||
httpMessage += getOption(io, gpioName(io), conf.pin == io);
|
||||
httpMessage += getOption(io, halGpioName(io), conf.pin == io);
|
||||
}
|
||||
}
|
||||
httpMessage += F("</select></p>");
|
||||
|
@ -33,7 +33,7 @@ EthernetClient mqttNetworkClient;
|
||||
#endif
|
||||
|
||||
#include "hasp_hal.h"
|
||||
#include "hasp_tft.h"
|
||||
//#include "hasp_tft.h"
|
||||
#include "hasp_debug.h"
|
||||
#include "hasp_config.h"
|
||||
#include "hasp_wifi.h"
|
||||
|
140
src/hasp_tft.cpp
140
src/hasp_tft.cpp
@ -1,140 +0,0 @@
|
||||
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
||||
For full license information read the LICENSE file in the project folder */
|
||||
|
||||
#include "ArduinoJson.h"
|
||||
|
||||
#ifndef USE_FSMC
|
||||
|
||||
#include "hasp_conf.h"
|
||||
#include "hasp_tft.h"
|
||||
#include "hasp_hal.h"
|
||||
#include "hasp_gpio.h" // PinNames
|
||||
#include "hasp_debug.h"
|
||||
|
||||
#include "TFT_eSPI.h"
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
ADC_MODE(ADC_VCC); // tftShowConfig measures the voltage on the pin
|
||||
#endif
|
||||
|
||||
void tftSetup(TFT_eSPI & tft)
|
||||
{
|
||||
tftShowConfig(tft);
|
||||
}
|
||||
|
||||
void tftLoop()
|
||||
{
|
||||
// Nothing to do here
|
||||
}
|
||||
|
||||
void tftStop()
|
||||
{}
|
||||
|
||||
void tftOffsetInfo(uint8_t pin, uint8_t x_offset, uint8_t y_offset)
|
||||
{
|
||||
if(x_offset != 0) {
|
||||
Log.verbose(TAG_TFT, F("R%u x offset = %i"), pin, x_offset);
|
||||
}
|
||||
if(y_offset != 0) {
|
||||
Log.verbose(TAG_TFT, F("R%u y offset = %i"), pin, y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void tftPinInfo(const __FlashStringHelper * pinfunction, int8_t pin)
|
||||
{
|
||||
if(pin != -1) {
|
||||
char buffer[64];
|
||||
snprintf_P(buffer, sizeof(buffer), PSTR("%-11s: %s (GPIO %02d)"), pinfunction, gpioName(pin).c_str(), pin);
|
||||
Log.verbose(TAG_TFT, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
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"), halGetCpuFreqMHz());
|
||||
|
||||
#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)
|
||||
Log.verbose(TAG_TFT, F("SPI overlap: %s"), (tftSetup.overlap == 1) ? PSTR("Yes") : PSTR("No"));
|
||||
#endif
|
||||
|
||||
if(tftSetup.tft_driver != 0xE9D) // For ePaper displays the size is defined in the sketch
|
||||
{
|
||||
Log.verbose(TAG_TFT, F("Driver : %s"), halDisplayDriverName().c_str()); // tftSetup.tft_driver);
|
||||
Log.verbose(TAG_TFT, F("Resolution : %ix%i"), tftSetup.tft_width, tftSetup.tft_height);
|
||||
} else if(tftSetup.tft_driver == 0xE9D)
|
||||
Log.verbose(TAG_TFT, F("Driver = ePaper"));
|
||||
|
||||
// Offsets, not all used yet
|
||||
tftOffsetInfo(0, tftSetup.r0_x_offset, tftSetup.r0_y_offset);
|
||||
tftOffsetInfo(1, tftSetup.r1_x_offset, tftSetup.r1_y_offset);
|
||||
tftOffsetInfo(2, tftSetup.r2_x_offset, tftSetup.r2_y_offset);
|
||||
tftOffsetInfo(3, tftSetup.r3_x_offset, tftSetup.r3_y_offset);
|
||||
/* replaced by tftOffsetInfo
|
||||
// if(tftSetup.r1_x_offset != 0) Serial.printf("R1 x offset = %i \n", tftSetup.r1_x_offset);
|
||||
// if(tftSetup.r1_y_offset != 0) Serial.printf("R1 y offset = %i \n", tftSetup.r1_y_offset);
|
||||
// if(tftSetup.r2_x_offset != 0) Serial.printf("R2 x offset = %i \n", tftSetup.r2_x_offset);
|
||||
// if(tftSetup.r2_y_offset != 0) Serial.printf("R2 y offset = %i \n", tftSetup.r2_y_offset);
|
||||
// if(tftSetup.r3_x_offset != 0) Serial.printf("R3 x offset = %i \n", tftSetup.r3_x_offset);
|
||||
// if(tftSetup.r3_y_offset != 0) Serial.printf("R3 y offset = %i \n", tftSetup.r3_y_offset);
|
||||
*/
|
||||
|
||||
tftPinInfo(F("MOSI"), tftSetup.pin_tft_mosi);
|
||||
tftPinInfo(F("MISO"), tftSetup.pin_tft_miso);
|
||||
tftPinInfo(F("SCLK"), tftSetup.pin_tft_clk);
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
if(tftSetup.overlap == true) {
|
||||
Log.verbose(TAG_TFT, F("Overlap selected, following pins MUST be used:"));
|
||||
|
||||
Log.verbose(TAG_TFT, F("MOSI : SD1 (GPIO 8)"));
|
||||
Log.verbose(TAG_TFT, F("MISO : SD0 (GPIO 7)"));
|
||||
Log.verbose(TAG_TFT, F("SCK : CLK (GPIO 6)"));
|
||||
Log.verbose(TAG_TFT, F("TFT_CS : D3 (GPIO 0)"));
|
||||
|
||||
Log.verbose(TAG_TFT, F("TFT_DC and TFT_RST pins can be tftSetup defined"));
|
||||
}
|
||||
#endif
|
||||
|
||||
tftPinInfo(F("TFT_CS"), tftSetup.pin_tft_cs);
|
||||
tftPinInfo(F("TFT_DC"), tftSetup.pin_tft_dc);
|
||||
tftPinInfo(F("TFT_RST"), tftSetup.pin_tft_rst);
|
||||
|
||||
tftPinInfo(F("TOUCH_CS"), tftSetup.pin_tch_cs);
|
||||
|
||||
tftPinInfo(F("TFT_WR"), tftSetup.pin_tft_wr);
|
||||
tftPinInfo(F("TFT_RD"), tftSetup.pin_tft_rd);
|
||||
|
||||
tftPinInfo(F("TFT_D0"), tftSetup.pin_tft_d0);
|
||||
tftPinInfo(F("TFT_D1"), tftSetup.pin_tft_d1);
|
||||
tftPinInfo(F("TFT_D2"), tftSetup.pin_tft_d2);
|
||||
tftPinInfo(F("TFT_D3"), tftSetup.pin_tft_d3);
|
||||
tftPinInfo(F("TFT_D4"), tftSetup.pin_tft_d4);
|
||||
tftPinInfo(F("TFT_D5"), tftSetup.pin_tft_d5);
|
||||
tftPinInfo(F("TFT_D6"), tftSetup.pin_tft_d6);
|
||||
tftPinInfo(F("TFT_D7"), tftSetup.pin_tft_d7);
|
||||
|
||||
if(tftSetup.serial == 1) {
|
||||
Log.verbose(TAG_TFT, F("Display SPI freq. : %d.%d MHz"), tftSetup.tft_spi_freq / 10,
|
||||
tftSetup.tft_spi_freq % 10);
|
||||
}
|
||||
if(tftSetup.pin_tch_cs != -1) {
|
||||
Log.verbose(TAG_TFT, F("Touch SPI freq. : %d.%d MHz"), tftSetup.tch_spi_freq / 10,
|
||||
tftSetup.tch_spi_freq % 10);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,19 +0,0 @@
|
||||
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
||||
For full license information read the LICENSE file in the project folder */
|
||||
|
||||
#ifndef HASP_TFT_H
|
||||
#define HASP_TFT_H
|
||||
|
||||
#ifndef USE_FSMC
|
||||
|
||||
#include "TFT_eSPI.h"
|
||||
|
||||
void tftSetup(TFT_eSPI & screen);
|
||||
void IRAM_ATTR tftLoop(void);
|
||||
void tftStop(void);
|
||||
|
||||
void tftShowConfig(TFT_eSPI & tft);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user