#include #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "utils.h" void utils_delay_ms(uint32_t ms) { vTaskDelay(pdMS_TO_TICKS(ms)); } uint32_t utils_get_tick_ms(void) { return (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS); } void utils_trim(char *str) { if (!str) return; char *start = str; while (*start && isspace((unsigned char)*start)) start++; if (*start == '\0') { *str = '\0'; return; } char *end = start + strlen(start) - 1; while (end > start && isspace((unsigned char)*end)) end--; size_t len = end - start + 1; memmove(str, start, len); str[len] = '\0'; }