Contiki 3.x
kl25z-nothing.c
Go to the documentation of this file.
1 /**
2  * \file
3  * Dummy contiki application that does nothing. Literally.
4  * Might be useful for relay only nodes.
5  */
6 #include <stdbool.h>
7 #include "contiki.h"
8 #include <stdio.h>
9 #include "dev/leds.h"
10 
11 #define SEND_INTERVAL 10 * CLOCK_SECOND
12 
13 PROCESS(do_nothing_process, "Process that does nothing");
14 
15 AUTOSTART_PROCESSES(&do_nothing_process);
16 
17 PROCESS_THREAD(do_nothing_process, ev, data) {
18  static struct etimer et;
19  static uint8_t blipcounter;
20 
21  PROCESS_BEGIN();
22 
23  blipcounter = 0;
24  etimer_set(&et, SEND_INTERVAL);
25 
26  while (true) {
27  PROCESS_YIELD();
28 
29  if(etimer_expired(&et)) {
30  //leds_off(LEDS_BLUE);
31  //leds_off(LEDS_GREEN);
32  //leds_off(LEDS_RED);
33 
34  if(blipcounter % 2)
35  {
36  //leds_on(LEDS_RED);
37  } else {
38  //leds_on(LEDS_GREEN);
39  }
40 
41  if(!(blipcounter % 3))
42  {
43  //leds_on(LEDS_BLUE);
44  }
45 
46  printf("Blip: %d. Clock: %lu. Sec: %lu\n\r", blipcounter++, clock_time(), clock_seconds());
47 
49  }
50 
51  }
52 
53  PROCESS_END();
54 }
void etimer_restart(struct etimer *et)
Restart an event timer from the current point in time.
Definition: etimer.c:199
CCIF clock_time_t clock_time(void)
Get the current clock time.
Definition: clock.c:41
void etimer_set(struct etimer *et, clock_time_t interval)
Set an event timer.
Definition: etimer.c:177
#define PROCESS_END()
Define the end of a process.
Definition: process.h:131
#define PROCESS(name, strname)
Declare a process.
Definition: process.h:307
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
Definition: process.h:273
static struct etimer et
NIC receiver thread.
Definition: lanc111.c:1133
A timer.
Definition: etimer.h:76
#define PROCESS_YIELD()
Yield the currently running process.
Definition: process.h:164
int etimer_expired(struct etimer *et)
Check if an event timer has expired.
Definition: etimer.c:213
CCIF unsigned long clock_seconds(void)
Get the current value of the platform seconds.
Definition: clock.c:54
#define PROCESS_BEGIN()
Define the beginning of a process.
Definition: process.h:120