12345678910111213141516171819202122232425262728 |
- #define MODULE "reboot"
- #include "common.h"
- void reboot_now(void)
- {
- while (1) {
- esp_restart();
- }
- }
- int reboot_delayed(void)
- {
- const int reboot_delay = 5; /* 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;
- }
|