37#include "lib/sensors.h"
39extern const struct sensors_sensor *sensors[];
40extern unsigned char sensors_flags[];
42#define FLAG_CHANGED 0x80
44process_event_t sensors_event;
46static unsigned char num_sensors;
48PROCESS(sensors_process,
"Sensors");
52get_sensor_index(
const struct sensors_sensor *s)
55 for(i = 0; i < num_sensors; ++i) {
63const struct sensors_sensor *
69const struct sensors_sensor *
70sensors_next(
const struct sensors_sensor *s)
72 return sensors[get_sensor_index(s) + 1];
76sensors_changed(
const struct sensors_sensor *s)
78 sensors_flags[get_sensor_index(s)] |= FLAG_CHANGED;
82const struct sensors_sensor *
83sensors_find(
const char *prefix)
92 for(i = 0; i < num_sensors; ++i) {
93 if(strncmp(prefix, sensors[i]->type, len) == 0) {
109 for(i = 0; sensors[i] != NULL; ++i) {
110 sensors_flags[i] = 0;
111 sensors[i]->configure(SENSORS_HW_INIT, 0);
121 for(i = 0; i < num_sensors; ++i) {
122 if(sensors_flags[i] & FLAG_CHANGED) {
126 sensors_flags[i] &= ~FLAG_CHANGED;
#define PROCESS(name, strname)
Declare a process.
#define PROCESS_WAIT_EVENT()
Wait for an event to be posted to the process.
int process_post(struct process *p, process_event_t ev, process_data_t data)
Post an asynchronous event.
process_event_t process_alloc_event(void)
Allocate a global event number.
#define PROCESS_BEGIN()
Define the beginning 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_END()
Define the end of a process.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_ERR_OK
Return value indicating that an operation was successful.
void process_poll(struct process *p)
Request a process to be polled.