[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/atm128/adc Atm128AdcP.nc, 1.5, 1.6 HplAtm128Adc.nc, 1.4, 1.5 Atm128Adc.h, 1.4, 1.5 HplAtm128AdcC.nc, 1.5, 1.6 Atm128AdcSingle.nc, 1.4, 1.5 HplAtm128AdcP.nc, 1.6, 1.7 Atm128AdcMultiple.nc, 1.4, 1.5

Razvan Musaloiu-E. razvanm at users.sourceforge.net
Tue Jun 10 17:42:15 PDT 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/adc
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv9551/chips/atm128/adc

Modified Files:
	Atm128AdcP.nc HplAtm128Adc.nc Atm128Adc.h HplAtm128AdcC.nc 
	Atm128AdcSingle.nc HplAtm128AdcP.nc Atm128AdcMultiple.nc 
Log Message:
Convert to Unix-style line terminators.


Index: Atm128AdcP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/adc/Atm128AdcP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Atm128AdcP.nc	12 Dec 2006 18:23:03 -0000	1.5
--- Atm128AdcP.nc	11 Jun 2008 00:42:13 -0000	1.6
***************
*** 1,246 ****
! /* $Id$
!  * "Copyright (c) 2000-2003 The Regents of the University  of California.  
!  * All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
!  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
!  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
!  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  * 
!  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
!  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
!  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
!  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
!  *
!  * Copyright (c) 2002-2005 Intel Corporation
!  * All rights reserved.
!  *
!  * This file is distributed under the terms in the attached INTEL-LICENSE     
!  * file. If you do not find these files, copies can be found by writing to
!  * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
!  * 94704.  Attention:  Intel License Inquiry.
!  *
!  * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO 
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 
!  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
!  * DAMAGE. 
!  *
!  * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
!  * MODIFICATIONS.
!  */
! 
! #include "Atm128Adc.h"
! 
! /**
!  * Internal component of the Atmega128 A/D HAL.
!  *
!  * @author Jason Hill
!  * @author David Gay
!  * @author Philip Levis
!  * @author Phil Buonadonna
!  * @author Hu Siquan <husq at xbow.com>
!  */
! 
! module Atm128AdcP 
! {
!   provides {
!     interface Init;
!     interface AsyncStdControl;
!     interface Atm128AdcSingle;
!     interface Atm128AdcMultiple;
!   }
!   uses {
!     interface HplAtm128Adc;
!     interface Atm128Calibrate;
!   }
! }
! implementation
! {  
!   /* State for the current and next (multiple-sampling only) conversion */
!   struct {
!     bool multiple : 1;		/* single and multiple-sampling mode */
!     bool precise : 1;		/* is this result going to be precise? */
!     uint8_t channel : 5;	/* what channel did this sample come from? */
!   } f, nextF;
!   
!   command error_t Init.init() {
!     atomic
!       {
! 	Atm128Adcsra_t adcsr;
! 
! 	adcsr.aden = ATM128_ADC_ENABLE_OFF;
! 	adcsr.adsc = ATM128_ADC_START_CONVERSION_OFF;  
! 	adcsr.adfr = ATM128_ADC_FREE_RUNNING_OFF; 
! 	adcsr.adif = ATM128_ADC_INT_FLAG_OFF;               
! 	adcsr.adie = ATM128_ADC_INT_ENABLE_OFF;       
! 	adcsr.adps = ATM128_ADC_PRESCALE_2;
! 	call HplAtm128Adc.setAdcsra(adcsr);
!       }
!     return SUCCESS;
!   }
! 
!   /* We enable the A/D when start is called, and disable it when stop is
!      called. This drops A/D conversion latency by a factor of two (but
!      increases idle mode power consumption a little). 
!   */
!   async command error_t AsyncStdControl.start() {
!     atomic call HplAtm128Adc.enableAdc();
!     return SUCCESS;
!   }
! 
!   async command error_t AsyncStdControl.stop() {
!     atomic call HplAtm128Adc.disableAdc();
! 
!     return SUCCESS;
!   }
! 
!   /* Return TRUE if switching to 'channel' with reference voltage 'refVoltage'
!      will give a precise result (the first sample after changing reference
!      voltage or switching to/between a differential channel is imprecise)
!   */
!   inline bool isPrecise(Atm128Admux_t admux, uint8_t channel, uint8_t refVoltage) {
!     return refVoltage == admux.refs &&
!       (channel <= ATM128_ADC_SNGL_ADC7 || channel >= ATM128_ADC_SNGL_1_23 || channel == admux.mux);
!   }
! 
!   async event void HplAtm128Adc.dataReady(uint16_t data) {
!     bool precise, multiple;
!     uint8_t channel;
! 
!     atomic 
!       {
! 	channel = f.channel;
! 	precise = f.precise;
! 	multiple = f.multiple;
!       }
! 
!     if (!multiple)
!       {
! 	/* A single sample. Disable the ADC interrupt to avoid starting
! 	   a new sample at the next "sleep" instruction. */
! 	call HplAtm128Adc.disableInterruption();
! 	signal Atm128AdcSingle.dataReady(data, precise);
!       }
!     else
!       {
! 	/* Multiple sampling. The user can:
! 	   - tell us to stop sampling
! 	   - or, to continue sampling on a new channel, possibly with a
! 	     new reference voltage; however this change applies not to
! 	     the next sample (the hardware has already started working on
! 	     that), but on the one after.
! 	*/
! 	bool cont;
! 	uint8_t nextChannel, nextVoltage;
! 	Atm128Admux_t admux;
! 
! 	atomic 
! 	  {
! 	    admux = call HplAtm128Adc.getAdmux();
! 	    nextVoltage = admux.refs;
! 	    nextChannel = admux.mux;
! 	  }
! 
! 	cont = signal Atm128AdcMultiple.dataReady(data, precise, channel,
! 						  &nextChannel, &nextVoltage);
! 	atomic
! 	  if (cont)
! 	    {
! 	      /* Switch channels and update our internal channel+precision
! 		 tracking state (f and nextF). Note that this tracking will
! 		 be incorrect if we take too long to get to this point. */
! 	      admux.refs = nextVoltage;
! 	      admux.mux = nextChannel;
! 	      call HplAtm128Adc.setAdmux(admux);
! 
! 	      f = nextF;
! 	      nextF.channel = nextChannel;
! 	      nextF.precise = isPrecise(admux, nextChannel, nextVoltage);
! 	    }
! 	  else
! 	    call HplAtm128Adc.cancel();
!       }
!   }
! 
!   /* Start sampling based on request parameters */
!   void getData(uint8_t channel, uint8_t refVoltage, bool leftJustify, uint8_t prescaler) {
!     Atm128Admux_t admux;
!     Atm128Adcsra_t adcsr;
! 
!     admux = call HplAtm128Adc.getAdmux();
!     f.precise = isPrecise(admux, channel, refVoltage);
!     f.channel = channel;
! 
!     admux.refs = refVoltage;
!     admux.adlar = leftJustify;
!     admux.mux = channel;
!     call HplAtm128Adc.setAdmux(admux);
! 
!     adcsr.aden = ATM128_ADC_ENABLE_ON;
!     adcsr.adsc = ATM128_ADC_START_CONVERSION_ON;
!     adcsr.adfr = f.multiple;
!     adcsr.adif = ATM128_ADC_INT_FLAG_ON; // clear any stale flag
!     adcsr.adie = ATM128_ADC_INT_ENABLE_ON;
!     if (prescaler == ATM128_ADC_PRESCALE)
!       prescaler = call Atm128Calibrate.adcPrescaler();
!     adcsr.adps = prescaler;
!     call HplAtm128Adc.setAdcsra(adcsr);
!   }
! 
!   async command bool Atm128AdcSingle.getData(uint8_t channel, uint8_t refVoltage,
! 					     bool leftJustify, uint8_t prescaler) {
!     atomic
!       {
! 	f.multiple = FALSE;
! 	getData(channel, refVoltage, leftJustify, prescaler);
! 
! 	return f.precise;
!       }
!   }
! 
!   async command bool Atm128AdcSingle.cancel() {
!     /* There is no Atm128AdcMultiple.cancel, for reasons discussed in that
!        interface */
!     return call HplAtm128Adc.cancel();
!   }
! 
!   async command bool Atm128AdcMultiple.getData(uint8_t channel, uint8_t refVoltage,
! 					       bool leftJustify, uint8_t prescaler) {
!     atomic
!       {
! 	f.multiple = TRUE;
! 	getData(channel, refVoltage, leftJustify, prescaler);
! 	nextF = f;
! 	/* We assume the 2nd sample is precise */
! 	nextF.precise = TRUE;
! 
! 	return f.precise;
!       }
!   }
! 
!   default async event void Atm128AdcSingle.dataReady(uint16_t data, bool precise) {
!   }
! 
!   default async event bool Atm128AdcMultiple.dataReady(uint16_t data, bool precise, uint8_t channel,
! 						       uint8_t *newChannel, uint8_t *newRefVoltage) {
!     return FALSE; // stop conversion if we somehow end up here.
!   }
! }
--- 1,246 ----
! /* $Id$
!  * "Copyright (c) 2000-2003 The Regents of the University  of California.  
!  * All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
!  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
!  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
!  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  * 
!  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
!  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
!  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
!  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
!  *
!  * Copyright (c) 2002-2005 Intel Corporation
!  * All rights reserved.
!  *
!  * This file is distributed under the terms in the attached INTEL-LICENSE     
!  * file. If you do not find these files, copies can be found by writing to
!  * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
!  * 94704.  Attention:  Intel License Inquiry.
!  *
!  * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO 
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 
!  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
!  * DAMAGE. 
!  *
!  * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
!  * MODIFICATIONS.
!  */
! 
! #include "Atm128Adc.h"
! 
! /**
!  * Internal component of the Atmega128 A/D HAL.
!  *
!  * @author Jason Hill
!  * @author David Gay
!  * @author Philip Levis
!  * @author Phil Buonadonna
!  * @author Hu Siquan <husq at xbow.com>
!  */
! 
! module Atm128AdcP 
! {
!   provides {
!     interface Init;
!     interface AsyncStdControl;
!     interface Atm128AdcSingle;
!     interface Atm128AdcMultiple;
!   }
!   uses {
!     interface HplAtm128Adc;
!     interface Atm128Calibrate;
!   }
! }
! implementation
! {  
!   /* State for the current and next (multiple-sampling only) conversion */
!   struct {
!     bool multiple : 1;		/* single and multiple-sampling mode */
!     bool precise : 1;		/* is this result going to be precise? */
!     uint8_t channel : 5;	/* what channel did this sample come from? */
!   } f, nextF;
!   
!   command error_t Init.init() {
!     atomic
!       {
! 	Atm128Adcsra_t adcsr;
! 
! 	adcsr.aden = ATM128_ADC_ENABLE_OFF;
! 	adcsr.adsc = ATM128_ADC_START_CONVERSION_OFF;  
! 	adcsr.adfr = ATM128_ADC_FREE_RUNNING_OFF; 
! 	adcsr.adif = ATM128_ADC_INT_FLAG_OFF;               
! 	adcsr.adie = ATM128_ADC_INT_ENABLE_OFF;       
! 	adcsr.adps = ATM128_ADC_PRESCALE_2;
! 	call HplAtm128Adc.setAdcsra(adcsr);
!       }
!     return SUCCESS;
!   }
! 
!   /* We enable the A/D when start is called, and disable it when stop is
!      called. This drops A/D conversion latency by a factor of two (but
!      increases idle mode power consumption a little). 
!   */
!   async command error_t AsyncStdControl.start() {
!     atomic call HplAtm128Adc.enableAdc();
!     return SUCCESS;
!   }
! 
!   async command error_t AsyncStdControl.stop() {
!     atomic call HplAtm128Adc.disableAdc();
! 
!     return SUCCESS;
!   }
! 
!   /* Return TRUE if switching to 'channel' with reference voltage 'refVoltage'
!      will give a precise result (the first sample after changing reference
!      voltage or switching to/between a differential channel is imprecise)
!   */
!   inline bool isPrecise(Atm128Admux_t admux, uint8_t channel, uint8_t refVoltage) {
!     return refVoltage == admux.refs &&
!       (channel <= ATM128_ADC_SNGL_ADC7 || channel >= ATM128_ADC_SNGL_1_23 || channel == admux.mux);
!   }
! 
!   async event void HplAtm128Adc.dataReady(uint16_t data) {
!     bool precise, multiple;
!     uint8_t channel;
! 
!     atomic 
!       {
! 	channel = f.channel;
! 	precise = f.precise;
! 	multiple = f.multiple;
!       }
! 
!     if (!multiple)
!       {
! 	/* A single sample. Disable the ADC interrupt to avoid starting
! 	   a new sample at the next "sleep" instruction. */
! 	call HplAtm128Adc.disableInterruption();
! 	signal Atm128AdcSingle.dataReady(data, precise);
!       }
!     else
!       {
! 	/* Multiple sampling. The user can:
! 	   - tell us to stop sampling
! 	   - or, to continue sampling on a new channel, possibly with a
! 	     new reference voltage; however this change applies not to
! 	     the next sample (the hardware has already started working on
! 	     that), but on the one after.
! 	*/
! 	bool cont;
! 	uint8_t nextChannel, nextVoltage;
! 	Atm128Admux_t admux;
! 
! 	atomic 
! 	  {
! 	    admux = call HplAtm128Adc.getAdmux();
! 	    nextVoltage = admux.refs;
! 	    nextChannel = admux.mux;
! 	  }
! 
! 	cont = signal Atm128AdcMultiple.dataReady(data, precise, channel,
! 						  &nextChannel, &nextVoltage);
! 	atomic
! 	  if (cont)
! 	    {
! 	      /* Switch channels and update our internal channel+precision
! 		 tracking state (f and nextF). Note that this tracking will
! 		 be incorrect if we take too long to get to this point. */
! 	      admux.refs = nextVoltage;
! 	      admux.mux = nextChannel;
! 	      call HplAtm128Adc.setAdmux(admux);
! 
! 	      f = nextF;
! 	      nextF.channel = nextChannel;
! 	      nextF.precise = isPrecise(admux, nextChannel, nextVoltage);
! 	    }
! 	  else
! 	    call HplAtm128Adc.cancel();
!       }
!   }
! 
!   /* Start sampling based on request parameters */
!   void getData(uint8_t channel, uint8_t refVoltage, bool leftJustify, uint8_t prescaler) {
!     Atm128Admux_t admux;
!     Atm128Adcsra_t adcsr;
! 
!     admux = call HplAtm128Adc.getAdmux();
!     f.precise = isPrecise(admux, channel, refVoltage);
!     f.channel = channel;
! 
!     admux.refs = refVoltage;
!     admux.adlar = leftJustify;
!     admux.mux = channel;
!     call HplAtm128Adc.setAdmux(admux);
! 
!     adcsr.aden = ATM128_ADC_ENABLE_ON;
!     adcsr.adsc = ATM128_ADC_START_CONVERSION_ON;
!     adcsr.adfr = f.multiple;
!     adcsr.adif = ATM128_ADC_INT_FLAG_ON; // clear any stale flag
!     adcsr.adie = ATM128_ADC_INT_ENABLE_ON;
!     if (prescaler == ATM128_ADC_PRESCALE)
!       prescaler = call Atm128Calibrate.adcPrescaler();
!     adcsr.adps = prescaler;
!     call HplAtm128Adc.setAdcsra(adcsr);
!   }
! 
!   async command bool Atm128AdcSingle.getData(uint8_t channel, uint8_t refVoltage,
! 					     bool leftJustify, uint8_t prescaler) {
!     atomic
!       {
! 	f.multiple = FALSE;
! 	getData(channel, refVoltage, leftJustify, prescaler);
! 
! 	return f.precise;
!       }
!   }
! 
!   async command bool Atm128AdcSingle.cancel() {
!     /* There is no Atm128AdcMultiple.cancel, for reasons discussed in that
!        interface */
!     return call HplAtm128Adc.cancel();
!   }
! 
!   async command bool Atm128AdcMultiple.getData(uint8_t channel, uint8_t refVoltage,
! 					       bool leftJustify, uint8_t prescaler) {
!     atomic
!       {
! 	f.multiple = TRUE;
! 	getData(channel, refVoltage, leftJustify, prescaler);
! 	nextF = f;
! 	/* We assume the 2nd sample is precise */
! 	nextF.precise = TRUE;
! 
! 	return f.precise;
!       }
!   }
! 
!   default async event void Atm128AdcSingle.dataReady(uint16_t data, bool precise) {
!   }
! 
!   default async event bool Atm128AdcMultiple.dataReady(uint16_t data, bool precise, uint8_t channel,
! 						       uint8_t *newChannel, uint8_t *newRefVoltage) {
!     return FALSE; // stop conversion if we somehow end up here.
!   }
! }

Index: HplAtm128Adc.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/adc/HplAtm128Adc.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** HplAtm128Adc.nc	12 Dec 2006 18:23:03 -0000	1.4
--- HplAtm128Adc.nc	11 Jun 2008 00:42:13 -0000	1.5
***************
*** 1,3 ****
! /// $Id$
  
  /*
--- 1,3 ----
! /// $Id$
  
  /*

Index: Atm128Adc.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/adc/Atm128Adc.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Atm128Adc.h	12 Dec 2006 18:23:03 -0000	1.4
--- Atm128Adc.h	11 Jun 2008 00:42:13 -0000	1.5
***************
*** 1,158 ****
! // $Id$
! 
! /*
!  * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO 
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 
!  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
!  * DAMAGE. 
!  *
!  * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
!  * MODIFICATIONS.
!  */
! 
! // @author Martin Turon <mturon at xbow.com>
! // @author Hu Siquan <husq at xbow.com>
! 
! #ifndef _H_Atm128ADC_h
! #define _H_Atm128ADC_h
! 
! //================== 8 channel 10-bit ADC ==============================
! 
! /* Voltage Reference Settings */
! enum {
!     ATM128_ADC_VREF_OFF = 0, //!< VR+ = AREF   and VR- = GND
!     ATM128_ADC_VREF_AVCC = 1,//!< VR+ = AVcc   and VR- = GND
!     ATM128_ADC_VREF_RSVD,
!     ATM128_ADC_VREF_2_56 = 3,//!< VR+ = 2.56V  and VR- = GND
! };
! 
! /* Voltage Reference Settings */
! enum {
!     ATM128_ADC_RIGHT_ADJUST = 0, 
!     ATM128_ADC_LEFT_ADJUST = 1,
! };
! 
! 
! /* ADC Multiplexer Settings */
! enum {
!     ATM128_ADC_SNGL_ADC0 = 0,
!     ATM128_ADC_SNGL_ADC1,
!     ATM128_ADC_SNGL_ADC2,
!     ATM128_ADC_SNGL_ADC3,
!     ATM128_ADC_SNGL_ADC4,
!     ATM128_ADC_SNGL_ADC5,
!     ATM128_ADC_SNGL_ADC6,
!     ATM128_ADC_SNGL_ADC7,
!     ATM128_ADC_DIFF_ADC00_10x,
!     ATM128_ADC_DIFF_ADC10_10x,
!     ATM128_ADC_DIFF_ADC00_200x,
!     ATM128_ADC_DIFF_ADC10_200x,
!     ATM128_ADC_DIFF_ADC22_10x,
!     ATM128_ADC_DIFF_ADC32_10x,
!     ATM128_ADC_DIFF_ADC22_200x,
!     ATM128_ADC_DIFF_ADC32_200x,
!     ATM128_ADC_DIFF_ADC01_1x,
!     ATM128_ADC_DIFF_ADC11_1x,
!     ATM128_ADC_DIFF_ADC21_1x,
!     ATM128_ADC_DIFF_ADC31_1x,
!     ATM128_ADC_DIFF_ADC41_1x,
!     ATM128_ADC_DIFF_ADC51_1x,
!     ATM128_ADC_DIFF_ADC61_1x,
!     ATM128_ADC_DIFF_ADC71_1x,
!     ATM128_ADC_DIFF_ADC02_1x,
!     ATM128_ADC_DIFF_ADC12_1x,
!     ATM128_ADC_DIFF_ADC22_1x,
!     ATM128_ADC_DIFF_ADC32_1x,
!     ATM128_ADC_DIFF_ADC42_1x,
!     ATM128_ADC_DIFF_ADC52_1x,
!     ATM128_ADC_SNGL_1_23,
!     ATM128_ADC_SNGL_GND,
! };
! 
! /* ADC Multiplexer Selection Register */
! typedef struct
! {
!     uint8_t mux   : 5;  //!< Analog Channel and Gain Selection Bits
!     uint8_t adlar : 1;  //!< ADC Left Adjust Result
!     uint8_t refs  : 2;  //!< Reference Selection Bits
! } Atm128Admux_t;
! 
! /* ADC Prescaler Settings */
! /* Note: each platform must define ATM128_ADC_PRESCALE to the smallest
!    prescaler which guarantees full A/D precision. */
! enum {
!     ATM128_ADC_PRESCALE_2 = 0,
!     ATM128_ADC_PRESCALE_2b,
!     ATM128_ADC_PRESCALE_4,
!     ATM128_ADC_PRESCALE_8,
!     ATM128_ADC_PRESCALE_16,
!     ATM128_ADC_PRESCALE_32,
!     ATM128_ADC_PRESCALE_64,
!     ATM128_ADC_PRESCALE_128,
! 
!     // This special value is used to ask the platform for the prescaler
!     // which gives full precision.
!     ATM128_ADC_PRESCALE
! };
! 
! /* ADC Enable Settings */
! enum {
!     ATM128_ADC_ENABLE_OFF = 0,
!     ATM128_ADC_ENABLE_ON,
! };
! 
! /* ADC Start Conversion Settings */
! enum {
!     ATM128_ADC_START_CONVERSION_OFF = 0,
!     ATM128_ADC_START_CONVERSION_ON,
! };
! 
! /* ADC Free Running Select Settings */
! enum {
!     ATM128_ADC_FREE_RUNNING_OFF = 0,
!     ATM128_ADC_FREE_RUNNING_ON,
! };
! 
! /* ADC Interrupt Flag Settings */
! enum {
!     ATM128_ADC_INT_FLAG_OFF = 0,
!     ATM128_ADC_INT_FLAG_ON,
! };
! 
! /* ADC Interrupt Enable Settings */
! enum {
!     ATM128_ADC_INT_ENABLE_OFF = 0,
!     ATM128_ADC_INT_ENABLE_ON,
! };
! 
! /* ADC Multiplexer Selection Register */
! typedef struct
! {
!     uint8_t adps  : 3;  //!< ADC Prescaler Select Bits
!     uint8_t adie  : 1;  //!< ADC Interrupt Enable
!     uint8_t adif  : 1;  //!< ADC Interrupt Flag
!     uint8_t adfr  : 1;  //!< ADC Free Running Select
!     uint8_t adsc  : 1;  //!< ADC Start Conversion
!     uint8_t aden  : 1;  //!< ADC Enable
! } Atm128Adcsra_t;
! 
! typedef uint8_t Atm128_ADCH_t;         //!< ADC data register high
! typedef uint8_t Atm128_ADCL_t;         //!< ADC data register low
! 
! // The resource identifier string for the ADC subsystem
! #define UQ_ATM128ADC_RESOURCE "atm128adc.resource"
! 
! #endif //_H_Atm128ADC_h
! 
--- 1,158 ----
! // $Id$
! 
! /*
!  * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO 
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 
!  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
!  * DAMAGE. 
!  *
!  * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
!  * MODIFICATIONS.
!  */
! 
! // @author Martin Turon <mturon at xbow.com>
! // @author Hu Siquan <husq at xbow.com>
! 
! #ifndef _H_Atm128ADC_h
! #define _H_Atm128ADC_h
! 
! //================== 8 channel 10-bit ADC ==============================
! 
! /* Voltage Reference Settings */
! enum {
!     ATM128_ADC_VREF_OFF = 0, //!< VR+ = AREF   and VR- = GND
!     ATM128_ADC_VREF_AVCC = 1,//!< VR+ = AVcc   and VR- = GND
!     ATM128_ADC_VREF_RSVD,
!     ATM128_ADC_VREF_2_56 = 3,//!< VR+ = 2.56V  and VR- = GND
! };
! 
! /* Voltage Reference Settings */
! enum {
!     ATM128_ADC_RIGHT_ADJUST = 0, 
!     ATM128_ADC_LEFT_ADJUST = 1,
! };
! 
! 
! /* ADC Multiplexer Settings */
! enum {
!     ATM128_ADC_SNGL_ADC0 = 0,
!     ATM128_ADC_SNGL_ADC1,
!     ATM128_ADC_SNGL_ADC2,
!     ATM128_ADC_SNGL_ADC3,
!     ATM128_ADC_SNGL_ADC4,
!     ATM128_ADC_SNGL_ADC5,
!     ATM128_ADC_SNGL_ADC6,
!     ATM128_ADC_SNGL_ADC7,
!     ATM128_ADC_DIFF_ADC00_10x,
!     ATM128_ADC_DIFF_ADC10_10x,
!     ATM128_ADC_DIFF_ADC00_200x,
!     ATM128_ADC_DIFF_ADC10_200x,
!     ATM128_ADC_DIFF_ADC22_10x,
!     ATM128_ADC_DIFF_ADC32_10x,
!     ATM128_ADC_DIFF_ADC22_200x,
!     ATM128_ADC_DIFF_ADC32_200x,
!     ATM128_ADC_DIFF_ADC01_1x,
!     ATM128_ADC_DIFF_ADC11_1x,
!     ATM128_ADC_DIFF_ADC21_1x,
!     ATM128_ADC_DIFF_ADC31_1x,
!     ATM128_ADC_DIFF_ADC41_1x,
!     ATM128_ADC_DIFF_ADC51_1x,
!     ATM128_ADC_DIFF_ADC61_1x,
!     ATM128_ADC_DIFF_ADC71_1x,
!     ATM128_ADC_DIFF_ADC02_1x,
!     ATM128_ADC_DIFF_ADC12_1x,
!     ATM128_ADC_DIFF_ADC22_1x,
!     ATM128_ADC_DIFF_ADC32_1x,
!     ATM128_ADC_DIFF_ADC42_1x,
!     ATM128_ADC_DIFF_ADC52_1x,
!     ATM128_ADC_SNGL_1_23,
!     ATM128_ADC_SNGL_GND,
! };
! 
! /* ADC Multiplexer Selection Register */
! typedef struct
! {
!     uint8_t mux   : 5;  //!< Analog Channel and Gain Selection Bits
!     uint8_t adlar : 1;  //!< ADC Left Adjust Result
!     uint8_t refs  : 2;  //!< Reference Selection Bits
! } Atm128Admux_t;
! 
! /* ADC Prescaler Settings */
! /* Note: each platform must define ATM128_ADC_PRESCALE to the smallest
!    prescaler which guarantees full A/D precision. */
! enum {
!     ATM128_ADC_PRESCALE_2 = 0,
!     ATM128_ADC_PRESCALE_2b,
!     ATM128_ADC_PRESCALE_4,
!     ATM128_ADC_PRESCALE_8,
!     ATM128_ADC_PRESCALE_16,
!     ATM128_ADC_PRESCALE_32,
!     ATM128_ADC_PRESCALE_64,
!     ATM128_ADC_PRESCALE_128,
! 
!     // This special value is used to ask the platform for the prescaler
!     // which gives full precision.
!     ATM128_ADC_PRESCALE
! };
! 
! /* ADC Enable Settings */
! enum {
!     ATM128_ADC_ENABLE_OFF = 0,
!     ATM128_ADC_ENABLE_ON,
! };
! 
! /* ADC Start Conversion Settings */
! enum {
!     ATM128_ADC_START_CONVERSION_OFF = 0,
!     ATM128_ADC_START_CONVERSION_ON,
! };
! 
! /* ADC Free Running Select Settings */
! enum {
!     ATM128_ADC_FREE_RUNNING_OFF = 0,
!     ATM128_ADC_FREE_RUNNING_ON,
! };
! 
! /* ADC Interrupt Flag Settings */
! enum {
!     ATM128_ADC_INT_FLAG_OFF = 0,
!     ATM128_ADC_INT_FLAG_ON,
! };
! 
! /* ADC Interrupt Enable Settings */
! enum {
!     ATM128_ADC_INT_ENABLE_OFF = 0,
!     ATM128_ADC_INT_ENABLE_ON,
! };
! 
! /* ADC Multiplexer Selection Register */
! typedef struct
! {
!     uint8_t adps  : 3;  //!< ADC Prescaler Select Bits
!     uint8_t adie  : 1;  //!< ADC Interrupt Enable
!     uint8_t adif  : 1;  //!< ADC Interrupt Flag
!     uint8_t adfr  : 1;  //!< ADC Free Running Select
!     uint8_t adsc  : 1;  //!< ADC Start Conversion
!     uint8_t aden  : 1;  //!< ADC Enable
! } Atm128Adcsra_t;
! 
! typedef uint8_t Atm128_ADCH_t;         //!< ADC data register high
! typedef uint8_t Atm128_ADCL_t;         //!< ADC data register low
! 
! // The resource identifier string for the ADC subsystem
! #define UQ_ATM128ADC_RESOURCE "atm128adc.resource"
! 
! #endif //_H_Atm128ADC_h
! 

Index: HplAtm128AdcC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/adc/HplAtm128AdcC.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** HplAtm128AdcC.nc	12 Dec 2006 18:23:03 -0000	1.5
--- HplAtm128AdcC.nc	11 Jun 2008 00:42:13 -0000	1.6
***************
*** 1,3 ****
! /// $Id$
  
  /*
--- 1,3 ----
! /// $Id$
  
  /*

Index: Atm128AdcSingle.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/adc/Atm128AdcSingle.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Atm128AdcSingle.nc	12 Dec 2006 18:23:03 -0000	1.4
--- Atm128AdcSingle.nc	11 Jun 2008 00:42:13 -0000	1.5
***************
*** 1,83 ****
! /// $Id$
! 
! /*
!  * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO 
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 
!  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
!  * DAMAGE. 
!  *
!  * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
!  * MODIFICATIONS.
!  *
!  * Copyright (c) 2002-2005 Intel Corporation
!  * All rights reserved.
!  *
!  * This file is distributed under the terms in the attached INTEL-LICENSE     
!  * file. If you do not find these files, copies can be found by writing to
!  * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
!  * 94704.  Attention:  Intel License Inquiry.
!  */
! 
! /**
!  * Hardware Abstraction Layer interface of Atmega128 for acquiring
!  * a single sample from a channel.
!  *
!  * @author Hu Siquan <husq at xbow.com>
!  * @author David Gay
!  */
! 
! #include "Atm128Adc.h"
! 
! interface Atm128AdcSingle
! {
!   /**
!    * Initiates an ADC conversion on a given channel.
!    *
!    * @param channel A/D conversion channel.
!    * @param refVoltage Select reference voltage for A/D conversion. See
!    *   the ATM128_ADC_VREF_xxx constants in Atm128ADC.h
!    * @param leftJustify TRUE to place A/D result in high-order bits 
!    *   (i.e., shifted left by 6 bits), low to place it in the low-order bits
!    * @param prescaler Prescaler value for the A/D conversion clock. If you 
!    *  specify ATM128_ADC_PRESCALE, a prescaler will be chosen that guarantees
!    *  full precision. Other prescalers can be used to get faster conversions. 
!    *  See the ATmega128 manual for details.
!    * @return TRUE if the conversion will be precise, FALSE if it will be 
!    *   imprecise (due to a change in refernce voltage, or switching to a
!    *   differential input channel)
!    */
!   async command bool getData(uint8_t channel, uint8_t refVoltage,
! 			     bool leftJustify, uint8_t prescaler);
!   
!   /**
!    * Indicates a sample has been recorded by the ADC as the result
!    * of a <code>getData()</code> command.
!    *
!    * @param data a 2 byte unsigned data value sampled by the ADC.
!    * @param precise if the conversion precise, FALSE if it wasn't. This
!    *   values matches the result from the <code>getData</code> call.
!    */	
!   async event void dataReady(uint16_t data, bool precise);
! 
!   /**
!    * Cancel an outstanding getData operation. Use with care, to
!    * avoid problems with races between the dataReady event and cancel.
!    * @return TRUE if a conversion was in-progress or an interrupt
!    *   was pending. dataReady will not be signaled. FALSE if the
!    *   conversion was already complete. dataReady will be (or has
!    *   already been) signaled.
!    */
!   async command bool cancel();
! }
--- 1,83 ----
! /// $Id$
! 
! /*
!  * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO 
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 
!  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
!  * DAMAGE. 
!  *
!  * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
!  * MODIFICATIONS.
!  *
!  * Copyright (c) 2002-2005 Intel Corporation
!  * All rights reserved.
!  *
!  * This file is distributed under the terms in the attached INTEL-LICENSE     
!  * file. If you do not find these files, copies can be found by writing to
!  * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
!  * 94704.  Attention:  Intel License Inquiry.
!  */
! 
! /**
!  * Hardware Abstraction Layer interface of Atmega128 for acquiring
!  * a single sample from a channel.
!  *
!  * @author Hu Siquan <husq at xbow.com>
!  * @author David Gay
!  */
! 
! #include "Atm128Adc.h"
! 
! interface Atm128AdcSingle
! {
!   /**
!    * Initiates an ADC conversion on a given channel.
!    *
!    * @param channel A/D conversion channel.
!    * @param refVoltage Select reference voltage for A/D conversion. See
!    *   the ATM128_ADC_VREF_xxx constants in Atm128ADC.h
!    * @param leftJustify TRUE to place A/D result in high-order bits 
!    *   (i.e., shifted left by 6 bits), low to place it in the low-order bits
!    * @param prescaler Prescaler value for the A/D conversion clock. If you 
!    *  specify ATM128_ADC_PRESCALE, a prescaler will be chosen that guarantees
!    *  full precision. Other prescalers can be used to get faster conversions. 
!    *  See the ATmega128 manual for details.
!    * @return TRUE if the conversion will be precise, FALSE if it will be 
!    *   imprecise (due to a change in refernce voltage, or switching to a
!    *   differential input channel)
!    */
!   async command bool getData(uint8_t channel, uint8_t refVoltage,
! 			     bool leftJustify, uint8_t prescaler);
!   
!   /**
!    * Indicates a sample has been recorded by the ADC as the result
!    * of a <code>getData()</code> command.
!    *
!    * @param data a 2 byte unsigned data value sampled by the ADC.
!    * @param precise if the conversion precise, FALSE if it wasn't. This
!    *   values matches the result from the <code>getData</code> call.
!    */	
!   async event void dataReady(uint16_t data, bool precise);
! 
!   /**
!    * Cancel an outstanding getData operation. Use with care, to
!    * avoid problems with races between the dataReady event and cancel.
!    * @return TRUE if a conversion was in-progress or an interrupt
!    *   was pending. dataReady will not be signaled. FALSE if the
!    *   conversion was already complete. dataReady will be (or has
!    *   already been) signaled.
!    */
!   async command bool cancel();
! }

Index: HplAtm128AdcP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/adc/HplAtm128AdcP.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** HplAtm128AdcP.nc	2 May 2008 19:48:54 -0000	1.6
--- HplAtm128AdcP.nc	11 Jun 2008 00:42:13 -0000	1.7
***************
*** 1,3 ****
! /// $Id$
  /*
   * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved.
--- 1,3 ----
! /// $Id$
  /*
   * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved.

Index: Atm128AdcMultiple.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/adc/Atm128AdcMultiple.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Atm128AdcMultiple.nc	12 Dec 2006 18:23:03 -0000	1.4
--- Atm128AdcMultiple.nc	11 Jun 2008 00:42:13 -0000	1.5
***************
*** 1,120 ****
! /// $Id$
! 
! /*
!  * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO 
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 
!  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
!  * DAMAGE. 
!  *
!  * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
!  * MODIFICATIONS.
!  *
!  * Copyright (c) 2002-2005 Intel Corporation
!  * All rights reserved.
!  *
!  * This file is distributed under the terms in the attached INTEL-LICENSE     
!  * file. If you do not find these files, copies can be found by writing to
!  * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
!  * 94704.  Attention:  Intel License Inquiry.
!  */
! 
! /**
!  * Hardware Abstraction Layer interface of Atmega128 for acquiring data
!  * from multiple channels using the ATmega128's free-running mode.
!  * <p>
!  * Because of the possibility that samples may be imprecise after 
!  * switching channels and/or reference voltages, and because there
!  * is a one sample delay on swithcing channels and reference voltages,
!  * Atm128ADCMultiple is complex. Two straightforward uses are:
!  * <ol type="A">
!  * <li>Acquire N samples from channel C:
!  *    <ol>
!  *    <li>call getData to start sampling on channel C at the desired rate
!  *       (note that the choice of prescalers is very limited, so you
!  *       don't have many choices for sampling rate)
!  *    <li>ignore the first dataReady event
!  *    <li>use the results of the next N dataReady() events, return FALSE
!  *       on the last one
!  *    </ol>
!  * <li>Acquire one sample each from channels C1, ..., Cn (this pseudocode
!  *    assumes that none of these channels are differential)
!  *    <ol>
!  *    <li>call getData to start sampling on channel C1
!  *    <li>on the ith dataReady event switch to channel Ci+1 by changing
!  *       *newChannel
!  *    <li>the data passed to the ith dataReady event is for channel Ci-1
!  *       (the data from the first dataReady event is ignored)
!  *    </ol>
!  * </ol>
!  *
!  * @author Hu Siquan <husq at xbow.com>
!  * @author David Gay
!  */        
! 
! #include "Atm128Adc.h"
! 
! interface Atm128AdcMultiple
! {
!   /**
!    * Initiates free-running ADC conversions, with the ability to switch 
!    * channels and reference-voltage with a one sample delay.
!    *
!    * @param channel Initial A/D conversion channel. The channel can 
!    *   be changed in the dataReady event, though these changes happen
!    *   with a one-sample delay (this is a hardware restriction).
!    * @param refVoltage Initial A/D reference voltage. See the
!    *   ATM128_ADC_VREF_xxx constants in Atm128ADC.h. Like the channel,
!    *   the reference voltage can be changed in the dataReady event with
!    *   a one-sample delay.
!    * @param leftJustify TRUE to place A/D result in high-order bits 
!    *   (i.e., shifted left by 6 bits), low to place it in the low-order bits
!    * @param prescaler Prescaler value for the A/D conversion clock. If you 
!    *  specify ATM128_ADC_PRESCALE, a prescaler will be chosen that guarantees
!    *  full precision. Other prescalers can be used to get faster conversions. 
!    *  See the ATmega128 manual for details.
!    * @return TRUE if the conversion will be precise, FALSE if it will be 
!    *   imprecise (due to a change in reference voltage, or switching to a
!    *   differential input channel)
!    */
!   async command bool getData(uint8_t channel, uint8_t refVoltage,
! 			     bool leftJustify, uint8_t prescaler);
!   
!   /**
!    * Returns the next sample in a free-running conversion. Allow the user
!    * to switch channels and/or reference voltages with a one sample delay.
!    *
!    * @param data a 2 byte unsigned data value sampled by the ADC.
!    * @param precise if this conversion was precise, FALSE if it wasn't 
!    *   (we assume that the second conversion after a change of reference
!    *   voltage or after switching to a differential channel is precise)
!    * @param channel Channel this sample was from.
!    * @param newChannel Change this parameter to switch to a new channel
!    *   for the second next sample.
!    * @param newRefVoltage Change this parameter to change the reference 
!    *   voltage for the second next sample.
!    *
!    * @return TRUE to continue sampling, FALSE to stop.
!    */	
!   async event bool dataReady(uint16_t data, bool precise, uint8_t channel,
! 			     uint8_t *newChannel, uint8_t *newRefVoltage);
! 
! 
!   /* Note: there is no cancel in free-running mode because you cannot tell
!      from a successful (or unsuccessful) cancellation whether there will
!      be another dataReady event. Thus you cannot tell when you can safely
!      reuse the ADC (short of waiting one ADC conversion period, in which
!      case you might as well use the result of dataReady to cancel).
!   */
! }
--- 1,120 ----
! /// $Id$
! 
! /*
!  * Copyright (c) 2004-2005 Crossbow Technology, Inc.  All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  * 
!  * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO 
!  * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 
!  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
!  * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
!  * DAMAGE. 
!  *
!  * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
!  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 
!  * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY 
!  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
!  * MODIFICATIONS.
!  *
!  * Copyright (c) 2002-2005 Intel Corporation
!  * All rights reserved.
!  *
!  * This file is distributed under the terms in the attached INTEL-LICENSE     
!  * file. If you do not find these files, copies can be found by writing to
!  * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
!  * 94704.  Attention:  Intel License Inquiry.
!  */
! 
! /**
!  * Hardware Abstraction Layer interface of Atmega128 for acquiring data
!  * from multiple channels using the ATmega128's free-running mode.
!  * <p>
!  * Because of the possibility that samples may be imprecise after 
!  * switching channels and/or reference voltages, and because there
!  * is a one sample delay on swithcing channels and reference voltages,
!  * Atm128ADCMultiple is complex. Two straightforward uses are:
!  * <ol type="A">
!  * <li>Acquire N samples from channel C:
!  *    <ol>
!  *    <li>call getData to start sampling on channel C at the desired rate
!  *       (note that the choice of prescalers is very limited, so you
!  *       don't have many choices for sampling rate)
!  *    <li>ignore the first dataReady event
!  *    <li>use the results of the next N dataReady() events, return FALSE
!  *       on the last one
!  *    </ol>
!  * <li>Acquire one sample each from channels C1, ..., Cn (this pseudocode
!  *    assumes that none of these channels are differential)
!  *    <ol>
!  *    <li>call getData to start sampling on channel C1
!  *    <li>on the ith dataReady event switch to channel Ci+1 by changing
!  *       *newChannel
!  *    <li>the data passed to the ith dataReady event is for channel Ci-1
!  *       (the data from the first dataReady event is ignored)
!  *    </ol>
!  * </ol>
!  *
!  * @author Hu Siquan <husq at xbow.com>
!  * @author David Gay
!  */        
! 
! #include "Atm128Adc.h"
! 
! interface Atm128AdcMultiple
! {
!   /**
!    * Initiates free-running ADC conversions, with the ability to switch 
!    * channels and reference-voltage with a one sample delay.
!    *
!    * @param channel Initial A/D conversion channel. The channel can 
!    *   be changed in the dataReady event, though these changes happen
!    *   with a one-sample delay (this is a hardware restriction).
!    * @param refVoltage Initial A/D reference voltage. See the
!    *   ATM128_ADC_VREF_xxx constants in Atm128ADC.h. Like the channel,
!    *   the reference voltage can be changed in the dataReady event with
!    *   a one-sample delay.
!    * @param leftJustify TRUE to place A/D result in high-order bits 
!    *   (i.e., shifted left by 6 bits), low to place it in the low-order bits
!    * @param prescaler Prescaler value for the A/D conversion clock. If you 
!    *  specify ATM128_ADC_PRESCALE, a prescaler will be chosen that guarantees
!    *  full precision. Other prescalers can be used to get faster conversions. 
!    *  See the ATmega128 manual for details.
!    * @return TRUE if the conversion will be precise, FALSE if it will be 
!    *   imprecise (due to a change in reference voltage, or switching to a
!    *   differential input channel)
!    */
!   async command bool getData(uint8_t channel, uint8_t refVoltage,
! 			     bool leftJustify, uint8_t prescaler);
!   
!   /**
!    * Returns the next sample in a free-running conversion. Allow the user
!    * to switch channels and/or reference voltages with a one sample delay.
!    *
!    * @param data a 2 byte unsigned data value sampled by the ADC.
!    * @param precise if this conversion was precise, FALSE if it wasn't 
!    *   (we assume that the second conversion after a change of reference
!    *   voltage or after switching to a differential channel is precise)
!    * @param channel Channel this sample was from.
!    * @param newChannel Change this parameter to switch to a new channel
!    *   for the second next sample.
!    * @param newRefVoltage Change this parameter to change the reference 
!    *   voltage for the second next sample.
!    *
!    * @return TRUE to continue sampling, FALSE to stop.
!    */	
!   async event bool dataReady(uint16_t data, bool precise, uint8_t channel,
! 			     uint8_t *newChannel, uint8_t *newRefVoltage);
! 
! 
!   /* Note: there is no cancel in free-running mode because you cannot tell
!      from a successful (or unsuccessful) cancellation whether there will
!      be another dataReady event. Thus you cannot tell when you can safely
!      reuse the ADC (short of waiting one ADC conversion period, in which
!      case you might as well use the result of dataReady to cancel).
!   */
! }



More information about the Tinyos-2-commits mailing list