new buzzer component

This commit is contained in:
2025-07-22 00:09:58 +01:00
parent 84f106eee5
commit bd587a10c0
58 changed files with 3215 additions and 6961 deletions

View File

@@ -1,6 +1,8 @@
set(srcs
"src/wifi.c")
"src/network_events.c"
"src/network.c"
)
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include"
PRIV_REQUIRES nvs_flash esp_netif esp_wifi mdns)
PRIV_REQUIRES nvs_flash esp_netif esp_wifi mdns esp_event)

View File

@@ -0,0 +1,24 @@
#pragma once
#include "esp_event.h"
#ifdef __cplusplus
extern "C" {
#endif
// Declaração do base de eventos personalizados da rede
ESP_EVENT_DECLARE_BASE(NETWORK_EVENTS);
// Identificadores dos eventos possíveis do módulo network
typedef enum {
NETWORK_EVENT_AP_STARTED,
NETWORK_EVENT_AP_STOP,
NETWORK_EVENT_STA_CONNECTED,
NETWORK_EVENT_STA_DISCONNECTED,
NETWORK_EVENT_STA_GOT_IP,
NETWORK_EVENT_STA_LOST_IP
} network_event_id_t;
#ifdef __cplusplus
}
#endif

View File

@@ -10,7 +10,9 @@
#include "nvs.h"
#include "mdns.h"
#include "wifi.h"
#include "network_events.h"
#include "network.h"
#define AP_SSID "plx-%02x%02x%02x"
@@ -292,6 +294,8 @@ void wifi_ap_start(void)
{
ESP_LOGI(TAG, "Starting AP");
esp_event_post(NETWORK_EVENTS, NETWORK_EVENT_AP_STARTED, NULL, 0, portMAX_DELAY);
xEventGroupClearBits(wifi_event_group, WIFI_STA_MODE_BIT);
esp_wifi_stop();
@@ -304,6 +308,9 @@ void wifi_ap_start(void)
void wifi_ap_stop(void)
{
ESP_LOGI(TAG, "Stopping AP");
esp_event_post(NETWORK_EVENTS, NETWORK_EVENT_AP_STOP, NULL, 0, portMAX_DELAY);
xEventGroupClearBits(wifi_event_group, WIFI_AP_MODE_BIT);
esp_wifi_stop();

View File

@@ -0,0 +1,4 @@
#include "network_events.h"
// Define o base de eventos
ESP_EVENT_DEFINE_BASE(NETWORK_EVENTS);