From 1ba21da6cbc63c0c549fb92731e25bedc482eb51 Mon Sep 17 00:00:00 2001 From: Filip Wandzio Date: Thu, 4 Sep 2025 22:25:39 +0200 Subject: Unify the directory, add new analysis methods, unify the code style Signed-off-by: Filip Wandzio --- firmware/include/config.h | 21 +++++++++++++++++++++ firmware/include/mqtt.h | 15 +++++++++++++++ firmware/include/wifi.h | 17 +++++++++++++++++ firmware/include/wifi_scan.h | 12 ++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 firmware/include/config.h create mode 100644 firmware/include/mqtt.h create mode 100644 firmware/include/wifi.h create mode 100644 firmware/include/wifi_scan.h (limited to 'firmware/include') diff --git a/firmware/include/config.h b/firmware/include/config.h new file mode 100644 index 0000000..467e1f7 --- /dev/null +++ b/firmware/include/config.h @@ -0,0 +1,21 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#define PUB_TOPIC "device/echo/in" +#define SUB_TOPIC "device/echo/out" +#define PUBLISH_INTERVAL_MS 1000 +#define BUFFER_SIZE 32 + +#ifndef WIFI_SSID +#define WIFI_SSID "UNKNOWN" +#endif + +#ifndef WIFI_PASS +#define WIFI_PASS "UNKNOWN" +#endif + +#ifndef MQTT_URI +#define MQTT_URI "mqtt://0.0.0.0" +#endif + +#endif diff --git a/firmware/include/mqtt.h b/firmware/include/mqtt.h new file mode 100644 index 0000000..4f46b5a --- /dev/null +++ b/firmware/include/mqtt.h @@ -0,0 +1,15 @@ +#ifndef MQTT_H +#define MQTT_H + +#include "mqtt_client.h" + +/** + * @brief Starts the MQTT application. + * + * Initializes the MQTT client, registers event handlers, + * and starts the MQTT client. Also creates the publisher task + * that periodically sends messages. + */ +void mqtt_app_start(void); + +#endif diff --git a/firmware/include/wifi.h b/firmware/include/wifi.h new file mode 100644 index 0000000..bdcbe76 --- /dev/null +++ b/firmware/include/wifi.h @@ -0,0 +1,17 @@ +#ifndef WIFI_H +#define WIFI_H + +#include "esp_wifi.h" +#include "wifi_scan.h" + +/** + * @brief Initializes the WiFi interface in station mode. + * + * Sets up the default WiFi station network interface, + * initializes the WiFi driver with default configurations, + * starts WiFi, scans for available networks, and connects to + * the configured SSID and password. + */ +void wifi_init_sta(void); + +#endif diff --git a/firmware/include/wifi_scan.h b/firmware/include/wifi_scan.h new file mode 100644 index 0000000..dc18e7c --- /dev/null +++ b/firmware/include/wifi_scan.h @@ -0,0 +1,12 @@ +#ifndef WIFI_SCAN_H +#define WIFI_SCAN_H + +/** + * @brief Starts scanning for available WiFi networks. + * + * This function triggers the WiFi hardware to scan + * for nearby WiFi access points asynchronously. + */ +void wifi_scan_start(void); + +#endif // WIFI_SCAN_H -- cgit v1.2.3