2026-03-07 16:15:28 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
2026-03-09 00:23:03 +08:00
|
|
|
/* GPIO defaults for ESP32-S3-LCD-1.47B safe user-accessible pins */
|
2026-03-07 16:15:28 +08:00
|
|
|
#define MIMI_GPIO_MIN_PIN 1
|
|
|
|
|
#define MIMI_GPIO_MAX_PIN 21
|
2026-03-09 00:23:03 +08:00
|
|
|
#define MIMI_GPIO_ALLOWED_CSV "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,21,38,46"
|
2026-03-07 16:15:28 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if a pin is allowed for user GPIO operations.
|
|
|
|
|
* Validates against the allowlist or default range, and blocks
|
|
|
|
|
* pins reserved for flash/PSRAM on ESP32.
|
|
|
|
|
*/
|
|
|
|
|
bool gpio_policy_pin_is_allowed(int pin);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Write a human-readable hint if the pin is forbidden for a known reason.
|
|
|
|
|
* Returns true if a hint was written (and the caller should return the error).
|
|
|
|
|
*/
|
|
|
|
|
bool gpio_policy_pin_forbidden_hint(int pin, char *result, size_t result_len);
|