Contiki 2.5
pressure-sensor.c
1 /* Pressure sensor interface
2  * Author : Georg von Zengen
3  * Created : 2011/10/17
4  */
5 #include "contiki.h"
6 #include "lib/sensors.h"
8 #include "dev/pressure-sensor.h"
9 const struct sensors_sensor pressure_sensor;
10 uint8_t press_state=0;
11 /*---------------------------------------------------------------------------*/
12 static int
13 value(int type)
14 {
15  switch(type) {
16  case PRESS:
17  return (uint16_t) bmp085_read_comp_pressure(0);
18  case TEMP:
19  //return (uint16_t) bmp085_read_temperature();
20  return (int16_t) bmp085_read_comp_temperature();
21  }
22  return 0;
23 }
24 /*---------------------------------------------------------------------------*/
25 static int
26 status(int type)
27 {
28  return press_state;
29 }
30 /*---------------------------------------------------------------------------*/
31 static int
32 configure(int type, int c)
33 {
34  press_state=1;
35  return bmp085_init();
36 }
37 /*---------------------------------------------------------------------------*/
38 SENSORS_SENSOR(pressure_sensor, "PRESSURE", value, configure, status);