mirror of
https://github.com/Xinyuan-LilyGO/TTGO-T-Display.git
synced 2024-09-21 09:57:27 +00:00
add sch
This commit is contained in:
parent
e6f6120a09
commit
749693133d
@ -5,6 +5,7 @@
|
|||||||
#include <Button2.h>
|
#include <Button2.h>
|
||||||
#include "esp_adc_cal.h"
|
#include "esp_adc_cal.h"
|
||||||
#include <Ticker.h>
|
#include <Ticker.h>
|
||||||
|
#include "bmp.h"
|
||||||
|
|
||||||
#define TFT_MOSI 19
|
#define TFT_MOSI 19
|
||||||
#define TFT_SCLK 18
|
#define TFT_SCLK 18
|
||||||
@ -12,11 +13,12 @@
|
|||||||
#define TFT_DC 16
|
#define TFT_DC 16
|
||||||
#define TFT_RST 23
|
#define TFT_RST 23
|
||||||
|
|
||||||
#define TFT_BL 14 // Dispaly backlight control pin
|
#define TFT_BL 4 // Dispaly backlight control pin
|
||||||
#define ADC_PIN 34
|
#define ADC_EN 14
|
||||||
#define BUTTON_1 35
|
#define ADC_PIN 34
|
||||||
#define BUTTON_2 0
|
#define BUTTON_1 35
|
||||||
#define BUTTONS_MAP {BUTTON_1,BUTTON_2}
|
#define BUTTON_2 0
|
||||||
|
#define BUTTONS_MAP {BUTTON_1,BUTTON_2}
|
||||||
|
|
||||||
TFT_eSPI tft = TFT_eSPI(135, 240); // Invoke custom library
|
TFT_eSPI tft = TFT_eSPI(135, 240); // Invoke custom library
|
||||||
|
|
||||||
@ -35,6 +37,7 @@ void showVoltage()
|
|||||||
uint16_t v = analogRead(ADC_PIN);
|
uint16_t v = analogRead(ADC_PIN);
|
||||||
float battery_voltage = ((float)v / 4095.0) * 2.0 * 3.3 * (vref / 1000.0);
|
float battery_voltage = ((float)v / 4095.0) * 2.0 * 3.3 * (vref / 1000.0);
|
||||||
String voltage = "Voltage :" + String(battery_voltage) + "V";
|
String voltage = "Voltage :" + String(battery_voltage) + "V";
|
||||||
|
Serial.println(voltage);
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
tft.setTextDatum(MC_DATUM);
|
tft.setTextDatum(MC_DATUM);
|
||||||
tft.drawString(voltage, tft.width() / 2, tft.height() / 2 );
|
tft.drawString(voltage, tft.width() / 2, tft.height() / 2 );
|
||||||
@ -56,6 +59,8 @@ void button_init()
|
|||||||
tft.drawString("Press again to wake up", tft.width() / 2, tft.height() / 2 );
|
tft.drawString("Press again to wake up", tft.width() / 2, tft.height() / 2 );
|
||||||
delay(6000);
|
delay(6000);
|
||||||
digitalWrite(TFT_BL, !r);
|
digitalWrite(TFT_BL, !r);
|
||||||
|
tft.writecommand(TFT_DISPOFF);
|
||||||
|
tft.writecommand(TFT_SLPIN);
|
||||||
esp_sleep_enable_ext1_wakeup(GPIO_SEL_35, ESP_EXT1_WAKEUP_ALL_LOW);
|
esp_sleep_enable_ext1_wakeup(GPIO_SEL_35, ESP_EXT1_WAKEUP_ALL_LOW);
|
||||||
esp_deep_sleep_start();
|
esp_deep_sleep_start();
|
||||||
});
|
});
|
||||||
@ -108,6 +113,7 @@ void wifi_scan()
|
|||||||
tft.println(buff);
|
tft.println(buff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
WiFi.mode(WIFI_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
@ -115,6 +121,7 @@ void setup()
|
|||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
||||||
|
Serial.println("Start");
|
||||||
tft.init();
|
tft.init();
|
||||||
tft.setRotation(0);
|
tft.setRotation(0);
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
@ -130,6 +137,20 @@ void setup()
|
|||||||
digitalWrite(TFT_BL, HIGH);
|
digitalWrite(TFT_BL, HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tft.setRotation(1);
|
||||||
|
tft.pushImage(0, 0, 240, 135, ttgo);
|
||||||
|
delay(5000);
|
||||||
|
tft.setRotation(0);
|
||||||
|
int i = 5;
|
||||||
|
while (i--) {
|
||||||
|
tft.fillScreen(TFT_RED);
|
||||||
|
delay(1000);
|
||||||
|
tft.fillScreen(TFT_BLUE);
|
||||||
|
delay(1000);
|
||||||
|
tft.fillScreen(TFT_GREEN);
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
button_init();
|
button_init();
|
||||||
|
|
||||||
esp_adc_cal_characteristics_t adc_chars;
|
esp_adc_cal_characteristics_t adc_chars;
|
||||||
|
BIN
schematic/ESP32-TFT(6-26).pdf
Normal file
BIN
schematic/ESP32-TFT(6-26).pdf
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user