Perhaps a bit off-topic and perhaps a beginners error, but this one is biting me with all erratic behaviour on the ESP32. So please lend me your ears.
Within an app.h I hold the definitions for structs I use for different tasks. In this example I have a PixelTask which drives a Neopixel depending on bits on an app event group. I use the pvParameter to feed it the proper GPIO when I xTaskCreate it from main like so:
app.h:
Code: Select all
/** Structure to initialize Pixel task */
typedef struct {
gpio_num_t dio_pin;
} pixel_config_t;
Code: Select all
#define PIXEL_PIN_DIN GPIO_NUM_19
Code: Select all
pixel_config_t config;
config.dio_pin = PIXEL_PIN_DIN;
xTaskCreate(&pixel_task, "pixel_task", 2048, &config, 5, NULL);
Code: Select all
void pixel_task(void *data) {
pixel_config_t pixel_config = *(pixel_config_t *) data;
ESP_LOGI(TAG, "starting task");
ESP_LOGI(TAG, "pixel_config.dio_pin %i", pixel_config.dio_pin);
Code: Select all
/** Structure to initialize WiFi STA task */
typedef struct {
const char *ssid;
const char *password;
const char *client_hostname;
} local_wifi_sta_config_t;
So how does one pass parameters the proper way? I'm missing something here..
thanks for your time,
Martijn