Arduino 在FreeRTOS中使用信号量

Arduino 在FreeRTOS中使用信号量,arduino,freertos,esp32,Arduino,Freertos,Esp32,我正在尝试使用的信号量为。我的代码如下: #include <Arduino.h> #include <freertos/task.h> #include <freertos/queue.h> #define configUSE_MUTEXES 1 #define configUSE_COUNTING_SEMAPHORES 1 void vTaskExample(void *pvParameters); void accessSharedResource{}

我正在尝试使用的信号量为。我的代码如下:

#include <Arduino.h>
#include <freertos/task.h>
#include <freertos/queue.h>
#define configUSE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 1
void vTaskExample(void *pvParameters);
void accessSharedResource{}
volatile SemaphoreHandle_t xResourceSemaphore = NULL;
void setup()
{
    xTaskCreatePinnedToCore(&vTaskExample, "example task", 1024, NULL, 2, NULL, 1);
}

void loop()
{
    // Do nothing
}

void vTaskExample(void *pvParameters)
{
    vSemaphoreCreateBinary(xResourceSemaphore);
    while (true)
    {
        if (xSemaphoreAltTake(xResourceSemaphore, (TickType_t)0))
        {
            accessSharedResource();
            xSemaphoreAltGive(xResourceSemaphore);
        }
    }
}
我查阅了freeRTOS文档,它表明这两个函数位于queue.h中;因此,应该可以使用。此外,我还通过设置
configUSE\u互斥体和configUSE\u COUNTING\u信号量来设置必要的
freeRTOS配置


有没有关于为什么不编译的建议?

queue.h中只提供原型-无任何可执行文件。如果查看,您会注意到替代API已被弃用很长一段时间,并且只有当configUSE_alternative_API设置为1时才包含在生成中。

队列中仅提供原型。h-无可执行文件。如果您查看,您会注意到替代API已被弃用很长时间,并且只有当configUSE\u alternative\u API设置为1时才包含在构建中。

非常感谢!如果这需要我使用不推荐的API,我可能应该重新考虑我的设计。非常感谢!如果这需要我使用不推荐的API,我可能应该重新考虑我的设计。
main.cpp:(.text._Z12vTaskExamplePv+0x37): undefined reference to `xQueueAltGenericReceive'
main.cpp:(.text._Z12vTaskExamplePv+0x4b): undefined reference to `xQueueAltGenericSend'