projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reformat.
[bertos.git]
/
boards
/
sam3x-ek
/
examples
/
sam3x-ek_http_server
/
main.c
diff --git
a/boards/sam3x-ek/examples/sam3x-ek_http_server/main.c
b/boards/sam3x-ek/examples/sam3x-ek_http_server/main.c
index 3fe9aebd5e68959d2e9b1dd7a0da79962fb593e8..30054db8778db960f46190e8b1a707b15f2d81bc 100644
(file)
--- a/
boards/sam3x-ek/examples/sam3x-ek_http_server/main.c
+++ b/
boards/sam3x-ek/examples/sam3x-ek_http_server/main.c
@@
-92,13
+92,6
@@
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
-/* Macro to unpack the ip addres from lwip format in 4 int*/
-#define IP_ADDR_TO_INT_TUPLE(addr) \
- (int)((addr) >> 0 & 0xff), \
- (int)((addr) >> 8 & 0xff), \
- (int)((addr) >> 16 & 0xff), \
- (int)((addr) >> 24 & 0xff)
-
/* Network interface global variables */
static struct ip_addr ipaddr, netmask, gw;
static struct netif netif;
/* Network interface global variables */
static struct ip_addr ipaddr, netmask, gw;
static struct netif netif;
@@
-198,7
+191,7
@@
static NORETURN void proc_displayRefresh(void)
//LOG_INFO("Refresh display\n");
status.internal_temp = hw_convertToDegree(adc_read(ADC_TEMPERATURE_CH));
//LOG_INFO("Refresh display\n");
status.internal_temp = hw_convertToDegree(adc_read(ADC_TEMPERATURE_CH));
- status.up_time +=
2
;
+ status.up_time +=
1
;
sec_to_strDhms(status.up_time, (char *)tx_buf, sizeof(tx_buf));
gfx_bitmapClear(lcd_bitmap);
sec_to_strDhms(status.up_time, (char *)tx_buf, sizeof(tx_buf));
gfx_bitmapClear(lcd_bitmap);
@@
-212,7
+205,7
@@
static NORETURN void proc_displayRefresh(void)
lcd_hx8347_blitBitmap(lcd_bitmap);
lcd_hx8347_blitBitmap(lcd_bitmap);
- timer_delay(
2
000);
+ timer_delay(
1
000);
}
}
}
}
@@
-232,7
+225,7
@@
static int cgi_status(struct netconn *client, const char *name, char *recv_buf,
sprintf(status.last_connected_ip, "%d.%d.%d.%d", IP_ADDR_TO_INT_TUPLE(client->pcb.ip->remote_ip.addr));
sprintf(status.local_ip, "%d.%d.%d.%d", IP_ADDR_TO_INT_TUPLE(client->pcb.ip->local_ip.addr));
sprintf(status.last_connected_ip, "%d.%d.%d.%d", IP_ADDR_TO_INT_TUPLE(client->pcb.ip->remote_ip.addr));
sprintf(status.local_ip, "%d.%d.%d.%d", IP_ADDR_TO_INT_TUPLE(client->pcb.ip->local_ip.addr));
- sprintf((char *)tx_buf, "{ \"local_ip\":\"%s\",\"last_connected_ip\":\"%s\", \"temp\":%d.%d,\"volt\":%d,\"up_time\":%d,\"tot_req\":%d, \
+ sprintf((char *)tx_buf, "{ \"local_ip\":\"%s\",\"last_connected_ip\":\"%s\", \"temp\":%d.%d,\"volt\":%d,\"up_time\":%
l
d,\"tot_req\":%d, \
\"leds\":{ \"0\":\"%d\", \"1\":\"%d\", \"2\":\"%d\"}}",
status.local_ip, status.last_connected_ip,
status.internal_temp / 10, status.internal_temp % 10,
\"leds\":{ \"0\":\"%d\", \"1\":\"%d\", \"2\":\"%d\"}}",
status.local_ip, status.last_connected_ip,
status.internal_temp / 10, status.internal_temp % 10,
@@
-241,6
+234,9
@@
static int cgi_status(struct netconn *client, const char *name, char *recv_buf,
GET_LED_STATUS(status.led_status, 1),
GET_LED_STATUS(status.led_status, 2));
GET_LED_STATUS(status.led_status, 1),
GET_LED_STATUS(status.led_status, 2));
+
+
+
http_sendOk(client, HTTP_CONTENT_JSON);
netconn_write(client, tx_buf, strlen((char *)tx_buf), NETCONN_COPY);
return 0;
http_sendOk(client, HTTP_CONTENT_JSON);
netconn_write(client, tx_buf, strlen((char *)tx_buf), NETCONN_COPY);
return 0;
@@
-589,7
+585,7
@@
int main(void)
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));
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));
-
kprintf("dhcp ok: ip = %s
", status.local_ip);
+
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);
text_xprintf(lcd_bitmap, 14, 0, 0, "Board ip: %s", status.local_ip);
lcd_hx8347_blitBitmap(lcd_bitmap);