+ f_mount(0, NULL);
+ LOG_INFO("Umount FAT filesystem.\n");
+ }
+ else
+ {
+ http_sendFileNotFound(client, HTTP_CONTENT_HTML);
+ netconn_write(client, http_sd_not_present, http_sd_not_present_len, NETCONN_NOCOPY);
+ }
+
+ return 0;
+}
+
+
+/*
+ * Static cgi table where we associate callback to page.
+ */
+static HttpCGI cgi_table[] =
+{
+ { CGI_MATCH_NAME, "echo", cgi_echo },
+ { CGI_MATCH_NAME, "get_temperature", cgi_temp },
+ { CGI_MATCH_NAME, "get_uptime", cgi_uptime },
+ { CGI_MATCH_NAME, "get_resistor", cgi_resistor },
+ { CGI_MATCH_NAME, "set_led", cgi_led },
+ { CGI_MATCH_NAME, "get_ledStatus", cgi_ledStatus },
+ { CGI_MATCH_NAME, "error", cgi_error },
+ { CGI_MATCH_NAME, "status", cgi_status },
+ { CGI_MATCH_NAME, "get_chipinfo", cgi_chipInfo },
+ { CGI_MATCH_NAME, "display", cgi_displayMsg },
+ { CGI_MATCH_NAME, "bertos_logo_jpg", cgi_logo },
+ { CGI_MATCH_NONE, NULL, NULL }
+};
+
+
+int main(void)
+{
+ struct netconn *server;
+
+ /* Hardware initialization */
+ init();
+ http_init(http_htmPageLoad, cgi_table);
+
+ lcd_hx8347_blitBitmap24(12, 52, BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, bmp_logo);
+
+ dhcp_start(&netif);
+ while (!netif.ip_addr.addr)
+ timer_delay(DHCP_FINE_TIMER_MSECS);
+
+ sprintf(status.local_ip, "%d.%d.%d.%d", IP_ADDR_TO_INT_TUPLE(netif.ip_addr.addr));
+ sprintf(status.last_connected_ip, "%d.%d.%d.%d", IP_ADDR_TO_INT_TUPLE(0));
+ LOG_INFO("dhcp ok: ip = %s\n", status.local_ip);
+
+ text_xprintf(lcd_bitmap, 14, 0, 0, "Board ip: %s", status.local_ip);
+ lcd_hx8347_blitBitmap(lcd_bitmap);
+
+
+ proc_new(proc_displayRefresh, NULL, KERN_MINSTACKSIZE * 2, NULL);
+
+ server = netconn_new(NETCONN_TCP);
+ netconn_bind(server, IP_ADDR_ANY, 80);
+ netconn_listen(server);
+
+ while (1)
+ {
+ http_poll(server);