From e43ed7d47d9b2c37ccff6dc75d6bfe4c8a55ac86 Mon Sep 17 00:00:00 2001 From: Mimmo La Fauci Date: Thu, 21 Mar 2013 09:24:07 +0100 Subject: Added API to set static IP and DNS server --- firmwares/wifishield/wifiHD/src/main.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'firmwares/wifishield/wifiHD/src/main.c') diff --git a/firmwares/wifishield/wifiHD/src/main.c b/firmwares/wifishield/wifiHD/src/main.c index e94e724..4b1f06f 100644 --- a/firmwares/wifishield/wifiHD/src/main.c +++ b/firmwares/wifishield/wifiHD/src/main.c @@ -78,11 +78,6 @@ void fw_download_cb(void* ctx, uint8_t** buf, uint32_t* len) #endif #endif -struct ctx_server { - struct net_cfg net_cfg; - uint8_t wl_init_complete; -}; - bool ifStatus = false; bool scanNetCompleted = false; @@ -122,7 +117,7 @@ wl_cm_conn_cb(struct wl_network_t* net, void* ctx) hs->net_cfg.dhcp_running = 1; } else { - netif_set_up(hs->net_cfg.netif); + netif_set_up(hs->net_cfg.netif); } INFO_INIT("Start DNS...\n"); @@ -270,7 +265,7 @@ poll(struct ctx_server* hs) #endif } -void initShell() +void initShell(void* ctx) { /* initialize shell */ INFO_INIT("Shell init...\n"); @@ -281,7 +276,7 @@ void initShell() console_add_cmd("status", cmd_status, NULL); console_add_cmd("debug", cmd_debug, NULL); console_add_cmd("dumpBuf", cmd_dumpBuf, NULL); - console_add_cmd("ipconfig", cmd_set_ip, NULL); + console_add_cmd("ipconfig", cmd_set_ip, ctx); #ifdef ADD_CMDS console_add_cmd("powersave", cmd_power, NULL); @@ -325,6 +320,7 @@ wl_init_complete_cb(void* ctx) /* default is dhcp enabled */ hs->net_cfg.dhcp_enabled = 1; + start_ip_stack(&hs->net_cfg, ipaddr, netmask, @@ -339,7 +335,7 @@ wl_init_complete_cb(void* ctx) wl_scan(); - if (initSpi()){ + if (initSpi(hs)){ WARN("Spi not initialized\n"); }else { @@ -381,8 +377,6 @@ main(void) tc_init(); - initShell(); - delay_init(FOSC0); #ifdef _TEST_SPI_ @@ -408,7 +402,7 @@ main(void) INFO_INIT("hs:%p size:0x%x netif:%p size:0x%x\n", hs, size_ctx_server, hs->net_cfg.netif, size_netif); - + initShell(hs); timer_init(NULL, NULL); lwip_init(); -- cgit v1.2.3-18-g5258