// Copyright (c) 2024 Cesanta Software Limited // All rights reserved #include "hal.h" #include "mongoose.h" #include "net.h" #define BLINK_PERIOD_MS 1000 // LED blinking period in millis static void server(void *args) { struct mg_mgr mgr; // Initialise Mongoose event manager mg_mgr_init(&mgr); // and attach it to the interface mg_log_set(MG_LL_DEBUG); // Set log level MG_INFO(("Initialising application...")); web_init(&mgr); MG_INFO(("Starting event loop")); for (;;) mg_mgr_poll(&mgr, 1); // Infinite event loop (void) args; } static void blinker(void *args) { gpio_output(LED1); for (;;) { gpio_toggle(LED1); vTaskDelay(pdMS_TO_TICKS(BLINK_PERIOD_MS)); } (void) args; } int main(void) { hal_init(); // Cross-platform hardware init // Start tasks. NOTE: stack sizes are in 32-bit words xTaskCreate(blinker, "blinker", 128, ":)", configMAX_PRIORITIES - 1, NULL); xTaskCreate(server, "server", 2048, 0, configMAX_PRIORITIES - 1, NULL); vTaskStartScheduler(); // This blocks return 0; }