46 #include "dev/button-sensor.h"
48 #if NETSTACK_CONF_WITH_IPV6
54 #include "contiki-uart.h"
56 #include "slip-arch.h"
65 #define SERIAL_ID { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }
68 static uint8_t serial_id[] = SERIAL_ID;
69 #if !NETSTACK_CONF_WITH_IPV6
70 static uint16_t node_id = 0x0102;
80 memset(&addr, 0,
sizeof(linkaddr_t));
81 #if NETSTACK_CONF_WITH_IPV6
82 memcpy(addr.u8, serial_id,
sizeof(addr.u8));
85 for(i = 0; i <
sizeof(linkaddr_t); ++i) {
86 addr.u8[i] = serial_id[7 - i];
89 addr.u8[0] = node_id & 0xff;
90 addr.u8[1] = node_id >> 8;
94 printf(
"Rime started with address ");
95 for(i = 0; i <
sizeof(addr.u8) - 1; i++) {
96 printf(
"%d.", addr.u8[i]);
98 printf(
"%d" NEWLINE, addr.u8[i]);
101 int contiki_argc = 0;
108 register unsigned long int i;
109 for(i = 0x000FFFFFUL; i; --i) {
114 main(
int argc,
char **argv)
116 bool flip_flop =
false;
153 #define BIT(n) (1 << (n))
163 #if NETSTACK_CONF_WITH_IPV6
164 #if UIP_CONF_IPV6_RPL
165 printf(CONTIKI_VERSION_STRING
" started with IPV6, RPL" NEWLINE);
167 printf(CONTIKI_VERSION_STRING
" started with IPV6" NEWLINE);
170 printf(CONTIKI_VERSION_STRING
" started" NEWLINE);
186 printf(
"MAC %s RDC %s NETWORK %s" NEWLINE, NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name);
188 #if NETSTACK_CONF_WITH_IPV6
192 printf(
"Tentative link-local IPv6 address ");
196 lladdr = uip_ds6_get_link_local(-1);
197 for(i = 0; i < 7; ++i) {
198 printf(
"%02x%02x:", lladdr->ipaddr.u8[i * 2],
199 lladdr->ipaddr.u8[i * 2 + 1]);
202 lladdr->state = ADDR_AUTOCONF;
204 printf(
"%02x%02x" NEWLINE, lladdr->ipaddr.u8[14], lladdr->ipaddr.u8[15]);
206 #elif NETSTACK_CONF_WITH_IPV4
212 autostart_start(autostart_processes);
217 if(NETSTACK_RADIO.pending_packet()) {
223 NETSTACK_RDC.input();
227 while(uart0_can_getchar()) {
231 if(uart0_input_handler) {
232 uart0_input_handler(c);
241 HEARTBEAT_LED1 = flip_flop;
242 flip_flop = !flip_flop;
243 HEARTBEAT_LED2 = flip_flop;
250 log_message(
char *m1,
char *m2)
252 printf(
"%s%s" NEWLINE, m1, m2);
258 printf(
"%s" NEWLINE, m);
void uip_log(char *m)
Print out a uIP log message.
void * packetbuf_dataptr(void)
Get a pointer to the data in the packetbuf.
void uart0_init(unsigned long ubr)
Initalize the RS232 port.
static uip_ds6_addr_t * addr
Pointer to a router list entry.
Header file for IPv6-related data structures.
#define BIT(x)
Useful to reference a single bit of a byte.
void etimer_request_poll(void)
Make the event timer aware that the clock has changed.
void packetbuf_clear(void)
Clear and reset the packetbuf.
#define PACKETBUF_SIZE
The size of the packetbuf, in bytes.
void clock_init(void)
Initialize the clock library.
int process_run(void)
Run the system once - call poll handlers and process one event.
Unicast address structure.
SENSORS & button_sensor
Copyright (c) 2014, Analog Devices, Inc.
Header file for the Rime stack
#define NULL
The null pointer.
void linkaddr_set_node_addr(linkaddr_t *t)
Set the address of the current node.
void watchdog_periodic(void)
Writes the WDT clear sequence.
Header file for the uIP TCP/IP stack.
void packetbuf_set_datalen(uint16_t len)
Set the length of the data in the packetbuf.
void process_start(struct process *p, process_data_t data)
Start a process.
int main(void)
This is main...
Generic serial I/O process header filer.
CCIF uip_lladdr_t uip_lladdr
Host L2 address.
void process_init(void)
Initialize the process module.
void ctimer_init(void)
Initialize the callback timer library.
Include file for the Contiki low-layer network stack (NETSTACK)