From 7fc6c8d6785514cb4d1d8c5483beab9810bd905f Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Fri, 29 Jul 2011 14:49:35 +0200 Subject: [PATCH] Collect view for z1 --- apps/collect-view/Makefile.collect-view | 4 +++ apps/collect-view/collect-view-z1.c | 34 +++++++++++++++++++++++++ apps/collect-view/collect-view-z1.h | 21 +++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 apps/collect-view/collect-view-z1.c create mode 100644 apps/collect-view/collect-view-z1.h diff --git a/apps/collect-view/Makefile.collect-view b/apps/collect-view/Makefile.collect-view index 8155e4699..4ec48f7c7 100644 --- a/apps/collect-view/Makefile.collect-view +++ b/apps/collect-view/Makefile.collect-view @@ -3,5 +3,9 @@ collect-view_src = collect-view.c ifeq ($(TARGET), sky) collect-view_src += collect-view-sky.c else +ifeq ($(TARGET), z1) +collect-view_src += collect-view-z1.c +else collect-view_src += collect-view-template.c endif +endif diff --git a/apps/collect-view/collect-view-z1.c b/apps/collect-view/collect-view-z1.c new file mode 100644 index 000000000..03f972f80 --- /dev/null +++ b/apps/collect-view/collect-view-z1.c @@ -0,0 +1,34 @@ +#include "collect-view.h" +#include "dev/cc2420.h" +#include "dev/leds.h" +#include "dev/i2cmaster.h" +#include "dev/tmp102.h" + +#include "collect-view-z1.h" + +/*---------------------------------------------------------------------------*/ +static uint16_t +get_temp() +{ + /* XXX Fix me: check /examples/z1/test-tmp102.c for correct conversion */ + return (uint16_t)tmp102_read_temp_raw(); +} +/*---------------------------------------------------------------------------*/ +void +collect_view_arch_read_sensors(struct collect_view_data_msg *msg) +{ + static int initialized = 0; + + if(!initialized) { + tmp102_init(); + initialized = 1; + } + + msg->sensors[BATTERY_VOLTAGE_SENSOR] = 0; + msg->sensors[BATTERY_INDICATOR] = 0; + msg->sensors[LIGHT1_SENSOR] = 0; + msg->sensors[LIGHT2_SENSOR] = 0; + msg->sensors[TEMP_SENSOR] = get_temp(); + msg->sensors[HUMIDITY_SENSOR] = 0; +} +/*---------------------------------------------------------------------------*/ diff --git a/apps/collect-view/collect-view-z1.h b/apps/collect-view/collect-view-z1.h new file mode 100644 index 000000000..b5c9b4402 --- /dev/null +++ b/apps/collect-view/collect-view-z1.h @@ -0,0 +1,21 @@ +#ifndef COLLECT_VIEW_Z1_H +#define COLLECT_VIEW_Z1_H + +#include "collect-view.h" + +enum { + BATTERY_VOLTAGE_SENSOR, + BATTERY_INDICATOR, + LIGHT1_SENSOR, + LIGHT2_SENSOR, + TEMP_SENSOR, + HUMIDITY_SENSOR, + RSSI_SENSOR, + ETX1_SENSOR, + ETX2_SENSOR, + ETX3_SENSOR, + ETX4_SENSOR, +}; + + +#endif /* COLLECT_VIEW_Z1_H */