-
-
Save projectgus/f4f4ec494db2c67f1e1261c0b9309d91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "freertos/FreeRTOS.h" | |
#include "freertos/queue.h" | |
#include "freertos/task.h" | |
#include "esp_wifi.h" | |
#include "esp_system.h" | |
#include "esp_event.h" | |
#include "esp_event_loop.h" | |
#include "esp_log.h" | |
#include "nvs_flash.h" | |
#include "driver/gpio.h" | |
static void task1(void *pvParameters); | |
static void task2(void *pvParameters); | |
static QueueHandle_t systemEvtQueue; | |
void app_main() | |
{ | |
systemEvtQueue = xQueueCreate(10, sizeof(uint8_t)); | |
xTaskCreate(&task1, "GUI task", 2048, NULL, 10, NULL); | |
xTaskCreate(&task2, "Event task", 2048, NULL, 10, NULL); | |
} | |
static void task1(void *pvParameters) | |
{ | |
uint8_t event = 0; | |
while (1) | |
{ | |
event++; | |
xQueueSend(systemEvtQueue, (void *)&event, (TickType_t)0); | |
ESP_LOGI(__func__, "Sending event %i", event); | |
vTaskDelay(100 / portTICK_PERIOD_MS); | |
heap_caps_check_integrity_all(true); | |
} | |
} | |
static void task2(void *pvParameters) | |
{ | |
uint8_t event = 0; | |
while (1) | |
{ | |
if (xQueueReceive(systemEvtQueue, (void *)&event, (TickType_t)0)) | |
{ | |
ESP_LOGI(__func__, "Received event %i", event); | |
} | |
vTaskDelay(100 / portTICK_PERIOD_MS); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment