SolarEnergy/esp32_device/main/system.c

27 lines
488 B
C
Raw Normal View History

2024-07-27 14:15:35 +00:00
#include "system.h"
2024-08-18 19:01:34 +00:00
#include "esp_log.h"
2024-07-27 14:15:35 +00:00
#include "esp_system.h"
2024-08-17 15:19:47 +00:00
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
2024-08-18 19:01:34 +00:00
static const char *TAG = "system";
2024-08-17 15:19:47 +00:00
void system_sleep(size_t secs)
{
vTaskDelay((1000 * secs) / portTICK_PERIOD_MS);
}
2024-08-18 19:01:34 +00:00
size_t system_show_free_memory()
{
size_t v = heap_caps_get_free_size(MALLOC_CAP_DEFAULT);
ESP_LOGI(TAG, "heap_caps_free_size(MALLOC_CAP_DEFAULT) = %d", v);
return v;
}
2024-07-27 14:15:35 +00:00
void reboot()
{
fflush(stdout);
esp_restart();
}