38 PROCESS(fader_process,
"LED fader");
39 AUTOSTART_PROCESSES(&fader_process);
45 struct pt fade_pt, fade_in_pt, fade_out_pt;
51 static unsigned char onoroff;
59 for(f->delay = 3980; f->delay > 20; f->delay -= 20) {
75 for(f->delay = 20; f->delay < 3980; f->delay += 20) {
93 PT_SPAWN(&f->fade_pt, &f->fade_in_pt, fade_in(f));
94 PT_SPAWN(&f->fade_pt, &f->fade_out_pt, fade_out(f));
104 init_fader(
struct fader *f,
int led)
114 static struct fader red, green, yellow;
146 if(ev == PROCESS_EVENT_TIMER) {
int etimer_expired(struct etimer *et)
Check if an event timer has expired.
void process_poll(struct process *p)
Request a process to be polled.
#define LEDS_RED
LED1 (Red) -> PC0.
#define PROCESS_BEGIN()
Define the beginning of a process.
#define PT_YIELD(pt)
Yield from the current protothread.
void timer_set(struct timer *t, clock_time_t interval)
Set a timer.
#define PT_SCHEDULE(f)
Schedule a protothread.
#define PT_INIT(pt)
Initialize a protothread.
#define PT_SPAWN(pt, child, thread)
Spawn a child protothread and wait until it exits.
#define PT_THREAD(name_args)
Declaration of a protothread.
#define LEDS_YELLOW
LED2 (Yellow) -> PC1.
#define LEDS_GREEN
LED3 (Green) -> PC2.
#define PT_WAIT_UNTIL(pt, condition)
Block and wait until condition is true.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_END()
Define the end of a process.
#define PROCESS_WAIT_EVENT()
Wait for an event to be posted to the process.
#define PT_BEGIN(pt)
Declare the start of a protothread inside the C function implementing the protothread.
#define PROCESS(name, strname)
Declare a process.
#define PT_END(pt)
Declare the end of a protothread.
void clock_delay(unsigned int delay)
Obsolete delay function but we implement it here since some code still uses it.
void etimer_set(struct etimer *et, clock_time_t interval)
Set an event timer.
int timer_expired(struct timer *t)
Check if a timer has expired.
#define CLOCK_SECOND
A second, measured in system clock time.