35 #include "duty-cycle-scroller.h"
39 PROCESS(duty_cycle_scroller_process,
"Duty cycle scroller");
41 static clock_time_t interval;
46 static struct etimer interval_timer;
48 static uint32_t last_cpu, last_lpm, last_transmit, last_listen;
49 uint32_t cpu, lpm, transmit, listen;
50 uint32_t all_cpu, all_lpm, all_transmit, all_listen;
59 all_cpu = energest_type_time(ENERGEST_TYPE_CPU);
60 all_lpm = energest_type_time(ENERGEST_TYPE_LPM);
61 all_transmit = energest_type_time(ENERGEST_TYPE_TRANSMIT);
62 all_listen = energest_type_time(ENERGEST_TYPE_LISTEN);
64 cpu = all_cpu - last_cpu;
65 lpm = all_lpm - last_lpm;
66 transmit = all_transmit - last_transmit;
67 listen = all_listen - last_listen;
71 last_transmit = all_transmit;
72 last_listen = all_listen;
74 radio = transmit + listen;
77 height = 1 + (5 + ((1000 * radio) / time)) / 10;
78 if(height >= LCD_MAX_SCROLL_AREA) {
79 height = LCD_MAX_SCROLL_AREA;
81 lcd_draw_vertical_line(height);
88 duty_cycle_scroller_start(clock_time_t i)
95 duty_cycle_scroller_stop(
void)
int etimer_expired(struct etimer *et)
Check if an event timer has expired.
#define PROCESS_WAIT_UNTIL(c)
Wait for a condition to occur.
#define PROCESS_BEGIN()
Define the beginning of a process.
#define NULL
The null pointer.
Header file for the energy estimation mechanism
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_END()
Define the end of a process.
#define PROCESS(name, strname)
Declare a process.
void process_start(struct process *p, process_data_t data)
Start a process.
void etimer_set(struct etimer *et, clock_time_t interval)
Set an event timer.
void process_exit(struct process *p)
Cause a process to exit.