idf_component_register(
    SRCS
        "src/opengnd_board_power.c"
    INCLUDE_DIRS
        "include"
        "../../hardware"
    REQUIRES
        esp_driver_gpio
        esp_hw_support
        esp_hal_wdt
        esp_timer
        esp_rom
        esp_system
        soc
        freertos
        log
    WHOLE_ARCHIVE
        TRUE
)

# Allow opengnd_reboot_to_usb_download() to preserve the 120s RWDT RESET_RTC
# guard across esp_restart() without esp_restart_noos() overwriting it to 1s.
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=esp_restart_noos")
