42 #include "contiki-conf.h"
46 int energest_total_count;
47 energest_t energest_total_time[ENERGEST_TYPE_MAX];
48 rtimer_clock_t energest_current_time[ENERGEST_TYPE_MAX];
49 #ifdef ENERGEST_CONF_LEVELDEVICE_LEVELS
50 energest_t energest_leveldevice_current_leveltime[ENERGEST_CONF_LEVELDEVICE_LEVELS];
52 unsigned char energest_current_mode[ENERGEST_TYPE_MAX];
59 for(i = 0; i < ENERGEST_TYPE_MAX; ++i) {
60 energest_total_time[i].current = energest_current_time[i] = 0;
61 energest_current_mode[i] = 0;
63 #ifdef ENERGEST_CONF_LEVELDEVICE_LEVELS
64 for(i = 0; i < ENERGEST_CONF_LEVELDEVICE_LEVELS; ++i) {
65 energest_leveldevice_current_leveltime[i].current = 0;
71 energest_type_time(
int type)
74 #ifndef ENERGEST_CONF_LEVELDEVICE_LEVELS
75 if(energest_current_mode[type]) {
77 energest_total_time[type].current += (rtimer_clock_t)
78 (now - energest_current_time[type]);
79 energest_current_time[type] = now;
82 return energest_total_time[type].current;
86 energest_leveldevice_leveltime(
int powerlevel)
88 #ifdef ENERGEST_CONF_LEVELDEVICE_LEVELS
89 return energest_leveldevice_current_leveltime[powerlevel].current;
96 energest_type_set(
int type,
unsigned long val)
98 energest_total_time[type].current = val;
107 for(i = 0; i < ENERGEST_TYPE_MAX; i++) {
108 if(energest_current_mode[i]) {
110 energest_total_time[i].current += (rtimer_clock_t)
111 (now - energest_current_time[i]);
112 energest_current_time[i] = now;
118 void energest_type_set(
int type,
unsigned long val) {}
119 void energest_init(
void) {}
120 unsigned long energest_type_time(
int type) {
return 0; }
121 void energest_flush(
void) {}