add wifi semaphore

This commit is contained in:
j3d1 2021-07-19 00:18:16 +02:00
parent 2a55d69ac4
commit 727dc8c2ee
3 changed files with 10 additions and 0 deletions

View file

@ -20,6 +20,8 @@ void user_init(void)
system_init_config();
wifi_available_semaphore = xSemaphoreCreateBinary();
xTaskCreate(wifi_task, "wifi_task", 512, NULL, 2, NULL);
}

View file

@ -30,6 +30,7 @@ char *wifi_sta_password = nullptr;
char *wifi_ap_ssid = nullptr;
char *wifi_ap_password = nullptr;
SemaphoreHandle_t wifi_available_semaphore = nullptr;
[[noreturn]] static void dns_task(void *pvParameters) {
char *wifi_ap_ip_addr = nullptr;
@ -352,6 +353,8 @@ extern "C" [[noreturn]] void wifi_task(void *pvParameters) {
if(wifi_ap_ssid) free(wifi_ap_ssid);
if(wifi_ap_password) free(wifi_ap_password);
xSemaphoreGive( wifi_available_semaphore);
while (1) {
//monitor connection here
vTaskDelay(5000);

View file

@ -5,10 +5,15 @@
#ifndef FIRMWARE_WIFI_H
#define FIRMWARE_WIFI_H
#include <FreeRTOS.h>
#include <semphr.h>
#ifdef __cplusplus
extern "C" {
#endif
extern SemaphoreHandle_t wifi_available_semaphore;
void wifi_task(void *pvParameters);
#ifdef __cplusplus