BellUtils.h 477 B

12345678910111213141516171819202122232425262728
  1. #ifndef EUPHONIUM_BELL_UTILS
  2. #define EUPHONIUM_BELL_UTILS
  3. #include <random>
  4. #include <string.h>
  5. #include <vector>
  6. namespace bell {
  7. std::string generateRandomUUID();
  8. void freeAndNull(void *&ptr);
  9. } // namespace bell
  10. #ifdef ESP_PLATFORM
  11. #include <freertos/FreeRTOS.h>
  12. #define BELL_SLEEP_MS(ms) vTaskDelay(ms / portTICK_PERIOD_MS)
  13. #define BELL_YIELD() taskYIELD()
  14. #else
  15. #include <unistd.h>
  16. #define BELL_SLEEP_MS(ms) usleep(ms * 1000)
  17. #define BELL_YIELD() ;
  18. #endif
  19. #endif