2018-07-04 19:01:03 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include "esp32_compat.h"
|
|
|
|
|
|
|
|
void* g_queue;
|
|
|
|
int g_queue_send_shall_fail = 0;
|
|
|
|
int g_size = 0;
|
|
|
|
|
2019-04-30 07:54:08 -04:00
|
|
|
const char * WIFI_EVENT = "wifi_event";
|
|
|
|
const char * ETH_EVENT = "eth_event";
|
|
|
|
|
|
|
|
esp_err_t esp_event_handler_register(const char * event_base,
|
|
|
|
int32_t event_id,
|
|
|
|
void* event_handler,
|
|
|
|
void* event_handler_arg)
|
|
|
|
{
|
|
|
|
return ESP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
esp_err_t esp_event_handler_unregister(const char * event_base, int32_t event_id, void* event_handler)
|
|
|
|
{
|
|
|
|
return ESP_OK;
|
|
|
|
}
|
|
|
|
|
2018-07-04 19:01:03 -04:00
|
|
|
esp_err_t esp_timer_delete(esp_timer_handle_t timer)
|
|
|
|
{
|
|
|
|
return ESP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
esp_err_t esp_timer_stop(esp_timer_handle_t timer)
|
|
|
|
{
|
|
|
|
return ESP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
esp_err_t esp_timer_start_periodic(esp_timer_handle_t timer, uint64_t period)
|
|
|
|
{
|
|
|
|
return ESP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
esp_err_t esp_timer_create(const esp_timer_create_args_t* create_args,
|
|
|
|
esp_timer_handle_t* out_handle)
|
|
|
|
{
|
|
|
|
return ESP_OK;
|
|
|
|
}
|
|
|
|
|
2019-07-16 05:33:30 -04:00
|
|
|
uint32_t xTaskGetTickCount(void)
|
2018-07-04 19:01:03 -04:00
|
|
|
{
|
2021-06-08 07:27:15 -04:00
|
|
|
static uint32_t tick = 0;
|
|
|
|
return tick++;
|
2018-07-04 19:01:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Queue mock
|
|
|
|
QueueHandle_t xQueueCreate( uint32_t uxQueueLength, uint32_t uxItemSize )
|
|
|
|
{
|
|
|
|
g_size = uxItemSize;
|
|
|
|
g_queue = malloc((uxQueueLength)*(uxItemSize));
|
|
|
|
return g_queue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void vQueueDelete( QueueHandle_t xQueue )
|
|
|
|
{
|
|
|
|
free(xQueue);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t xQueueSend(QueueHandle_t xQueue, const void * pvItemToQueue, TickType_t xTicksToWait)
|
|
|
|
{
|
|
|
|
if (g_queue_send_shall_fail)
|
|
|
|
{
|
|
|
|
return pdFALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memcpy(xQueue, pvItemToQueue, g_size);
|
|
|
|
return pdPASS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t xQueueReceive(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait)
|
|
|
|
{
|
|
|
|
return pdFALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetLastItem(void *pvBuffer)
|
|
|
|
{
|
|
|
|
memcpy(pvBuffer, g_queue, g_size);
|
|
|
|
}
|
|
|
|
|
2019-07-16 05:33:30 -04:00
|
|
|
void ForceTaskDelete(void)
|
2018-07-04 19:01:03 -04:00
|
|
|
{
|
|
|
|
g_queue_send_shall_fail = 1;
|
|
|
|
}
|