Moving into components parts of the provider project
This commit is contained in:
@@ -145,6 +145,12 @@ dependencies:
|
|||||||
registry_url: https://components.espressif.com/
|
registry_url: https://components.espressif.com/
|
||||||
type: service
|
type: service
|
||||||
version: 1.20.4
|
version: 1.20.4
|
||||||
|
led:
|
||||||
|
dependencies: []
|
||||||
|
source:
|
||||||
|
path: C:\Dev\Classified\Calendink\components\led
|
||||||
|
type: local
|
||||||
|
version: '*'
|
||||||
lvgl/lvgl:
|
lvgl/lvgl:
|
||||||
component_hash: 17e68bfd21f0edf4c3ee838e2273da840bf3930e5dbc3bfa6c1190c3aed41f9f
|
component_hash: 17e68bfd21f0edf4c3ee838e2273da840bf3930e5dbc3bfa6c1190c3aed41f9f
|
||||||
dependencies: []
|
dependencies: []
|
||||||
@@ -168,8 +174,9 @@ direct_dependencies:
|
|||||||
- espressif/mdns
|
- espressif/mdns
|
||||||
- idf
|
- idf
|
||||||
- joltwallet/littlefs
|
- joltwallet/littlefs
|
||||||
|
- led
|
||||||
- lvgl/lvgl
|
- lvgl/lvgl
|
||||||
- network
|
- network
|
||||||
manifest_hash: adc42d97d037e4815c3e1d03227cf1a5b29b8a914aa24fefa5760edd541a6bac
|
manifest_hash: 8a9836e63bff09fce191602012b7b8be5ce92e62a59560b077f9129823441672
|
||||||
target: esp32s3
|
target: esp32s3
|
||||||
version: 2.0.0
|
version: 2.0.0
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
idf_component_register(SRCS "main.cpp"
|
idf_component_register(SRCS "main.cpp"
|
||||||
PRIV_REQUIRES esp_http_server esp_eth
|
PRIV_REQUIRES esp_http_server
|
||||||
esp_wifi nvs_flash esp_netif vfs
|
nvs_flash vfs esp_timer
|
||||||
json app_update esp_timer esp_psram mdns driver network
|
json app_update esp_psram mdns driver network
|
||||||
INCLUDE_DIRS ".")
|
INCLUDE_DIRS "." "../../components/shared")
|
||||||
|
|
||||||
if(CONFIG_CALENDINK_DEPLOY_WEB_PAGES)
|
if(CONFIG_CALENDINK_DEPLOY_WEB_PAGES)
|
||||||
set(WEB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../frontend")
|
set(WEB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../frontend")
|
||||||
|
|||||||
@@ -21,3 +21,5 @@ dependencies:
|
|||||||
lvgl/lvgl: "9.4.0"
|
lvgl/lvgl: "9.4.0"
|
||||||
network:
|
network:
|
||||||
path: "../../components/network"
|
path: "../../components/network"
|
||||||
|
led:
|
||||||
|
path: "../../components/led"
|
||||||
|
|||||||
@@ -18,10 +18,10 @@
|
|||||||
// Project headers
|
// Project headers
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
#include "network.hpp"
|
#include "network.hpp"
|
||||||
|
#include "led.hpp"
|
||||||
|
|
||||||
// Project cpp (Unity Build entry)
|
// Project cpp (Unity Build entry)
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#include "led_status.cpp"
|
|
||||||
#include "http_server.cpp"
|
#include "http_server.cpp"
|
||||||
#include "mdns_service.cpp"
|
#include "mdns_service.cpp"
|
||||||
#include "udp_logger.cpp"
|
#include "udp_logger.cpp"
|
||||||
@@ -42,7 +42,7 @@ constexpr bool kBlockUntilEthernetEstablished = false;
|
|||||||
internal void my_timer_callback(void *arg)
|
internal void my_timer_callback(void *arg)
|
||||||
{
|
{
|
||||||
ESP_LOGI(kTagMain, "Timer finished! Turning Led Off...");
|
ESP_LOGI(kTagMain, "Timer finished! Turning Led Off...");
|
||||||
destroy_led();
|
turn_off_led();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void app_main()
|
extern "C" void app_main()
|
||||||
@@ -378,7 +378,7 @@ shutdown:
|
|||||||
g_Wifi_Initialized = false;
|
g_Wifi_Initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy_led();
|
turn_off_led();
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_event_loop_delete_default());
|
ESP_ERROR_CHECK(esp_event_loop_delete_default());
|
||||||
ESP_ERROR_CHECK(nvs_flash_deinit());
|
ESP_ERROR_CHECK(nvs_flash_deinit());
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
idf_component_register(SRCS "led.cpp"
|
||||||
|
INCLUDE_DIRS "." "../shared"
|
||||||
|
PRIV_REQUIRES led_strip)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// Project includes
|
// Project includes
|
||||||
#include "types.hpp"
|
#include "led.hpp"
|
||||||
|
|
||||||
// SDK Includes
|
// SDK Includes
|
||||||
#include "led_strip.h"
|
#include "led_strip.h"
|
||||||
@@ -7,18 +7,9 @@
|
|||||||
// Could be a config but its the GPIO on my ESP32-S3-ETH
|
// Could be a config but its the GPIO on my ESP32-S3-ETH
|
||||||
#define LED_GPIO GPIO_NUM_21
|
#define LED_GPIO GPIO_NUM_21
|
||||||
|
|
||||||
enum class led_status : uint8
|
|
||||||
{
|
|
||||||
ConnectingEthernet,
|
|
||||||
ConnectingWifi,
|
|
||||||
ReadyEthernet,
|
|
||||||
ReadyWifi,
|
|
||||||
Failed
|
|
||||||
};
|
|
||||||
|
|
||||||
internal led_strip_handle_t led_strip;
|
internal led_strip_handle_t led_strip;
|
||||||
|
|
||||||
internal void setup_led(void)
|
void setup_led(void)
|
||||||
{
|
{
|
||||||
/* LED strip initialization with the GPIO and pixels number*/
|
/* LED strip initialization with the GPIO and pixels number*/
|
||||||
led_strip_config_t strip_config = {};
|
led_strip_config_t strip_config = {};
|
||||||
@@ -34,9 +25,9 @@ internal void setup_led(void)
|
|||||||
led_strip_clear(led_strip);
|
led_strip_clear(led_strip);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void destroy_led(void) { led_strip_clear(led_strip); }
|
void turn_off_led(void) { led_strip_clear(led_strip); }
|
||||||
|
|
||||||
internal void set_led_status(led_status status)
|
void set_led_status(led_status status)
|
||||||
{
|
{
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
@@ -59,8 +50,7 @@ internal void set_led_status(led_status status)
|
|||||||
led_strip_refresh(led_strip);
|
led_strip_refresh(led_strip);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_CALENDINK_BLINK_IP
|
void led_blink_number(int n, uint8_t r, uint8_t g, uint8_t b)
|
||||||
internal void led_blink_number(int n, uint8_t r, uint8_t g, uint8_t b)
|
|
||||||
{
|
{
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
{
|
{
|
||||||
@@ -87,4 +77,3 @@ internal void led_blink_number(int n, uint8_t r, uint8_t g, uint8_t b)
|
|||||||
}
|
}
|
||||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "types.hpp"
|
||||||
|
|
||||||
|
enum class led_status : uint8
|
||||||
|
{
|
||||||
|
ConnectingEthernet,
|
||||||
|
ConnectingWifi,
|
||||||
|
ReadyEthernet,
|
||||||
|
ReadyWifi,
|
||||||
|
Failed
|
||||||
|
};
|
||||||
|
|
||||||
|
void setup_led(void);
|
||||||
|
void turn_off_led(void);
|
||||||
|
void set_led_status(led_status status);
|
||||||
|
void led_blink_number(int n, uint8_t r, uint8_t g, uint8_t b);
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRCS "network.cpp"
|
idf_component_register(SRCS "network.cpp"
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "." "../shared"
|
||||||
PRIV_REQUIRES esp_eth esp_wifi esp_netif driver)
|
PRIV_REQUIRES esp_eth esp_wifi esp_netif driver)
|
||||||
|
|||||||
@@ -16,13 +16,11 @@
|
|||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
#include "freertos/timers.h"
|
#include "freertos/timers.h"
|
||||||
|
|
||||||
|
#include "types.hpp"
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "network.hpp"
|
#include "network.hpp"
|
||||||
|
|
||||||
#ifndef internal
|
|
||||||
#define internal static
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
#if CONFIG_CALENDINK_BLINK_IP
|
#if CONFIG_CALENDINK_BLINK_IP
|
||||||
internal esp_err_t get_ip_info(esp_netif_ip_info_t *ip_info);
|
internal esp_err_t get_ip_info(esp_netif_ip_info_t *ip_info);
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esp_err.h"
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "esp_err.h"
|
||||||
|
|
||||||
esp_err_t connect_ethernet(bool blockUntilIPAcquired);
|
esp_err_t connect_ethernet(bool blockUntilIPAcquired);
|
||||||
void disconnect_ethernet();
|
void disconnect_ethernet();
|
||||||
esp_err_t check_ethernet_connection(uint32_t timeoutSeconds);
|
esp_err_t check_ethernet_connection(uint32_t timeoutSeconds);
|
||||||
|
|||||||
Reference in New Issue
Block a user