Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions boards/ESP-WROOM-32-UFL/ESP-WROOM-32-UFL.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
; PlatformIO Project Configuration File
;
; ESP-WROOM-32 U.FL (External Antenna) Board Configuration
;
; This board is a generic ESP32-WROOM-32 development board with:
; - External U.FL antenna connector for WiFi/Bluetooth
; - 4MB Flash
; - No built-in display (uses WebUI mode)
; - No built-in battery
;
; Please visit documentation for other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:ESP-WROOM-32-UFL]
board = ESP-WROOM-32-UFL
board_build.partitions = custom_4Mb_full.csv
build_src_filter = ${env.build_src_filter} +<../boards/ESP-WROOM-32-UFL>

; Upload settings for reliability - slower speed to prevent "chip stopped responding" errors
upload_speed = 115200
upload_resetmethod = nodemcu

build_flags =
${env.build_flags}
-Iboards/ESP-WROOM-32-UFL
-Os
-DCORE_DEBUG_LEVEL=0
-DCONFIG_ESP32_JTAG_SUPPORT_DISABLE=1

; Enable all GPIO for IR/RF flexibility on generic board
-DALLOW_ALL_GPIO_FOR_IR_RF=1

; Grove I2C pins (standard ESP32 I2C)
-DGROVE_SDA=21
-DGROVE_SCL=22

; IR LED configuration
-DIR_TX_PINS='{{"GPIO 2", 2}, {"GPIO 4", 4}, {"Grove SDA", GROVE_SDA}}'
-DIR_RX_PINS='{{"GPIO 14", 14}, {"GPIO 15", 15}, {"Grove SCL", GROVE_SCL}}'
-DLED=2
-DLED_ON=HIGH
-DLED_OFF=LOW

; RF Module pins (CC1101 / generic RF modules)
-DRF_TX_PINS='{{"GPIO 2", 2}, {"GPIO 4", 4}, {"Grove SDA", GROVE_SDA}}'
-DRF_RX_PINS='{{"GPIO 14", 14}, {"GPIO 15", 15}, {"Grove SCL", GROVE_SCL}}'

; SD Card configuration (external SD module on SPI)
-DSDCARD_CS=5
-DSDCARD_SCK=18
-DSDCARD_MISO=19
-DSDCARD_MOSI=23

; TFT Display - None (uses WebUI)
-DROTATION=0
-DBACKLIGHT=-1
-DMINBRIGHT=0
-DTFT_CS=-1
-DTFT_DC=-1
-DTFT_RST=-1
-DTOUCH_CS=-1
-DTFT_MOSI=-1
-DTFT_SCLK=-1
-DTFT_BL=-1

; Font sizes (for compatibility)
-DFP=1
-DFM=2
-DFG=3

; Button configuration
-DBTN_ALIAS='"Boot"'

; SPI Bus pins (VSPI)
-DSPI_SCK_PIN=18
-DSPI_MOSI_PIN=23
-DSPI_MISO_PIN=19
-DSPI_SS_PIN=5

; CC1101 Sub-GHz Radio
-DUSE_CC1101_VIA_SPI
-DCC1101_GDO0_PIN=4
-DCC1101_SS_PIN=15
-DCC1101_MOSI_PIN=SPI_MOSI_PIN
-DCC1101_SCK_PIN=SPI_SCK_PIN
-DCC1101_MISO_PIN=SPI_MISO_PIN

; NRF24L01 2.4GHz Radio
-DUSE_NRF24_VIA_SPI
-DNRF24_CE_PIN=16
-DNRF24_SS_PIN=17
-DNRF24_MOSI_PIN=SPI_MOSI_PIN
-DNRF24_SCK_PIN=SPI_SCK_PIN
-DNRF24_MISO_PIN=SPI_MISO_PIN

; Device name shown in WebUI
-DDEVICE_NAME='"ESP-WROOM-32 U.FL"'

lib_deps =
${env.lib_deps}
134 changes: 134 additions & 0 deletions boards/ESP-WROOM-32-UFL/interface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#include "core/powerSave.h"
#include <interface.h>

/*
* ESP-WROOM-32 U.FL Board Interface Implementation
*
* This board is a generic ESP-WROOM-32 dev board with external U.FL antenna.
* It has no built-in display, so it defaults to WebUI mode for interaction.
*
* Features:
* - No built-in screen (uses WebUI)
* - No built-in battery
* - Boot button on GPIO0 for input
* - LED on GPIO2
*/

/***************************************************************************************
** Function name: _setup_gpio()
** Location: main.cpp
** Description: Initial setup for the device
***************************************************************************************/
void _setup_gpio() {
// Start WebUI by default since this board has no display
bruceConfig.startupApp = "WebUI";

// Configure boot button as input
pinMode(BTN_PIN, INPUT_PULLUP);

// Configure onboard LED
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LED_OFF);

// Initialize Serial for debugging
Serial.begin(115200);

// Set default modules configuration
bruceConfigPins.rfModule = CC1101_SPI_MODULE;
bruceConfigPins.rfidModule = PN532_I2C_MODULE;
bruceConfigPins.irRx = RXLED;
bruceConfigPins.irTx = TXLED;
}

/***************************************************************************************
** Function name: _post_setup_gpio()
** Location: main.cpp
** Description: Second stage GPIO setup after main initialization
***************************************************************************************/
void _post_setup_gpio() {
// Nothing additional needed for this board
}

/***************************************************************************************
** Function name: getBattery()
** Location: display.cpp
** Description: Returns battery level 0-100. This board has no battery monitoring.
***************************************************************************************/
int getBattery() {
return 0; // No battery monitoring available
}

/***************************************************************************************
** Function name: isCharging()
** Description: Returns charging status. This board has no battery.
***************************************************************************************/
bool isCharging() { return false; }

/*********************************************************************
** Function: setBrightness
** Location: settings.cpp
** Description: Set display brightness - no effect on this board (no display)
**********************************************************************/
void _setBrightness(uint8_t brightval) {
// No display to adjust brightness
}

/*********************************************************************
** Function: InputHandler
** Description: Handles button input. This board only has the boot button.
**********************************************************************/
void InputHandler(void) {
checkPowerSaveTime();

// Reset all button states
PrevPress = false;
NextPress = false;
SelPress = false;
AnyKeyPress = false;
EscPress = false;

// Check boot button (GPIO0)
static unsigned long lastPress = 0;
static bool buttonDown = false;

if (digitalRead(BTN_PIN) == BTN_ACT) {
if (!buttonDown) {
buttonDown = true;
lastPress = millis();
} else if (millis() - lastPress > 1000) {
// Long press = Escape/Back
if (!wakeUpScreen()) EscPress = true;
buttonDown = false;
}
} else {
if (buttonDown) {
if (millis() - lastPress < 1000) {
// Short press = Select
if (!wakeUpScreen()) {
SelPress = true;
AnyKeyPress = true;
}
}
buttonDown = false;
}
}
}

/*********************************************************************
** Function: powerOff
** Location: mykeyboard.cpp
** Description: Turns off the device. ESP32 doesn't have true power off.
**********************************************************************/
void powerOff() {
// ESP32 deep sleep as pseudo power off
esp_deep_sleep_start();
}

/*********************************************************************
** Function: checkReboot
** Location: mykeyboard.cpp
** Description: Check if reboot is requested (long press boot button)
**********************************************************************/
void checkReboot() {
// Long press handling is done in InputHandler
}
140 changes: 140 additions & 0 deletions boards/ESP-WROOM-32-UFL/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include "soc/soc_caps.h"
#include <stdint.h>

/*
* ESP-WROOM-32 U.FL (External Antenna) Board
*
* This is a generic ESP-WROOM-32 development board with U.FL antenna connector
* for external antenna connection. Uses standard ESP-WROOM-32 pinout.
*
* Features:
* - ESP32-WROOM-32 module
* - External U.FL antenna connector (WiFi/BT)
* - 4MB Flash
* - 240MHz Dual Core
* - WiFi + Bluetooth Classic + BLE
*
* Pin assignments follow the ESP-WROOM-32 reference design.
*/

// ============================================================================
// SPI Bus Configuration (VSPI - Default SPI for peripherals)
// ============================================================================
#define SPI_SS_PIN 5
#define SPI_MOSI_PIN 23
#define SPI_MISO_PIN 19
#define SPI_SCK_PIN 18

static const uint8_t SS = SPI_SS_PIN;
static const uint8_t MOSI = SPI_MOSI_PIN;
static const uint8_t MISO = SPI_MISO_PIN;
static const uint8_t SCK = SPI_SCK_PIN;

// ============================================================================
// SD Card Configuration (No onboard SD - uses SPI pins for external SD)
// ============================================================================
#define SDCARD_CS SPI_SS_PIN
#define SDCARD_SCK SPI_SCK_PIN
#define SDCARD_MISO SPI_MISO_PIN
#define SDCARD_MOSI SPI_MOSI_PIN

// ============================================================================
// CC1101 Sub-GHz Radio Configuration
// ============================================================================
#define USE_CC1101_VIA_SPI
#define CC1101_GDO0_PIN 4
#define CC1101_SS_PIN 15
#define CC1101_MOSI_PIN SPI_MOSI_PIN
#define CC1101_SCK_PIN SPI_SCK_PIN
#define CC1101_MISO_PIN SPI_MISO_PIN

// ============================================================================
// NRF24L01 2.4GHz Radio Configuration
// ============================================================================
#define USE_NRF24_VIA_SPI
#define NRF24_CE_PIN 16
#define NRF24_SS_PIN 17
#define NRF24_MOSI_PIN SPI_MOSI_PIN
#define NRF24_SCK_PIN SPI_SCK_PIN
#define NRF24_MISO_PIN SPI_MISO_PIN

// ============================================================================
// W5500 Ethernet Configuration
// ============================================================================
#define USE_W5500_VIA_SPI
#define W5500_SS_PIN 17
#define W5500_MOSI_PIN SPI_MOSI_PIN
#define W5500_SCK_PIN SPI_SCK_PIN
#define W5500_MISO_PIN SPI_MISO_PIN
#define W5500_INT_PIN 16

// ============================================================================
// I2C Bus Configuration (Grove connector compatible)
// ============================================================================
#define GROVE_SDA 21
#define GROVE_SCL 22
static const uint8_t SDA = GROVE_SDA;
static const uint8_t SCL = GROVE_SCL;

// ============================================================================
// Serial/UART Configuration
// ============================================================================
static const uint8_t TX = 1;
static const uint8_t RX = 3;

#define SERIAL_TX 12
#define SERIAL_RX 13

#define BAD_TX 12
#define BAD_RX 13

// ============================================================================
// This board has NO built-in TFT display
// The firmware will use WebUI mode by default
// ============================================================================
// TFT pins set to -1 to indicate no display present
#define TFT_CS -1
#define TFT_DC -1
#define TFT_RST -1
#define TFT_BL -1
#define TFT_MOSI -1
#define TFT_SCLK -1
#define TOUCH_CS -1
#define BACKLIGHT -1

// Display settings (WebUI mode - no physical screen)
#define HAS_SCREEN 0
#define ROTATION 0
#define MINBRIGHT 0

// Font Sizes (unused but defined for compatibility)
#define FP 1
#define FM 2
#define FG 3

// ============================================================================
// Button Configuration (No built-in buttons - using GPIO0 for boot button)
// ============================================================================
#define BTN_ALIAS "\"Boot\""
#define HAS_BTN 1
#define BTN_PIN 0 // Boot button on most ESP32 dev boards
#define BTN_ACT LOW

// ============================================================================
// IR LED Configuration (External IR module)
// ============================================================================
#define TXLED 2 // GPIO2 - onboard LED can be used as IR TX
#define RXLED 14 // GPIO14 - IR receiver input

#define LED_ON HIGH
#define LED_OFF LOW

// ============================================================================
// Onboard LED
// ============================================================================
#define LED_BUILTIN 2 // GPIO2 - most ESP32 boards have LED on GPIO2

#endif /* Pins_Arduino_h */
Loading