From 6a8ebbe92ee91aa5ab75f4020bb82adee6ac5d8e Mon Sep 17 00:00:00 2001 From: Torsten Stauder Date: Thu, 14 Oct 2021 23:01:20 +0200 Subject: [PATCH] Adding to HAL for upcoming PCB --- platformio.ini | 16 +++++ src/settings-lolin_d32_pro_sdmmc.h | 109 +++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 src/settings-lolin_d32_pro_sdmmc.h diff --git a/platformio.ini b/platformio.ini index ea7d3ab..76a136c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -83,6 +83,22 @@ build_flags = -DHAL=4 board_upload.maximum_size = 16777216 board_upload.flash_size = 16MB +[env:lolin_d32_pro_sdmmc_pe] +;https://docs.platformio.org/en/latest/boards/espressif32/lolin_d32_pro.html +board = lolin_d32_pro +;board_build.partitions = huge_app.csv +;board_build.partitions = custom_4mb_noota.csv +board_build.partitions = custom_16mb_ota.csv +upload_port = /dev/cu.wchusbserial1410 +monitor_port = /dev/cu.wchusbserial1410 +build_flags = -DHAL=7 + -DBOARD_HAS_PSRAM + -mfix-esp32-psram-cache-issue + -DLOG_BUFFER_SIZE=10240 + -DBOARD_HAS_16MB_FLASH_AND_OTA_SUPPORT +board_upload.maximum_size = 16777216 +board_upload.flash_size = 16MB + [env:nodemcu-32s] ;https://docs.platformio.org/en/latest/boards/espressif32/nodemcu-32s.html board = nodemcu-32s diff --git a/src/settings-lolin_d32_pro_sdmmc.h b/src/settings-lolin_d32_pro_sdmmc.h new file mode 100644 index 0000000..4457839 --- /dev/null +++ b/src/settings-lolin_d32_pro_sdmmc.h @@ -0,0 +1,109 @@ +#ifndef __ESPUINO_SETTINGS_LOLIN_D32_PRO_H__ +#define __ESPUINO_SETTINGS_LOLIN_D32_PRO_H__ + #include "Arduino.h" + + //######################### INFOS #################################### + /* This is a PCB-specific config-file for *Wemos Lolin32 D32 pro with port-expander PCA9555PW and SD_MMC*. + PCB: t.b.a. + Forum: t.b.a. + Infos: https://www.wemos.cc/en/latest/d32/d32_pro.html + Schematics Lolin D32 pro: https://www.wemos.cc/en/latest/_static/files/sch_d32_pro_v2.0.0.pdf + Schematics PCB: t.b.a. + Caveats: GPIO35 (battery monitoring) + don't use internal SD-slot as it's to capable of SD_MMC because of its pin-layout! + Status: + tested with PN5180 + SD_MMC (by biologist79) + */ + + //################## GPIO-configuration ############################## + // Please note: GPIOs 34, 35, 36, 39 are input-only and don't have internal 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/ + // GPIOs 16+17 are not available for D32 pro as they're used to internal purposes (PSRAM). + // All GPIOs >=100 and <= 115 are connected to a port-expander + #ifdef SD_MMC_1BIT_MODE + // 15 / 14 / 2 (fixed for SD_MMC) + #else + // NOT SUPPORTED BY THIS BOARD! + #endif + + // RFID (via SPI) + #define RST_PIN 99 // Used as dummy for RC522 + #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 33 // PN5180 BUSY PIN + #define RFID_RST 22 // PN5180 RESET PIN + #define RFID_IRQ 106 // PN5180 IRQ PIN (only used for low power card detection (LPCD)) + #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 ROTARYENCODER_CLK 34 // If you want to reverse encoder's direction, just switch GPIOs of CLK with DT (in software or hardware) + #define ROTARYENCODER_DT 39 // 39 = 'VN'; rotary's encoder DT + #define ROTARYENCODER_BUTTON 103 // Set to 99 to disable the button; connected to port-expander + #endif + + // Amp enable (optional) + #define GPIO_PA_EN 108 // To enable/disable amp for loudspeaker; connected to port-expander + + // Control-buttons + #define NEXT_BUTTON 102 // Next-Button: connected to port-expander + #define PREVIOUS_BUTTON 100 // Prev-Button: connected to port-expander + #define PAUSEPLAY_BUTTON 101 // Pplay-Button: connected to port-expander + #define BUTTON_4 104 // Button 4: connected to port-expander + #define BUTTON_5 105 // Button 5: connected to port-expander + + // Channels of port-expander can be read cyclic or interrupt-driven. It's strongly recommended to use the interrupt-way! + // Infos: https://forum.espuino.de/t/einsatz-des-port-expanders-pca9555/306 + #ifdef PORT_EXPANDER_ENABLE + #define PE_INTERRUPT_PIN 36 // GPIO that is used to receive interrupts from port-expander + to wake up ESP32 + #endif + + // I2C-configuration (necessary for PCA9555) + #if defined(RFID_READER_TYPE_MFRC522_I2C) || defined(PORT_EXPANDER_ENABLE) + #define ext_IIC_CLK 4 // i2c-SCL (clock) + #define ext_IIC_DATA 13 // i2c-SDA (data) + #endif + + // Wake-up button => this also is the interrupt-pin if port-expander is enabled! + // 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. + // Please note #2: this button can be used as interrupt-pin for port-expander. If so, all pins connected to port-expander can wake up ESPuino. + #define WAKEUP_BUTTON 36 // Defines the button that is used to wake up ESPuino from deepsleep; set to 99 to disable + + // Power-control + #define POWER 32 // 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 DETECT_HP_ON_HIGH // Per default headphones are supposed to be connected if HT_DETECT is LOW. DETECT_HP_ON_HIGH will change this behaviour to HIGH. + #define HP_DETECT 107 // GPIO that detects, if there's a plug in the headphone jack or not; connected to port-expander + #endif + + // (optional) Monitoring of battery-voltage via ADC + #ifdef MEASURE_BATTERY_VOLTAGE + #define VOLTAGE_READ_PIN 35 // GPIO used to monitor battery-voltage. Don't change, it's built in + constexpr float referenceVoltage = 3.30; // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!) + constexpr 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 already onboard. Connect a LiPo and use it! + #ifdef MEASURE_BATTERY_VOLTAGE + constexpr uint8_t rdiv1 = 100; // Don't change, it's built in + constexpr uint16_t rdiv2 = 100; // Don't change, it's built in + #endif + + #ifdef IR_CONTROL_ENABLE + // not supported by PCB! + #endif +#endif \ No newline at end of file