[core] Remove public FreeRTOS dependency

This commit is contained in:
Kuba Szczodrzyński
2023-03-03 18:36:54 +01:00
parent 47daefe675
commit 6d2b653f61
6 changed files with 15 additions and 52 deletions

View File

@@ -2,6 +2,10 @@
#include "WiFi.h"
#if LT_HAS_FREERTOS
#include <FreeRTOS.h>
#endif
bool WiFiClass::mode(WiFiMode mode) {
// store a pointer to WiFi for WiFiEvents.cpp
pWiFi = this;

View File

@@ -15,6 +15,10 @@ extern "C" {
#include <mbedtls/sha256.h>
#include <mbedtls/ssl.h>
#if LT_HAS_FREERTOS
#include <FreeRTOS.h>
#endif
} // extern "C"
#define _clientKeyC ((mbedtls_pk_context *)_clientKey)

View File

@@ -2,36 +2,6 @@
#include "wiring_compat.h"
#if LT_HAS_FREERTOS
BaseType_t xTaskCreateUniversal(
TaskFunction_t pxTaskCode,
const char *const pcName,
const uint32_t usStackDepth,
void *const pvParameters,
UBaseType_t uxPriority,
TaskHandle_t *const pxCreatedTask,
const BaseType_t xCoreID
) {
// #ifndef CONFIG_FREERTOS_UNICORE
// if (xCoreID >= 0 && xCoreID < 2) {
// return xTaskCreatePinnedToCore(
// pxTaskCode,
// pcName,
// usStackDepth,
// pvParameters,
// uxPriority,
// pxCreatedTask,
// xCoreID
// );
// } else {
// #endif
return xTaskCreate(pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask);
// #ifndef CONFIG_FREERTOS_UNICORE
// }
// #endif
}
#endif
String ipToString(const IPAddress &ip) {
char szRet[16];
sprintf(szRet, "%hhu.%hhu.%hhu.%hhu", ip[0], ip[1], ip[2], ip[3]);

View File

@@ -8,14 +8,6 @@
extern "C" {
#endif // __cplusplus
#if LT_HAS_FREERTOS
// dirty hack to avoid including BDK's arch.h (from FreeRTOS/portable.h)
#define _ARCH_H_
#include <FreeRTOS.h>
#include <task.h>
#undef _ARCH_H_
#endif
// Definitions for error constants.
#define esp_err_t int
#define ESP_OK 0 /*!< esp_err_t value indicating success (no error) */
@@ -34,20 +26,9 @@ extern "C" {
#define digitalPinToInterrupt(pin) (pin)
// FreeRTOS utilities
#if LT_HAS_FREERTOS
// if xCoreID < 0 or CPU is unicore, it will use xTaskCreate, else xTaskCreatePinnedToCore
// allows to easily handle all possible situations without repetitive code
BaseType_t xTaskCreateUniversal(
TaskFunction_t pxTaskCode,
const char *const pcName,
const uint32_t usStackDepth,
void *const pvParameters,
UBaseType_t uxPriority,
TaskHandle_t *const pxCreatedTask,
const BaseType_t xCoreID
);
#define xTaskCreateUniversal(pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, xCoreID) \
xTaskCreate(pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask)
#define xTaskCreatePinnedToCore xTaskCreateUniversal
#endif
// Default values from sdkconfig.h
#define CONFIG_LWIP_MAX_ACTIVE_TCP 16

View File

@@ -2,6 +2,10 @@
#include "wiring_custom.h"
#if LT_HAS_FREERTOS
#include <FreeRTOS.h>
#endif
int _analogReadResolution = 10; // 0-1023
int _analogWriteResolution = 8; // 0-255
int _analogWritePeriod = 20000; // 50 Hz

View File

@@ -93,7 +93,7 @@ void lt_log_disable();
#define LT_FM(...)
#endif
#if LT_LOG_HEAP
#if LT_LOG_HEAP && LT_HAS_FREERTOS
#define LT_HEAP_I() LT_I("Free heap: %u", LT_HEAP_FUNC());
#else
#define LT_HEAP_I()