40 #include "lib/sensors.h"
42 extern struct sensors_sensor *sensors[];
43 extern unsigned char sensors_flags[];
45 #define FLAG_CHANGED 0x80
47 process_event_t sensors_event;
49 static unsigned char num_sensors;
51 PROCESS(sensors_process,
"Sensors");
55 get_sensor_index(
const struct sensors_sensor *s)
58 for(i = 0; i < num_sensors; ++i) {
66 struct sensors_sensor *
72 struct sensors_sensor *
73 sensors_next(
const struct sensors_sensor *s)
75 return sensors[get_sensor_index(s) + 1];
79 sensors_changed(
const struct sensors_sensor *s)
81 sensors_flags[get_sensor_index(s)] |= FLAG_CHANGED;
85 struct sensors_sensor *
86 sensors_find(
const char *prefix)
95 for(i = 0; i < num_sensors; ++i) {
96 if(strncmp(prefix, sensors[i]->type, len) == 0) {
112 for(i = 0; sensors[i] !=
NULL; ++i) {
113 sensors_flags[i] = 0;
114 sensors[i]->configure(SENSORS_HW_INIT, 0);
124 for(i = 0; i < num_sensors; ++i) {
125 if(sensors_flags[i] & FLAG_CHANGED) {
129 sensors_flags[i] &= ~FLAG_CHANGED;