2018-02-17 11:42:41 +07:00
|
|
|
/*
|
|
|
|
|
* This file is subject to the terms and conditions defined in
|
|
|
|
|
* file 'LICENSE', which is part of this source code package.
|
|
|
|
|
* Tuan PM <tuanpm at live dot com>
|
|
|
|
|
*/
|
2018-02-16 02:40:16 +07:00
|
|
|
#ifndef _ESP_PLATFORM_H__
|
|
|
|
|
#define _ESP_PLATFORM_H__
|
|
|
|
|
|
|
|
|
|
#include "freertos/FreeRTOS.h"
|
2018-02-16 22:48:22 +07:00
|
|
|
#include "freertos/event_groups.h"
|
2018-02-16 02:40:16 +07:00
|
|
|
|
2022-03-22 14:26:49 -03:00
|
|
|
#include <stdint.h>
|
2021-02-19 14:02:31 +00:00
|
|
|
#include <sys/time.h>
|
2018-02-16 02:40:16 +07:00
|
|
|
|
2019-03-19 15:06:20 +08:00
|
|
|
char *platform_create_id_string(void);
|
2018-02-16 02:40:16 +07:00
|
|
|
int platform_random(int max);
|
2022-03-22 14:26:49 -03:00
|
|
|
int64_t platform_tick_get_ms(void);
|
2018-05-03 21:50:24 +07:00
|
|
|
void ms_to_timeval(int timeout_ms, struct timeval *tv);
|
|
|
|
|
|
|
|
|
|
#define ESP_MEM_CHECK(TAG, a, action) if (!(a)) { \
|
2021-02-18 15:33:29 +11:00
|
|
|
ESP_LOGE(TAG,"%s(%d): %s", __FUNCTION__, __LINE__, "Memory exhausted"); \
|
2018-05-03 21:50:24 +07:00
|
|
|
action; \
|
|
|
|
|
}
|
2020-01-19 22:28:35 +01:00
|
|
|
|
|
|
|
|
#define ESP_OK_CHECK(TAG, a, action) if ((a) != ESP_OK) { \
|
2021-02-18 15:33:29 +11:00
|
|
|
ESP_LOGE(TAG,"%s(%d): %s", __FUNCTION__, __LINE__, "Failed with non ESP_OK err code"); \
|
2020-01-19 22:28:35 +01:00
|
|
|
action; \
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-16 02:40:16 +07:00
|
|
|
#endif
|