57 #include "contiki-lib.h"
58 #include "contiki-net.h"
62 #include "raven-lcd.h"
71 uip_ipaddr_t ping_addr;
72 uip_ipaddr_t udp_addr;
74 char udp_data[data_len];
77 uint8_t frame[cmd_len];
84 #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
85 #define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[uip_l2_l3_hdr_len])
87 void rs232_send(uint8_t port,
unsigned char c);
96 uip_ip6addr(&ping_addr,0x2001,0x420,0x5FFF,0x7D,0x2D0,0xB7FF,0xFE23,0xE6DB);
128 send_frame(uint8_t cmd, uint8_t len, uint8_t *payload)
142 raven_gui_loop(process_event_t ev, process_data_t data)
144 if(ev == tcpip_icmp6_event) {
145 switch(*((uint8_t *)data)){
148 send_frame(REPORT_PING_BEEP, 0, 0);
152 send_frame(REPORT_PING, 1, &seqno);
164 seqno = cmd.frame[0];
169 sprintf(udp_data,
"T%s\r\n", (
char *)cmd.frame);
170 uip_udp_packet_send(udp_conn, udp_data, data_len);
190 int raven_lcd_serial_input(
unsigned char ch)
211 if (cmd.ndx >= cmd.len+3){
222 cmd.frame[cmd.ndx - 3] = ch;
233 PROCESS(raven_lcd_process,
"Raven LCD interface process");
244 uip_ip6addr(&udp_addr,0x2001,0x420,0x5FFF,0x7D,0x2D0,0xB7FF,0xFE23,0xE6DB);
251 if((error = icmp6_new(
NULL)) == 0) {
254 raven_gui_loop(ev, data);
uip_len
The length of the packet in the uip_buf buffer.
void tcpip_ipv6_output(void)
This function does address resolution and then calls tcpip_output.
#define PROCESS_BEGIN()
Define the beginning of a process.
CCIF struct uip_udp_conn * udp_new(const uip_ipaddr_t *ripaddr, uint16_t port, void *appstate)
Create a new UDP connection.
#define ICMP6_ECHO_REPLY
Echo reply.
#define NULL
The null pointer.
#define SOF_CHAR
Start-of-frame character.
#define UIP_HTONS(n)
Convert 16-bit quantity from host byte order to network byte order.
int process_post(struct process *p, process_event_t ev, process_data_t data)
Post an asynchronous event.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define UIP_IP_BUF
Pointer to IP header.
#define PROCESS_END()
Define the end of a process.
uint16_t uip_icmp6chksum(void)
Calculate the ICMP checksum of the packet in uip_buf.
#define uip_ipaddr_copy(dest, src)
Copy an IP address from one place to another.
#define ICMP6_ECHO_REQUEST
Echo request.
#define PROCESS(name, strname)
Declare a process.
void uip_ds6_select_src(uip_ipaddr_t *src, uip_ipaddr_t *dst)
Source address selection, see RFC 3484.
#define UIP_ICMP_BUF
Pointer to ICMP header.
#define PROCESS_YIELD()
Yield the currently running process.
#define EOF_CHAR
End-of-frame character.
#define udp_bind(conn, port)
Bind a UDP connection to a local port.
Representation of a uIP UDP connection.
#define uip_ip6addr(addr, addr0, addr1, addr2, addr3, addr4, addr5, addr6, addr7)
Construct an IPv6 address from eight 16-bit words.
void rs232_send(uint8_t port, unsigned char c)
Print a character on RS232.
#define UIP_ICMP6_ECHO_REQUEST_LEN
Echo Request constant part length.