39 #include "lib/sensors.h"
41 const extern struct sensors_sensor *sensors[];
42 extern unsigned char sensors_flags[];
44 #define FLAG_CHANGED 0x80
46 process_event_t sensors_event;
48 static unsigned char num_sensors;
50 PROCESS(sensors_process,
"Sensors");
54 get_sensor_index(
const struct sensors_sensor *s)
57 for(i = 0; i < num_sensors; ++i) {
65 const struct sensors_sensor *
71 const struct sensors_sensor *
72 sensors_next(
const struct sensors_sensor *s)
74 return sensors[get_sensor_index(s) + 1];
78 sensors_changed(
const struct sensors_sensor *s)
80 sensors_flags[get_sensor_index(s)] |= FLAG_CHANGED;
84 const struct sensors_sensor *
85 sensors_find(
const char *prefix)
94 for(i = 0; i < num_sensors; ++i) {
95 if(strncmp(prefix, sensors[i]->type, len) == 0) {
111 for(i = 0; sensors[i] !=
NULL; ++i) {
112 sensors_flags[i] = 0;
113 sensors[i]->configure(SENSORS_HW_INIT, 0);
123 for(i = 0; i < num_sensors; ++i) {
124 if(sensors_flags[i] & FLAG_CHANGED) {
128 sensors_flags[i] &= ~FLAG_CHANGED;
void process_poll(struct process *p)
Request a process to be polled.
#define PROCESS_BEGIN()
Define the beginning of a process.
#define PROCESS_ERR_OK
Return value indicating that an operation was successful.
#define NULL
The null pointer.
process_event_t process_alloc_event(void)
Allocate a global event number.
int process_post(struct process *p, process_event_t ev, process_data_t data)
Post an asynchronous event.
#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_UNTIL(c)
Wait for an event to be posted to the process, with an extra condition.
#define PROCESS_WAIT_EVENT()
Wait for an event to be posted to the process.
#define PROCESS(name, strname)
Declare a process.