[Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/eyesIFX/sensors ReadNowShiftC.nc, NONE, 1.1.2.1 ReadShiftC.nc, NONE, 1.1.2.1 ReadStreamShiftC.nc, NONE, 1.1.2.1 DemoSensorC.nc, 1.1.2.5, 1.1.2.6 DemoSensorNowC.nc, 1.1.2.2, 1.1.2.3 DemoSensorStreamC.nc, 1.1.2.1, 1.1.2.2

Jan-Hinrich Hauer janhauer at users.sourceforge.net
Fri Jul 7 08:55:29 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/sensors
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv15570/tos/platforms/eyesIFX/sensors

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	DemoSensorC.nc DemoSensorNowC.nc DemoSensorStreamC.nc 
Added Files:
      Tag: tinyos-2_0_devel-BRANCH
	ReadNowShiftC.nc ReadShiftC.nc ReadStreamShiftC.nc 
Log Message:
Let DemoSensor components shift sensor readings so they are left aligend.

--- NEW FILE: ReadNowShiftC.nc ---
/*
 * Copyright (c) 2006, Technische Universitaet Berlin
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 * - Neither the name of the Technische Universitaet Berlin nor the names
 *   of its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1.2.1 $
 * $Date: 2006/07/07 15:55:26 $
 * @author: Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */

generic module ReadNowShiftC(uint8_t bits)
{
  provides interface ReadNow<uint16_t> as ReadNowShifted;
  uses interface ReadNow<uint16_t> as ReadNowRaw;
}
implementation
{
  async command error_t ReadNowShifted.read() { return call ReadNowRaw.read(); }
  async event void ReadNowRaw.readDone(error_t result, uint16_t val) 
  { 
    signal ReadNowShifted.readDone(result, (val << bits)); 
  }
}

--- NEW FILE: ReadShiftC.nc ---
/*
 * Copyright (c) 2006, Technische Universitaet Berlin
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 * - Neither the name of the Technische Universitaet Berlin nor the names
 *   of its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1.2.1 $
 * $Date: 2006/07/07 15:55:26 $
 * @author: Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */

generic module ReadShiftC(uint8_t bits)
{
  provides interface Read<uint16_t> as ReadShifted;
  uses interface Read<uint16_t> as ReadRaw;
}
implementation
{
  command error_t ReadShifted.read() { return call ReadRaw.read(); }
  event void ReadRaw.readDone(error_t result, uint16_t val) 
  { 
    signal ReadShifted.readDone(result, (val << bits)); 
  }
}

--- NEW FILE: ReadStreamShiftC.nc ---
/*
 * Copyright (c) 2006, Technische Universitaet Berlin
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 * - Neither the name of the Technische Universitaet Berlin nor the names
 *   of its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1.2.1 $
 * $Date: 2006/07/07 15:55:27 $
 * @author: Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */

generic module ReadStreamShiftC(uint8_t bits)
{
  provides interface ReadStream<uint16_t> as ReadStreamShifted;
  uses interface ReadStream<uint16_t> as ReadStreamRaw;
}
implementation
{
  command error_t ReadStreamShifted.postBuffer(uint16_t* buf, uint16_t count) 
  {
    return call ReadStreamRaw.postBuffer(buf, count);
  }
  
  command error_t ReadStreamShifted.read(uint32_t usPeriod) 
  { 
    return call ReadStreamRaw.read(usPeriod); 
  }

  event void ReadStreamRaw.bufferDone(error_t result, 
			 uint16_t* buf, uint16_t count)
  {
    uint16_t i;
    if (result == SUCCESS)
      for (i=0; i<count; i++)
        buf[i] <<= bits; 
    signal ReadStreamShifted.bufferDone(result, buf, count);
  }
  
  event void ReadStreamRaw.readDone(error_t result, uint32_t usActualPeriod) 
  { 
    signal ReadStreamShifted.readDone(result, usActualPeriod); 
  }
}

Index: DemoSensorC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/sensors/Attic/DemoSensorC.nc,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** DemoSensorC.nc	4 Feb 2006 01:36:04 -0000	1.1.2.5
--- DemoSensorC.nc	7 Jul 2006 15:55:26 -0000	1.1.2.6
***************
*** 56,62 ****
  {
    components SensorSettingsC as Settings;
- 
    components new AdcReadClientC() as AdcReadClient;
!   Read = AdcReadClient;
    AdcReadClient.Msp430Adc12Config -> Settings.Msp430Adc12Config[PHOTO_SENSOR_DEFAULT];
  }
--- 56,64 ----
  {
    components SensorSettingsC as Settings;
    components new AdcReadClientC() as AdcReadClient;
!   components new ReadShiftC(4) as ReadShift;
! 
!   Read = ReadShift;
!   ReadShift.ReadRaw -> AdcReadClient;
    AdcReadClient.Msp430Adc12Config -> Settings.Msp430Adc12Config[PHOTO_SENSOR_DEFAULT];
  }

Index: DemoSensorNowC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/sensors/Attic/DemoSensorNowC.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** DemoSensorNowC.nc	31 Jan 2006 18:53:36 -0000	1.1.2.2
--- DemoSensorNowC.nc	7 Jul 2006 15:55:26 -0000	1.1.2.3
***************
*** 58,64 ****
  {
    components SensorSettingsC as Settings;
-              
    components new AdcReadNowClientC() as AdcReadNowClient;
!   ReadNow = AdcReadNowClient;
    Resource = AdcReadNowClient;
    AdcReadNowClient.Msp430Adc12Config -> Settings.Msp430Adc12Config[PHOTO_SENSOR_DEFAULT];  
--- 58,66 ----
  {
    components SensorSettingsC as Settings;
    components new AdcReadNowClientC() as AdcReadNowClient;
!   components new ReadNowShiftC(4) as ReadNowShift;
!   
!   ReadNow = ReadNowShift;
!   ReadNowShift.ReadNowRaw -> AdcReadNowClient;
    Resource = AdcReadNowClient;
    AdcReadNowClient.Msp430Adc12Config -> Settings.Msp430Adc12Config[PHOTO_SENSOR_DEFAULT];  

Index: DemoSensorStreamC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/sensors/Attic/DemoSensorStreamC.nc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** DemoSensorStreamC.nc	4 Feb 2006 01:36:04 -0000	1.1.2.1
--- DemoSensorStreamC.nc	7 Jul 2006 15:55:26 -0000	1.1.2.2
***************
*** 56,62 ****
  {
    components SensorSettingsC as Settings;
- 
    components new AdcReadStreamClientC() as AdcReadStreamClient;
!   ReadStream = AdcReadStreamClient;
    AdcReadStreamClient.Msp430Adc12Config -> Settings.Msp430Adc12Config[PHOTO_SENSOR_DEFAULT];
  }
--- 56,64 ----
  {
    components SensorSettingsC as Settings;
    components new AdcReadStreamClientC() as AdcReadStreamClient;
!   components new ReadStreamShiftC(4) as ReadStreamShift;
!     
!   ReadStream = ReadStreamShift;
!   ReadStreamShift.ReadStreamRaw -> AdcReadStreamClient;
    AdcReadStreamClient.Msp430Adc12Config -> Settings.Msp430Adc12Config[PHOTO_SENSOR_DEFAULT];
  }



More information about the Tinyos-2-commits mailing list