minor cleanup

This commit is contained in:
joxe 2010-02-02 21:17:44 +00:00
parent e198b4508b
commit 09c3ba2753
2 changed files with 11 additions and 20 deletions

View file

@ -26,14 +26,14 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: battery-sensor.c,v 1.8 2010/02/02 20:59:45 joxe Exp $
* $Id: battery-sensor.c,v 1.9 2010/02/02 21:17:44 joxe Exp $
*
* -----------------------------------------------------------------
*
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
* Created : 2005-11-01
* Updated : $Date: 2010/02/02 20:59:45 $
* $Revision: 1.8 $
* Updated : $Date: 2010/02/02 21:17:44 $
* $Revision: 1.9 $
*/
#include "dev/battery-sensor.h"

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: light-sensor.c,v 1.4 2010/02/02 20:59:45 joxe Exp $
* @(#)$Id: light-sensor.c,v 1.5 2010/02/02 21:17:44 joxe Exp $
*/
#include <stdlib.h>
@ -42,23 +42,10 @@
const struct sensors_sensor light_sensor;
/*
* Initialize periodic readings from the 2 photo diodes. The most
* recent readings will be stored in ADC internal registers/memory.
*/
static void
light_sensor_init(void)
{
ADC12MCTL0 = (INCH_4 + SREF_0); // photodiode 1 (P64)
ADC12MCTL1 = (INCH_5 + SREF_0); // photodiode 2 (P65)
sky_sensors_activate(0x30);
}
/*---------------------------------------------------------------------------*/
static int
value(int type)
{
switch(type) {
/* Photosynthetically Active Radiation. */
case LIGHT_SENSOR_PHOTOSYNTHETIC:
@ -90,7 +77,11 @@ configure(int type, int c)
case SENSORS_ACTIVE:
if(c) {
if(!status(SENSORS_ACTIVE)) {
light_sensor_init();
ADC12MCTL0 = (INCH_4 + SREF_0); // photodiode 1 (P64)
ADC12MCTL1 = (INCH_5 + SREF_0); // photodiode 2 (P65)
sky_sensors_activate(0x30);
}
} else {
sky_sensors_deactivate(0x30);