[Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/tsb
PhotoDriverC.nc, 1.1, 1.2 PhotoDriverM.nc, 1.1, 1.2 Photo.h,
1.2, 1.3
Joe Polastre
jpolastre at users.sourceforge.net
Thu Aug 4 14:20:40 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/beta/platform/tsb
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18356
Modified Files:
PhotoDriverC.nc PhotoDriverM.nc Photo.h
Log Message:
Updated photo sensor driver for new AD524X component and interface
as well as TSB v2.0
Index: PhotoDriverC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/tsb/PhotoDriverC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PhotoDriverC.nc 22 Feb 2005 01:24:40 -0000 1.1
--- PhotoDriverC.nc 4 Aug 2005 21:20:37 -0000 1.2
***************
*** 1,2 ****
--- 1,3 ----
+ // $Id$
/* tab:4
* "Copyright (c) 2000-2003 The Regents of the University of California.
***************
*** 19,26 ****
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
! */
! /*
*
! * Authors: Joe Polastre
*
* $Id$
--- 20,32 ----
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
! * Copyright (c) 2005 Moteiv Corporation
! * All rights reserved.
*
! * This file is distributed under the terms in the attached MOTEIV-LICENSE
! * file. If you do not find these files, copies can be found at
! * http://www.moteiv.com/MOTEIV-LICENSE.txt and by emailing info at moteiv.com.
! */
! /**
! * @author Joe Polastre <info at moteiv.com>
*
* $Id$
***************
*** 35,55 ****
interface SplitControl;
interface ADC as Photo;
! interface PhotoGain;
}
}
implementation
{
! components PhotoDriverM, ADCC, AD5242C, LedsC;
PhotoDriverM.Leds -> LedsC;
SplitControl = PhotoDriverM;
! PhotoGain = PhotoDriverM;
Photo = ADCC.ADC[TOS_ADC_PHOTO_PORT];
PhotoDriverM.ADCStdControl -> ADCC;
PhotoDriverM.ADCControl -> ADCC;
! PhotoDriverM.AD5242 -> AD5242C;
! PhotoDriverM.AD5242Control -> AD5242C;
}
--- 41,61 ----
interface SplitControl;
interface ADC as Photo;
! interface Potentiometer;
}
}
implementation
{
! components PhotoDriverM, ADCC, AD524XC, LedsC;
PhotoDriverM.Leds -> LedsC;
SplitControl = PhotoDriverM;
! Potentiometer = PhotoDriverM;
Photo = ADCC.ADC[TOS_ADC_PHOTO_PORT];
PhotoDriverM.ADCStdControl -> ADCC;
PhotoDriverM.ADCControl -> ADCC;
! PhotoDriverM.AD524X -> AD524XC;
! PhotoDriverM.AD524XControl -> AD524XC;
}
Index: PhotoDriverM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/tsb/PhotoDriverM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PhotoDriverM.nc 22 Feb 2005 01:24:40 -0000 1.1
--- PhotoDriverM.nc 4 Aug 2005 21:20:38 -0000 1.2
***************
*** 19,26 ****
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*/
/**
! * @author Joe Polastre
* Revision: $Revision$
*
--- 19,33 ----
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
+ *
+ * Copyright (c) 2005 Moteiv Corporation
+ * All rights reserved.
+ *
+ * This file is distributed under the terms in the attached MOTEIV-LICENSE
+ * file. If you do not find these files, copies can be found at
+ * http://www.moteiv.com/MOTEIV-LICENSE.txt and by emailing info at moteiv.com.
*/
/**
! * @author Joe Polastre <info at moteiv.com>
* Revision: $Revision$
*
***************
*** 33,43 ****
provides {
interface SplitControl;
! interface PhotoGain;
}
uses {
! interface AD5242;
interface ADCControl;
interface StdControl as ADCStdControl;
! interface StdControl as AD5242Control;
interface Leds;
}
--- 40,50 ----
provides {
interface SplitControl;
! interface Potentiometer;
}
uses {
! interface AD524X;
interface ADCControl;
interface StdControl as ADCStdControl;
! interface StdControl as AD524XControl;
interface Leds;
}
***************
*** 72,76 ****
}
call ADCStdControl.init();
! call AD5242Control.init();
return post initDone();
}
--- 79,83 ----
}
call ADCStdControl.init();
! call AD524XControl.init();
return post initDone();
}
***************
*** 93,103 ****
}
TOSH_SEL_ADC3_MODFUNC();
! call AD5242Control.start();
! return call AD5242.start(AD5242_PHOTO_ADDR);
}
return FAIL;
}
! event void AD5242.startDone(uint8_t _addr, result_t _result) {
uint8_t _state = OFF;
atomic {
--- 100,110 ----
}
TOSH_SEL_ADC3_MODFUNC();
! call AD524XControl.start();
! return call AD524X.start(PHOTO_ADDR, PHOTO_TYPE);
}
return FAIL;
}
! event void AD524X.startDone(uint8_t _addr, result_t _result, ad524x_type_t type) {
uint8_t _state = OFF;
atomic {
***************
*** 108,112 ****
}
if (_state == START_O) {
! if (!(call AD5242.setOutput1(AD5242_PHOTO_ADDR, TRUE))) {
atomic state = IDLE;
signal SplitControl.startDone();
--- 115,119 ----
}
if (_state == START_O) {
! if (!(call AD524X.setOutput(PHOTO_ON_ADDR, PHOTO_ON_OUTPUT, TRUE, PHOTO_ON_TYPE))) {
atomic state = IDLE;
signal SplitControl.startDone();
***************
*** 128,137 ****
TOSH_SEL_ADC0_IOFUNC();
TOSH_SEL_ADC1_IOFUNC();
! return call AD5242.stop(AD5242_PHOTO_ADDR);
}
return FAIL;
}
! event void AD5242.stopDone(uint8_t _addr, result_t _result) {
uint8_t _state = OFF;
atomic {
--- 135,144 ----
TOSH_SEL_ADC0_IOFUNC();
TOSH_SEL_ADC1_IOFUNC();
! return call AD524X.stop(PHOTO_ADDR, PHOTO_TYPE);
}
return FAIL;
}
! event void AD524X.stopDone(uint8_t addr, result_t result, ad524x_type_t type) {
uint8_t _state = OFF;
atomic {
***************
*** 142,146 ****
}
if (_state == STOP_O) {
! if (!(call AD5242.setOutput1(AD5242_PHOTO_ADDR, FALSE))) {
atomic state = IDLE;
signal SplitControl.stopDone();
--- 149,153 ----
}
if (_state == STOP_O) {
! if (!(call AD524X.setOutput(PHOTO_ON_ADDR, PHOTO_ON_OUTPUT, FALSE, PHOTO_ON_TYPE))) {
atomic state = IDLE;
signal SplitControl.stopDone();
***************
*** 149,153 ****
}
! event void AD5242.setOutput1Done(uint8_t _addr, result_t _result) {
uint8_t _state = OFF;
atomic {
--- 156,160 ----
}
! event void AD524X.setOutputDone(uint8_t _addr, bool _output, result_t _result, ad524x_type_t _type) {
uint8_t _state = OFF;
atomic {
***************
*** 162,171 ****
else if (_state == STOP_O) {
// turn off the potentiometer
! call AD5242Control.stop();
signal SplitControl.stopDone();
}
}
! event void AD5242.setPot1Done(uint8_t _addr, result_t _result) {
uint8_t _state = OFF;
atomic {
--- 169,178 ----
else if (_state == STOP_O) {
// turn off the potentiometer
! call AD524XControl.stop();
signal SplitControl.stopDone();
}
}
! event void AD524X.setPotDone(uint8_t _addr, bool _rdac, result_t _result, ad524x_type_t _type) {
uint8_t _state = OFF;
atomic {
***************
*** 177,192 ****
if (_state == GAIN) {
! signal PhotoGain.setDone(gain, _result);
}
}
! event void AD5242.getPot1Done(uint8_t _addr, uint8_t _val, result_t _result) { }
! event void AD5242.getPot2Done(uint8_t _addr, uint8_t _val, result_t _result) { }
! event void AD5242.setPot2Done(uint8_t _addr, result_t _result) { }
!
! event void AD5242.setOutput2Done(uint8_t _addr, result_t _result) {
! }
! command result_t PhotoGain.set(uint8_t _gain) {
uint8_t _state = OFF;
atomic {
--- 184,194 ----
if (_state == GAIN) {
! signal Potentiometer.setDone(gain, _result);
}
}
! event void AD524X.getPotDone(uint8_t addr, bool rdac, uint8_t value, result_t result, ad524x_type_t type) { }
! command result_t Potentiometer.set(uint8_t _gain) {
uint8_t _state = OFF;
atomic {
***************
*** 198,211 ****
if (_state == GAIN) {
atomic gain = _gain;
! return call AD5242.setPot1(AD5242_PHOTO_ADDR, gain);
}
return FAIL;
}
! command uint8_t PhotoGain.get() {
return gain;
}
! default event void PhotoGain.setDone(uint8_t _gain, uint8_t _result) { }
}
--- 200,213 ----
if (_state == GAIN) {
atomic gain = _gain;
! return call AD524X.setPot(PHOTO_GAIN_ADDR, PHOTO_GAIN_RDAC, gain, PHOTO_GAIN_TYPE);
}
return FAIL;
}
! command uint8_t Potentiometer.get() {
return gain;
}
! default event void Potentiometer.setDone(uint8_t _gain, uint8_t _result) { }
}
Index: Photo.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/tsb/Photo.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Photo.h 22 Feb 2005 01:28:23 -0000 1.2
--- Photo.h 4 Aug 2005 21:20:38 -0000 1.3
***************
*** 1,9 ****
#ifndef _H_PHOTO_H
#define _H_PHOTO_H
#include "MSP430ADC12.h"
enum {
! AD5242_PHOTO_ADDR = 0x02,
};
--- 1,27 ----
+ /*
+ * Copyright (c) 2005 Moteiv Corporation
+ * All rights reserved.
+ *
+ * This file is distributed under the terms in the attached MOTEIV-LICENSE
+ * file. If you do not find these files, copies can be found at
+ * http://www.moteiv.com/MOTEIV-LICENSE.txt and by emailing info at moteiv.com.
+ */
#ifndef _H_PHOTO_H
#define _H_PHOTO_H
#include "MSP430ADC12.h"
+ #include "AD524X.h"
enum {
! PHOTO_ADDR = 0x02, // 0x2E
! PHOTO_TYPE = TYPE_AD5241,
!
! PHOTO_ON_ADDR = 0x03,
! PHOTO_ON_OUTPUT = 0x01,
! PHOTO_ON_TYPE = TYPE_AD5241,
!
! PHOTO_GAIN_ADDR = 0x02,
! PHOTO_GAIN_RDAC = 0,
! PHOTO_GAIN_TYPE = TYPE_AD5247,
};
More information about the Tinyos-beta-commits
mailing list