Contiki 3.x
collect-view-z1.c
1 #include "collect-view.h"
2 #include "cc2420.h"
3 #include "dev/leds.h"
4 #include "dev/i2cmaster.h"
5 #include "dev/tmp102.h"
6 
7 #include "collect-view-z1.h"
8 
9 /*---------------------------------------------------------------------------*/
10 static uint16_t
11 get_temp()
12 {
13  /* XXX Fix me: check /examples/z1/test-tmp102.c for correct conversion */
14  return (uint16_t)tmp102_read_temp_raw();
15 }
16 /*---------------------------------------------------------------------------*/
17 void
18 collect_view_arch_read_sensors(struct collect_view_data_msg *msg)
19 {
20  static int initialized = 0;
21 
22  if(!initialized) {
23  tmp102_init();
24  initialized = 1;
25  }
26 
27  msg->sensors[BATTERY_VOLTAGE_SENSOR] = 0;
28  msg->sensors[BATTERY_INDICATOR] = 0;
29  msg->sensors[LIGHT1_SENSOR] = 0;
30  msg->sensors[LIGHT2_SENSOR] = 0;
31  msg->sensors[TEMP_SENSOR] = get_temp();
32  msg->sensors[HUMIDITY_SENSOR] = 0;
33 }
34 /*---------------------------------------------------------------------------*/
Device drivers header file for tmp102 temperature sensor in Zolertia Z1 WSN Platform.
I2C communication device driver header file for Zolertia Z1 sensor node.