Просмотр исходного кода

Enable AI Thinker GPIO13 after one-bit SD mount

SybexXx 3 дней назад
Родитель
Сommit
976b33ca06
1 измененных файлов с 20 добавлено и 9 удалено
  1. 20 9
      code/components/jomjol_controlGPIO/board_gpio_profile.cpp

+ 20 - 9
code/components/jomjol_controlGPIO/board_gpio_profile.cpp

@@ -9,18 +9,29 @@ static const char *TAG = "GPIO_PROFILE";
 
 /*
  * AI-Thinker ESP32-CAM:
- * - Camera, flash LED, status LED, UART, strapping pins, flash/PSRAM and the
- *   active SDMMC signals are reserved.
- * - The current firmware selects 1-bit SD mode. GPIO13 is the SD DAT3 contact,
- *   but is not part of the active 1-bit data bus. It remains input-only here:
- *   no output or PWM capability is granted.
- * - If the build is changed to 4-bit SD mode, the user whitelist is empty.
+ * - The current firmware selects 1-bit SD mode and mounts the SD card before
+ *   creating the GPIO handler.
+ * - GPIO13 (DAT3) is pulled up before SD-card initialization to keep the card
+ *   in native SD/MMC mode. In 1-bit mode DAT3 is not part of the active bus;
+ *   after a successful mount, the generic GPIO handler may reconfigure it.
+ * - GPIO12 (DAT2) remains reserved: it is physically connected to the card
+ *   and is the MTDI flash-voltage strapping pin sampled before app_main().
+ *   1-bit mode alone does not remove that boot-time electrical connection.
+ * - If the build is changed to 4-bit SD mode, GPIO13 is reserved as well.
  */
-/* GPIO13 remains connected to SD DAT3 and is explicitly pulled up by main.cpp.
- * Do not expose it as a user pin until SD-card interaction and board wiring
- * have been validated together on hardware. */
+#if defined(__SD_USE_ONE_LINE_MODE__)
+static const GpioBoardPin kUserPins[] = {
+    { GPIO_NUM_13,
+      static_cast<uint8_t>(GPIO_PIN_CAP_INPUT | GPIO_PIN_CAP_OUTPUT |
+                           GPIO_PIN_CAP_PULL_UP | GPIO_PIN_CAP_PULL_DOWN |
+                           GPIO_PIN_CAP_INTERRUPT),
+      "SD DAT3 / GPIO13 (released after SD mount in 1-bit mode)" }
+};
+static const size_t kUserPinCount = sizeof(kUserPins) / sizeof(kUserPins[0]);
+#else
 static const GpioBoardPin * const kUserPins = NULL;
 static const size_t kUserPinCount = 0U;
+#endif
 
 static const gpio_num_t kReservedPins[] = {
     CAM_PIN_PWDN, CAM_PIN_RESET, CAM_PIN_XCLK, CAM_PIN_SIOD, CAM_PIN_SIOC,