Collect view for z1
This commit is contained in:
parent
8962136b1a
commit
7fc6c8d678
@ -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
|
||||
|
34
apps/collect-view/collect-view-z1.c
Normal file
34
apps/collect-view/collect-view-z1.c
Normal file
@ -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;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
21
apps/collect-view/collect-view-z1.h
Normal file
21
apps/collect-view/collect-view-z1.h
Normal file
@ -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 */
|
Loading…
Reference in New Issue
Block a user