Problem with xTaskCreate in C++...
Posted: Thu Mar 15, 2018 8:56 pm
Hi, I'm trying to write a class, but I've a compilation error.
Anyone can tell me why?
This is the interested code...
led.h
led.cpp
During compilation, I've this error:
If I try to declare blinkLedTask to static, I've this error:
I'm not very good C++ developer, I'm trying to learn it.
Thanks.
Regards.
Stefano
Anyone can tell me why?
This is the interested code...
led.h
Code: Select all
#ifndef LED_H
#define LED_H
#include <stdint.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
class LED
{
public:
LED();
private:
void blinkLedTask(void *pvParameter);
...
};
#endif //LED_H
Code: Select all
#include "led.h"
LED::LED()
{
...
xTaskCreate(&LED::blinkLedTask, "blinkLedTask", 2048, NULL, 5, NULL);
}
void LED::blinkLedTask(void *pvParameter)
{
...
}
Code: Select all
error: invalid use of non-static member function xTaskCreate(blinkLedTask, "blinkLedTask", 2048, NULL, 5, NULL);
Code: Select all
error: cannot declare member function 'static void LED::blinkLedTask(void*)' to have static linkage [-fpermissive]
static void LED::blinkLedTask(void *pvParameter)
Thanks.
Regards.
Stefano