pico-bmc/main.c

41 lines
924 B
C
Raw Normal View History

#define TCP_PORT 80
#define DEBUG_printf printf
#include "pico_lib.h"
#include "handlers.h"
#include "http_serv.h"
2024-02-14 02:01:59 +00:00
#include "secret.h"
int main() {
stdio_init_all();
2024-02-14 02:01:59 +00:00
if (cyw43_arch_init()) {
DEBUG_printf("[INIT] [ERR] Failed to initialise cyw43\n");
return 1;
}
2024-02-14 02:01:59 +00:00
cyw43_arch_enable_sta_mode();
if (cyw43_arch_wifi_connect_timeout_ms(WIFI_SSID, WIFI_PASS, CYW43_AUTH_WPA2_AES_PSK, 30000)){
DEBUG_printf("[INIT] [ERR] Wi-Fi failed to connect\n");
2024-02-14 02:01:59 +00:00
return -1;
}
DEBUG_printf("[INIT] [OK ] Wi-Fi connected successfully\n");
2024-02-14 02:01:59 +00:00
http_serv_init();
2024-02-14 02:01:59 +00:00
2024-02-16 22:45:10 +00:00
// init bmc handler
bmc_handler_init();
2024-02-16 22:45:10 +00:00
// set LED to on to indicate it has connected and initialized
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
2024-02-29 22:21:31 +00:00
while (!http_serv_state->complete) {
sleep_ms(1000);
}
2024-02-29 22:21:31 +00:00
bmc_handler_deinit();
http_serv_deinit();
cyw43_arch_deinit();
return 0;
2024-02-14 02:01:59 +00:00
}