Hi there,
I hope this is the right place for my question. I have an own class and I want to use the QueueHandle inside the class for Intertask-comunication. I started with the generic_gpio example from the ESP Examples found here: esp-idf/examples/peripherals/gpio/generic_gpio at 4523f2d67465373f0e732a3264273a8e84a1a6d1 · espressif/esp-idf · GitHub
So i have the problem if I define the QueueHandle_t gpio_evt_queue;
inside the private section of my class, all my classfunctions do not work with this variable. A workaround was to define a variable outside the class as a global variable. The class can work with it but thats not a proper solution. Hopefully someon have a hint for me.
myApp.h
class App {
public:
static void IRAM_ATTR gpio_isr_handler(void* arg);
private:
// with the QueueHandle on this location my code is not working
QueueHandle_t gpio_evt_queue;
myApp.cpp
//with the QueueHandle on this Location, my code is working
static QueueHandle_t gpio_evt_queue;
App::App()
{
//compiler is throwing a error with QueueHandle in private section of myApp.h
gpio_evt_queue = xQueueCreate(10, sizeof(uint32_t));
};
void App::gpio_isr_handler(void* arg){
uint32_t gpio_num = (uint32_t) arg;
xQueueSendFromISR(gpio_evt_queue, &gpio_num, NULL);
}
In the line xQueueSendFromISR(gpio_evt_queue, &gpio_num, NULL); The IDE says ‘a nonstatic reference must be relative to a specific object’.
Hopefully someon knows what is to do. Thank you for your time and effort!
Greetings