snapshot
This commit is contained in:
23
sketches/doorbell-touch-esp32-32e/User_Setup.h
Normal file
23
sketches/doorbell-touch-esp32-32e/User_Setup.h
Normal file
@@ -0,0 +1,23 @@
|
||||
// ===== User_Setup.h (local to sketch) =====
|
||||
#define USER_SETUP_LOADED // Prevent TFT_eSPI from loading its own
|
||||
|
||||
#define ST7796_DRIVER
|
||||
|
||||
#define TFT_WIDTH 320
|
||||
#define TFT_HEIGHT 480
|
||||
|
||||
#define TFT_CS 15
|
||||
#define TFT_DC 2
|
||||
#define TFT_RST 4
|
||||
#define TFT_MOSI 23
|
||||
#define TFT_SCLK 18
|
||||
#define TFT_MISO 19
|
||||
|
||||
#define TOUCH_CS 21
|
||||
|
||||
#define SPI_FREQUENCY 27000000
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
#define SUPPORT_TRANSACTIONS
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#include <TFT_eSPI.h>
|
||||
#include <SPI.h>
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
tft.init();
|
||||
tft.setRotation(1); // Landscape
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextSize(2);
|
||||
tft.drawString("Hello from ESP32!", 20, 20);
|
||||
tft.fillCircle(160, 120, 50, TFT_BLUE);
|
||||
Serial.println("Display initialized!");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Touch test
|
||||
uint16_t x, y;
|
||||
if (tft.getTouch(&x, &y)) {
|
||||
Serial.printf("Touch at: %d, %d\n", x, y);
|
||||
tft.fillCircle(x, y, 3, TFT_RED);
|
||||
}
|
||||
}
|
||||
|
||||
38
sketches/doorbell-touch-esp32-32e/mise.toml
Normal file
38
sketches/doorbell-touch-esp32-32e/mise.toml
Normal file
@@ -0,0 +1,38 @@
|
||||
[tools]
|
||||
arduino-cli = "latest"
|
||||
lazygit = "latest"
|
||||
|
||||
[env]
|
||||
FQBN = "esp32:esp32:esp32:UploadSpeed=921600,CPUFreq=240,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=info,EraseFlash=none"
|
||||
SKETCH_DIR = "{{cwd}}"
|
||||
|
||||
[tasks.install-core]
|
||||
run = "arduino-cli core update-index && arduino-cli core install esp32:esp32"
|
||||
|
||||
[tasks.install-libs]
|
||||
run = """
|
||||
arduino-cli lib install "GFX Library for Arduino"
|
||||
arduino-cli lib install "ArduinoJson"
|
||||
arduino-cli lib install "NTPClient"
|
||||
arduino-cli lib install "TFT_eSPI"
|
||||
"""
|
||||
|
||||
[tasks.compile]
|
||||
run = """
|
||||
arduino-cli compile \
|
||||
--fqbn $FQBN \
|
||||
--build-property "compiler.cpp.extra_flags=-DUSER_SETUP_LOADED -include ${SKETCH_DIR}/User_Setup.h" \
|
||||
--build-property "compiler.c.extra_flags=-DUSER_SETUP_LOADED -include ${SKETCH_DIR}/User_Setup.h" \
|
||||
.
|
||||
"""
|
||||
|
||||
[tasks.upload]
|
||||
depends = ["compile"]
|
||||
run = "arduino-cli upload --fqbn $FQBN -p $(arduino-cli board list | grep -i 'esp32\\|usb\\|ttyUSB\\|CP210\\|CH340' | head -1 | awk '{print $1}') ."
|
||||
|
||||
[tasks.monitor]
|
||||
depends = ["upload"]
|
||||
run = "arduino-cli monitor -p $(arduino-cli board list | grep -i 'esp32\\|usb\\|ttyUSB\\|CP210\\|CH340' | head -1 | awk '{print $1}') -c baudrate=115200"
|
||||
|
||||
[tasks.all]
|
||||
depends = ["monitor"]
|
||||
@@ -1,5 +1,6 @@
|
||||
[tools]
|
||||
arduino-cli = "latest"
|
||||
lazygit = "latest"
|
||||
|
||||
[env]
|
||||
FQBN = "esp32:esp32:waveshare_esp32_s3_touch_lcd_43:UploadSpeed=921600,USBMode=hwcdc,CDCOnBoot=cdc,CPUFreq=240,FlashMode=qio,FlashSize=16M,PartitionScheme=app3M_fat9M_16MB,DebugLevel=info,PSRAM=enabled,LoopCore=1,EventsCore=1,EraseFlash=none"
|
||||
|
||||
Reference in New Issue
Block a user