Files
magnus919_agent-skills/esp32-development/templates/esp-idf-main.c
T
Magnus HedemarkandGitHub 36638256a8 feat: add portable ESP32 development skill (#53)
* feat: add portable ESP32 development skill

Add source-backed workflows, safe templates, native CLI routing, and a read-only preflight for ESP32 hardware and firmware work.\n\nAI assistance: research, drafting, implementation, and review used OpenAI Codex and delegated DeepSeek agents under human direction.

* docs: harden ESP32 family and security guidance

Add source-backed family traps, brownout, calibration, USB recovery, and security-mode boundaries found during independent review.\n\nAI assistance: independent audits and drafting used delegated DeepSeek agents and OpenAI Codex under human direction.
2026-07-15 21:45:53 -04:00

42 lines
1.3 KiB
C

#include <stdbool.h>
#include "driver/gpio.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
// Deliberately inert until OUTPUT_GPIO is replaced from the exact board schematic.
#define OUTPUT_GPIO ((gpio_num_t)-1)
#define ACTIVE_LEVEL 1
#define PERIOD_MS 500
static const char *TAG = "bringup";
void app_main(void) {
gpio_num_t output_gpio = OUTPUT_GPIO;
if (!GPIO_IS_VALID_OUTPUT_GPIO(output_gpio)) {
ESP_LOGE(TAG, "set OUTPUT_GPIO to a verified output-capable pin");
return;
}
// Set the inactive latch before switching the pin to output mode.
const gpio_config_t output = {
.pin_bit_mask = 1ULL << output_gpio,
.mode = GPIO_MODE_OUTPUT,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_DISABLE,
};
gpio_set_level(output_gpio, !ACTIVE_LEVEL);
ESP_ERROR_CHECK(gpio_config(&output));
ESP_LOGI(TAG, "GPIO %d configured; verify the physical signal", output_gpio);
bool active = false;
while (true) {
active = !active;
gpio_set_level(output_gpio, active ? ACTIVE_LEVEL : !ACTIVE_LEVEL);
ESP_LOGI(TAG, "active=%d", active);
vTaskDelay(pdMS_TO_TICKS(PERIOD_MS));
}
}