From 7ad19199fce8f0959e4e95a957e86dde485964ec Mon Sep 17 00:00:00 2001 From: killerink Date: Sun, 21 Apr 2024 09:32:17 +0200 Subject: [PATCH] add xiao camera module --- platformio.ini | 17 +++++++++++++++++ src/camera_pins.h | 35 +++++++++++++++++++++++++++++++++++ src/storage.cpp | 2 +- src/storage.h | 6 +++--- 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index 35d770e8..2aa75734 100644 --- a/platformio.ini +++ b/platformio.ini @@ -49,6 +49,23 @@ lib_deps = https://github.com/espressif/json_generator.git https://github.com/espressif/json_parser.git + +[env:seeed_xiao_esp32s3] +platform = https://github.com/platformio/platform-espressif32.git +board = seeed_xiao_esp32s3 +board_build.flash_mode = dio +lib_deps = + https://github.com/me-no-dev/ESPAsyncWebServer.git + https://github.com/espressif/json_generator.git + https://github.com/espressif/json_parser.git +framework = arduino +build_flags = + -std=gnu++17 + -DBOARD_HAS_PSRAM + -DCORE_DEBUG_LEVEL=5 + -D CAMERA_MODEL_XIAO +build_unflags = -std=gnu++11 + ; For OTA uploading uncomment the next lines and add the IP address or mDNS name of the camera module, and the OTA password ;upload_protocol = espota ;upload_port = diff --git a/src/camera_pins.h b/src/camera_pins.h index a7d1571e..26a383fd 100644 --- a/src/camera_pins.h +++ b/src/camera_pins.h @@ -238,6 +238,41 @@ #define SD_SCLK_PIN 39 #define SD_CS_PIN 47 + #elif defined(CAMERA_MODEL_XIAO) + // + // ESP XIAO + // https://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-2.pdf + // + #define LED_PIN LED_BUILTIN // Status led + #define LAMP_PIN -1 // LED FloodLamp. + #define PWM_PIN -1 + #define PWDN_GPIO_NUM -1 + #define RESET_GPIO_NUM -1 + #define XCLK_GPIO_NUM 10 + #define SIOD_GPIO_NUM 40 + #define SIOC_GPIO_NUM 39 + + #define Y9_GPIO_NUM 48 + #define Y8_GPIO_NUM 11 + #define Y7_GPIO_NUM 12 + #define Y6_GPIO_NUM 14 + #define Y5_GPIO_NUM 16 + #define Y4_GPIO_NUM 18 + #define Y3_GPIO_NUM 17 + #define Y2_GPIO_NUM 15 + #define VSYNC_GPIO_NUM 38 + #define HREF_GPIO_NUM 47 + #define PCLK_GPIO_NUM 13 + + #define LED_GPIO_NUM 21 + #define LED_ON LOW // - Pin is inverted. + #define LED_OFF HIGH // + + #define SD_MISO_PIN 8 + #define SD_MOSI_PIN 9 + #define SD_SCLK_PIN 7 + #define SD_CS_PIN 21 + #else // // AI Thinker diff --git a/src/storage.cpp b/src/storage.cpp index 21629749..1371221d 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -38,7 +38,7 @@ bool CLStorage::init() { #ifdef USE_LittleFS return fsStorage->begin(FORMAT_LITTLEFS_IF_FAILED); #else -#if defined(CAMERA_MODEL_LILYGO_T_SIMCAM) +#if defined(CAMERA_MODEL_LILYGO_T_SIMCAM) || defined(CAMERA_MODEL_XIAO) SPI.begin(SD_SCLK_PIN, SD_MISO_PIN, SD_MOSI_PIN, SD_CS_PIN); if(!fsStorage->begin(SD_CS_PIN, SPI)) return false; #else diff --git a/src/storage.h b/src/storage.h index 1738f30b..ae32a8cd 100644 --- a/src/storage.h +++ b/src/storage.h @@ -16,7 +16,7 @@ #include #define FORMAT_LITTLEFS_IF_FAILED true #define STORAGE_UNITS STORAGE_UNITS_BT -#elif defined(CAMERA_MODEL_LILYGO_T_SIMCAM) +#elif defined(CAMERA_MODEL_LILYGO_T_SIMCAM) || defined(CAMERA_MODEL_XIAO) #include "camera_pins.h" #include "SD.h" #define STORAGE_UNITS STORAGE_UNITS_MB @@ -55,7 +55,7 @@ class CLStorage { #ifdef USE_LittleFS fs::LITTLEFSFS & getFS() {return *fsStorage;}; -#elif defined(CAMERA_MODEL_LILYGO_T_SIMCAM) +#elif defined(CAMERA_MODEL_LILYGO_T_SIMCAM) || defined(CAMERA_MODEL_XIAO) fs::SDFS & getFS() {return *fsStorage;}; #else fs::SDMMCFS & getFS() {return *fsStorage;}; @@ -64,7 +64,7 @@ class CLStorage { private: #ifdef USE_LittleFS fs::LITTLEFSFS * const fsStorage = &LITTLEFS; -#elif defined(CAMERA_MODEL_LILYGO_T_SIMCAM) +#elif defined(CAMERA_MODEL_LILYGO_T_SIMCAM) || defined(CAMERA_MODEL_XIAO) fs::SDFS * const fsStorage = &SD; #else fs::SDMMCFS * const fsStorage = &SD_MMC;