Two types of radio sensor data

This commit is contained in:
adamdunkels 2006-10-09 11:55:42 +00:00
parent abfe686c6d
commit d9109e9e83
2 changed files with 14 additions and 3 deletions

View file

@ -28,13 +28,15 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: radio-sensor.c,v 1.1 2006/06/18 07:49:33 adamdunkels Exp $ * @(#)$Id: radio-sensor.c,v 1.2 2006/10/09 11:55:42 adamdunkels Exp $
*/ */
#include "contiki-esb.h" #include "contiki-esb.h"
#include "dev/irq.h" #include "dev/irq.h"
#include <io.h> #include <io.h>
#include "dev/tr1001.h"
const struct sensors_sensor radio_sensor; const struct sensors_sensor radio_sensor;
unsigned int radio_sensor_signal; unsigned int radio_sensor_signal;
@ -78,8 +80,14 @@ active(void)
static unsigned int static unsigned int
value(int type) value(int type)
{ {
switch(type) {
case RADIO_SENSOR_LAST_PACKET:
return tr1001_sstrength();
case RADIO_SENSOR_LAST_VALUE:
default:
return radio_sensor_signal; return radio_sensor_signal;
} }
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static int static int
configure(int type, void *c) configure(int type, void *c)

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: radio-sensor.h,v 1.1 2006/06/18 07:49:33 adamdunkels Exp $ * @(#)$Id: radio-sensor.h,v 1.2 2006/10/09 11:55:42 adamdunkels Exp $
*/ */
#ifndef __RADIO_SENSOR_H__ #ifndef __RADIO_SENSOR_H__
#define __RADIO_SENSOR_H__ #define __RADIO_SENSOR_H__
@ -37,6 +37,9 @@
extern const struct sensors_sensor radio_sensor; extern const struct sensors_sensor radio_sensor;
#define RADIO_SENSOR_LAST_VALUE 0
#define RADIO_SENSOR_LAST_PACKET 1
#define RADIO_SENSOR "Radio" #define RADIO_SENSOR "Radio"
extern unsigned int radio_sensor_signal; extern unsigned int radio_sensor_signal;