43 #include "contiki-msb430.h"
47 #include "dev/sht11.h"
48 #include "dev/watchdog.h"
50 extern volatile bool uart_edge;
52 extern void init_net(
void);
59 P1SEL = 0x00; P1OUT = 0x00; P1DIR = 0x00;
60 P2SEL = 0x00; P2OUT = 0x18; P2DIR = 0x1A;
61 P3SEL = 0x00; P3OUT = 0x09; P3DIR = 0x21;
62 P4SEL = 0x00; P4OUT = 0x00; P4DIR = 0x00;
63 P5SEL = 0x0E; P5OUT = 0xF9; P5DIR = 0xFD;
64 P6SEL = 0x07; P6OUT = 0x00; P6DIR = 0xC8;
105 printf(
"Failed to initialize the SD driver: %s\n", sd_error_string(r));
107 sd_offset_t capacity;
108 printf(
"The SD driver was successfully initialized\n");
109 capacity = sd_get_capacity();
111 printf(
"Failed to get the SD card capacity: %s\n", sd_error_string(r));
113 printf(
"SD card capacity: %u MB\n",
114 (
unsigned)(capacity / (1024UL * 1024)));
126 NETSTACK_RADIO.init();
129 NETSTACK_NETWORK.init();
133 rimeaddr.u8[0] = node_id & 0xff;
134 rimeaddr.u8[1] = node_id >> 8;
146 printf(
"Node %d.%d: %s %s, channel check rate %u Hz\n",
148 NETSTACK_MAC.name, NETSTACK_RDC.name,
149 CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ?
150 1 : (unsigned)NETSTACK_RDC.channel_check_interval()));
152 autostart_start(autostart_processes);
157 ENERGEST_ON(ENERGEST_TYPE_CPU);
162 profile_episode_start();
171 profile_episode_end();
181 static unsigned long irq_energest = 0;
183 ENERGEST_OFF(ENERGEST_TYPE_CPU);
184 ENERGEST_ON(ENERGEST_TYPE_LPM);
190 energest_type_set(ENERGEST_TYPE_IRQ, irq_energest);
193 _BIC_SR(LPM1_bits + GIE);
195 _BIS_SR(LPM1_bits + GIE);
203 irq_energest = energest_type_time(ENERGEST_TYPE_IRQ);
205 ENERGEST_OFF(ENERGEST_TYPE_LPM);
206 ENERGEST_ON(ENERGEST_TYPE_CPU);
208 profile_clear_timestamps();