diff --git a/components/heartbeat/heartbeat.h b/components/heartbeat/include/heartbeat.h similarity index 100% rename from components/heartbeat/heartbeat.h rename to components/heartbeat/include/heartbeat.h diff --git a/components/wifi/limbo_wifi.h b/components/wifi/include/limbo_wifi.h similarity index 100% rename from components/wifi/limbo_wifi.h rename to components/wifi/include/limbo_wifi.h diff --git a/components/wifi/limbo_wifi.c b/components/wifi/limbo_wifi.c index 033f75c..87152df 100644 --- a/components/wifi/limbo_wifi.c +++ b/components/wifi/limbo_wifi.c @@ -1,9 +1,17 @@ - +// ESP components #include "esp_wifi.h" +#include "esp_event.h" +#include "esp_event_loop.h" +// Limbo components #include "limbo_wifi.h" #include "skynet.h" +esp_err_t event_handler(void *ctx, system_event_t *event) +{ + return ESP_OK; +} + void limbo_wifi_init(void) { tcpip_adapter_init(); diff --git a/main/main.c b/main/main.c index 9e73015..b78399b 100644 --- a/main/main.c +++ b/main/main.c @@ -1,43 +1,16 @@ +// ESP components #include "freertos/FreeRTOS.h" -#include "esp_wifi.h" #include "esp_system.h" -#include "esp_event.h" -#include "esp_event_loop.h" #include "nvs_flash.h" -#include "driver/gpio.h" -#include "blink.c" - -esp_err_t event_handler(void *ctx, system_event_t *event) -{ - return ESP_OK; -} - -void limbo_wifi_init(void) -{ - tcpip_adapter_init(); - ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) ); - wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); - ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); - ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) ); - ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); - wifi_config_t sta_config = { - .sta = { - .ssid = "Skynet", - .password = SKYNET_PASSWORD, - .bssid_set = false - } - }; - ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &sta_config) ); - ESP_ERROR_CHECK( esp_wifi_start() ); - ESP_ERROR_CHECK( esp_wifi_connect() ); -} - +// Limbo components +#include "heartbeat.h" +#include "limbo_wifi.h" void app_main(void) { nvs_flash_init(); - xTaskCreate(&blink_task, "blink_task", 512, NULL, 5, NULL); + xTaskCreate(&heartbeat_task, "heartbeat_task", 512, NULL, 5, NULL); limbo_wifi_init();