123456789101112131415161718192021222324252627 |
- #define MODULE "reboot"
- #include "common.h"
- void reboot_now(void)
- {
- while (1) {
- esp_restart();
- }
- }
- int reboot_delayed(void)
- {
- const int reboot_delay = 3; /* seconds */
- TimerHandle_t timer;
- timer = xTimerCreate("reboot", configTICK_RATE_HZ*reboot_delay,
- pdFALSE, NULL, (TimerCallbackFunction_t)reboot_now);
- if (!timer)
- return 0;
- if (xTimerStart(timer, configTICK_RATE_HZ) != pdPASS)
- return 0;
- return reboot_delay;
- }
|