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

Document GPIO capability API and current web UI pin limits

SybexXx 3 дней назад
Родитель
Сommit
ee1eb568b8
1 измененных файлов с 29 добавлено и 0 удалено
  1. 29 0
      code/components/jomjol_controlGPIO/BOARD_GPIO_PROFILES.md

+ 29 - 0
code/components/jomjol_controlGPIO/BOARD_GPIO_PROFILES.md

@@ -55,3 +55,32 @@ reserved set depends on the selected ESP32-S3 module and board.
 Until a specific ESP32-S3 board has been audited, its profile must expose no
 user GPIOs. Do not copy the AI-Thinker pin list or create a generic ESP32-S3
 allow-list.
+
+## GPIO capability endpoint
+
+The authenticated existing `GET /GPIO` endpoint also supports
+`GET /GPIO?capabilities=1`. This read-only request returns JSON with the
+active profile name, the maximum channel count, and each whitelisted pin with
+its capability bitmask:
+
+```json
+{
+  "profile": "board profile name",
+  "maxChannels": 4,
+  "pins": [
+    { "gpio": 25, "capabilities": 19 }
+  ]
+}
+```
+
+Capability bits are defined in `board_gpio_profile.h`: input=1, output=2,
+pull-up=4, pull-down=8, interrupt=16, PWM=32. The firmware remains the
+authoritative validator; hiding or disabling a browser control is not a
+security boundary.
+
+The current configuration page still contains legacy rows only for GPIO
+0, 1, 3, 4, 12 and 13. It loads the capability endpoint and hides every row
+not whitelisted, but it cannot yet display arbitrary pin numbers. A board
+profile must not whitelist a pin that the current UI cannot represent. A
+follow-up UI/config-schema change is required before arbitrary ESP32-S3 pin
+numbers can be configured from the browser.