From b2389f2968793f0bcd5b74009f00014fe4bf61c4 Mon Sep 17 00:00:00 2001 From: Torsten Stauder Date: Thu, 18 Mar 2021 10:36:39 +0100 Subject: [PATCH] Added support for Lilygo T8 --- platformio.ini | 19 +++++++ src/main.cpp | 2 + src/settings-ttgo_t8.h | 110 +++++++++++++++++++++++++++++++++++++++++ src/settings.h | 1 + 4 files changed, 132 insertions(+) create mode 100644 src/settings-ttgo_t8.h diff --git a/platformio.ini b/platformio.ini index 4eead2d..4e141c3 100644 --- a/platformio.ini +++ b/platformio.ini @@ -141,6 +141,25 @@ monitor_port = /dev/cu.SLAB_USBtoUART platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#1.0.5-rc6 +[env:ttgo_t8] +;https://docs.platformio.org/en/latest/boards/espressif32/esp-wrover-kit.html +platform = espressif32 +board = esp-wrover-kit +framework = arduino +monitor_speed = 115200 +board_build.partitions = huge_app.csv +lib_deps = + ${common.lib_deps_builtin} + ${common.lib_deps_external} + https://github.com/miguelbalboa/rfid.git + https://github.com/tueddy/PN5180-Library.git +extra_scripts = ${env:common.extra_scripts} +upload_port = /dev/cu.SLAB_USBtoUART +monitor_port = /dev/cu.SLAB_USBtoUART +build_flags = -DBOARD_HAS_PSRAM + -mfix-esp32-psram-cache-issue +platform_packages = + platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#1.0.5-rc6 ;;; Change upload/monitor-port of your board regarding your operating-system and develboard! ;MAC: /dev/cu.SLAB_USBtoUART / /dev/cu.wchusbserial1420 / /dev/cu.wchusbserial1410 diff --git a/src/main.cpp b/src/main.cpp index cdcd521..3e22911 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,6 +11,8 @@ #include "settings-lolin_d32.h" // Contains all user-relevant settings for Wemos Lolin D32 #elif (HAL == 4) #include "settings-lolin_d32_pro.h" // Contains all user-relevant settings for Wemos Lolin D32 pro +#elif (HAL == 5) + #include "settings-ttgo_t8.h" // Contains all user-relevant settings for Lilygo TTGO T8 1.7 #elif (HAL == 99) #include "settings-custom.h" // Contains all user-relevant settings custom-board #endif diff --git a/src/settings-ttgo_t8.h b/src/settings-ttgo_t8.h new file mode 100644 index 0000000..8fc8c8a --- /dev/null +++ b/src/settings-ttgo_t8.h @@ -0,0 +1,110 @@ +#include "Arduino.h" + +//######################### INFOS #################################### +/* This is a develboard-specific config-file for Lilygo T7 v1.7 + PCB: t.b.a + Infos: https://github.com/LilyGO/TTGO-T8-ESP32 + Caveats: None + Status: + tested by biologist with SD_MMC + PN5180 +*/ + +//################## GPIO-configuration ############################## +// Please note: GPIOs 34, 35, 36, 39 are input-only and don't have pullup-resistors. +// So if connecting a button to these, make sure to add a 10k-pullup-resistor for each button. +// Further infos: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ +#ifdef SD_MMC_1BIT_MODE + // uSD-card-reader (via SD-MMC 1Bit) + // + // SD_MMC uses fixed pins + // MOSI 15 + // SCK 14 + // MISO 2 +#else + // uSD-card-reader (via SPI) => don't use... won't work! + #define SPISD_CS 15 // GPIO for chip select (SD) + #ifndef SINGLE_SPI_ENABLE + #define SPISD_MOSI 13 // GPIO for master out slave in (SD) => not necessary for single-SPI + #define SPISD_MISO 16 // GPIO for master in slave ou (SD) => not necessary for single-SPI + #define SPISD_SCK 14 // GPIO for clock-signal (SD) => not necessary for single-SPI + #endif +#endif + +// RFID (via SPI) +#define RST_PIN 99 // Not necessary but has to be set anyway; so let's use a dummy-number +#define RFID_CS 21 // GPIO for chip select (RFID) +#define RFID_MOSI 23 // GPIO for master out slave in (RFID) +#define RFID_MISO 19 // GPIO for master in slave out (RFID) +#define RFID_SCK 18 // GPIO for clock-signal (RFID) + +#ifdef RFID_READER_TYPE_PN5180 + #define RFID_BUSY 5 // PN5180 BUSY PIN + #define RFID_RST 22 // PN5180 RESET PIN + #define RFID_IRQ 13 // PN5180 IRQ PIN (only needed for low power card detection) +#endif +// I2S (DAC) +#define I2S_DOUT 25 // Digital out (I2S) +#define I2S_BCLK 27 // BCLK (I2S) +#define I2S_LRC 26 // LRC (I2S) + +// Rotary encoder +#ifdef USEROTARY_ENABLE + #define DREHENCODER_CLK 34 // If you want to reverse encoder's direction, just switch GPIOs of CLK with DT (in software or hardware) + #define DREHENCODER_DT 33 // Info: Lolin D32 / Lolin D32 pro 35 are using 35 for battery-voltage-monitoring! + #define DREHENCODER_BUTTON 32 // Button 3: is used to switch ESPuino on and off +#endif + +// Control-buttons (set to 99 to disable) +#define NEXT_BUTTON 0 // Button 0: GPIO to detect next +#define PREVIOUS_BUTTON 36 // Button 1: GPIO to detect previous (Important: as of 19.11.2020 changed from 33 to 2; make sure to change in SD-MMC-mode) +#define PAUSEPLAY_BUTTON 39 // Button 2: GPIO to detect pause/play +#define BUTTON_4 99 // Button 4: unnamed optional button +#define BUTTON_5 99 // Button 5: unnamed optional button + +// Wake-up button +// Please note: only RTC-GPIOs (0, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, 39, 99) can be used! Set to 99 to disable. +#define WAKEUP_BUTTON DREHENCODER_BUTTON // Defines the button that is used to wake up ESPuino from deepsleep. + +// (optional) Power-control +#define POWER 4 // GPIO used to drive transistor-circuit, that switches off peripheral devices while ESP32-deepsleep + +// (optional) Neopixel +#define LED_PIN 12 // GPIO for Neopixel-signaling + +// (optinal) Headphone-detection +#ifdef HEADPHONE_ADJUST_ENABLE + #define HP_DETECT 13 // GPIO that detects, if there's a plug in the headphone jack or not +#endif + +// (optional) Monitoring of battery-voltage via ADC +#ifdef MEASURE_BATTERY_VOLTAGE + #define VOLTAGE_READ_PIN 35 // GPIO used to monitor battery-voltage. Change to 35 if you're using Lolin D32 or Lolin D32 pro as it's hard-wired there! + float referenceVoltage = 3.35; // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!) + float offsetVoltage = 0.1; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here +#endif + +// (optional) For measuring battery-voltage a voltage-divider is necessary. Their values need to be configured here. +#ifdef MEASURE_BATTERY_VOLTAGE + uint8_t rdiv1 = 100; // Rdiv1 of voltage-divider (kOhms) (measure exact value with multimeter!) + uint16_t rdiv2 = 100; // Rdiv2 of voltage-divider (kOhms) (measure exact value with multimeter!) => used to measure voltage via ADC! +#endif + +// (Optional) remote control via infrared +#ifdef IR_CONTROL_ENABLE + #define IRLED_PIN 22 // GPIO where IR-receiver is connected (only tested with VS1838B) + #define IR_DEBOUNCE 200 // Interval in ms to wait at least for next signal (not used for actions volume up/down) + + // Actions available. Use your own remote control and have a look at the console for "Command=0x??". E.g. "Protocol=NEC Address=0x17F Command=0x68 Repeat gap=39750us" + #define RC_PLAY 0x68 // command for play + #define RC_PAUSE 0x67 // command for pause + #define RC_NEXT 0x6b // command for next track of playlist + #define RC_PREVIOUS 0x6a // command for previous track of playlist + #define RC_FIRST 0x6c // command for first track of playlist + #define RC_LAST 0x6d // command for last track of playlist + #define RC_VOL_UP 0x1a // Command for volume up (one step) + #define RC_VOL_DOWN 0x1b // Command for volume down (one step) + #define RC_MUTE 0x1c // Command to mute ESPuino + #define RC_SHUTDOWN 0x2a // Command for deepsleep + #define RC_BLUETOOTH 0x72 // Command to enable/disable bluetooth + #define RC_FTP 0x65 // Command to enable FTP-server +#endif \ No newline at end of file diff --git a/src/settings.h b/src/settings.h index 9e7063d..82bcc7e 100644 --- a/src/settings.h +++ b/src/settings.h @@ -13,6 +13,7 @@ 2: ESP32-A1S Audiokit => settings-espa1s.h 3: Wemos Lolin D32 => settings-lolin_D32.h 4: Wemos Lolin D32 pro => settings-lolin_D32_pro.h + 5: Lilygo T8 (V1.7) => settings-ttgo_t8.h 99: custom => settings-custom.h more to come... */