[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/mica2/mts300 TestMts300C.nc, 1.5, 1.6 TestMts300P.nc, 1.5, 1.6

Pi Peng pipeng at users.sourceforge.net
Tue Mar 13 20:22:43 PDT 2007


Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/mica2/mts300
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27953

Modified Files:
	TestMts300C.nc TestMts300P.nc 
Log Message:
Change to use driver which follow TEP 109 .



Index: TestMts300C.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/mica2/mts300/TestMts300C.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TestMts300C.nc	15 Feb 2007 10:23:30 -0000	1.5
--- TestMts300C.nc	14 Mar 2007 03:22:37 -0000	1.6
***************
*** 1,40 ****
- // $Id$
- 
- /*
-  *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
-  *  downloading, copying, installing or using the software you agree to
-  *  this license.  If you do not agree to this license, do not download,
-  *  install, copy or use the software.
-  *
-  *  Copyright (c) 2004-2006 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 (updated) modification history and the author appear in
-  *  all copies of this source code.
-  *
-  *  Permission is also granted to distribute this software under the
-  *  standard BSD license as contained in the TinyOS distribution.
-  *
-  *  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 INTEL OR ITS
-  *  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.
-  */
- 
- /**
-  *  TinyOS 1.x to TinyOS 2.x translation layer.
-  *
-  *  @author Alif <rlchen at xbow.com.cn>  
-  */
  
  #include "XMTS300.h"
--- 1,2 ----
***************
*** 54,63 ****
  // sensorboard devices
    components new SensorMts300C();
-   components SounderC;
  
    TestMts300P -> MainC.Boot;
  
    TestMts300P.MTS300Timer -> MTS300Timer;
!   TestMts300P.Leds -> NoLedsC;
  
    // communication
--- 16,24 ----
  // sensorboard devices
    components new SensorMts300C();
  
    TestMts300P -> MainC.Boot;
  
    TestMts300P.MTS300Timer -> MTS300Timer;
!   TestMts300P.Leds -> LedsC;
  
    // communication
***************
*** 71,77 ****
  
    // sensor components
-   MainC.SoftwareInit -> SensorMts300C;
-   TestMts300P.MTS300Control -> SensorMts300C.StdControl;
    TestMts300P.Vref -> SensorMts300C.Vref;
    TestMts300P.Light -> SensorMts300C.Light;
    TestMts300P.Temp -> SensorMts300C.Temp;
--- 32,38 ----
  
    // sensor components
    TestMts300P.Vref -> SensorMts300C.Vref;
+   TestMts300P.Sounder -> SensorMts300C.Sounder;
+   
    TestMts300P.Light -> SensorMts300C.Light;
    TestMts300P.Temp -> SensorMts300C.Temp;
***************
*** 81,86 ****
    TestMts300P.MagX -> SensorMts300C.MagX;
    TestMts300P.MagY -> SensorMts300C.MagY;
- 
-   MainC.SoftwareInit -> SounderC;
-   TestMts300P.Sounder -> SounderC;
  }
--- 42,44 ----

Index: TestMts300P.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/mica2/mts300/TestMts300P.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TestMts300P.nc	15 Feb 2007 10:23:30 -0000	1.5
--- TestMts300P.nc	14 Mar 2007 03:22:37 -0000	1.6
***************
*** 1,41 ****
- // $Id$
- 
- /*
-  *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
-  *  downloading, copying, installing or using the software you agree to
-  *  this license.  If you do not agree to this license, do not download,
-  *  install, copy or use the software.
-  *
-  *  Copyright (c) 2004-2006 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 (updated) modification history and the author appear in
-  *  all copies of this source code.
-  *
-  *  Permission is also granted to distribute this software under the
-  *  standard BSD license as contained in the TinyOS distribution.
-  *
-  *  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 INTEL OR ITS
-  *  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.
-  */
- 
- /**
-  *  TinyOS 1.x to TinyOS 2.x translation layer.
-  *
-  *  @author Alif <rlchen at xbow.com.cn>  
-  */
-  
  #include "Timer.h"
  #include "XMTS300.h"
--- 1,2 ----
***************
*** 58,63 ****
      interface AMSend as UartSend;
      // sensor components
!     interface StdControl as MTS300Control;
!     interface StdControl as Sounder;
     	interface Read<uint16_t> as Vref; //!< voltage
      interface Read<uint16_t> as Light;
--- 19,23 ----
      interface AMSend as UartSend;
      // sensor components
!     interface Mts300Sounder as Sounder;
     	interface Read<uint16_t> as Vref; //!< voltage
      interface Read<uint16_t> as Light;
***************
*** 106,109 ****
--- 66,92 ----
    norace uint8_t accel_ave_points;
  
+ 
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ //  packet sending
+ //
+ //////////////////////////////////////////////////////////////////////////////
+   task void send_msg()
+   {
+     atomic packet_ready = FALSE;
+     // check length of the allocated buffer to see if it is enough for our packet
+     if (call RadioPacket.maxPayloadLength() < sizeof(Mts300Msg))
+     {
+       return ;
+     }
+     // OK, the buffer is large enough
+     //pMsg->vref = counter;
+     if (call UartSend.send(AM_BROADCAST_ADDR, &packet, sizeof(Mts300Msg)) == SUCCESS)
+     {
+       sending_packet = TRUE;
+       call Leds.led2On();
+     }
+   }
+ 
  //////////////////////////////////////////////////////////////////////////////
  //
***************
*** 144,150 ****
      if (err == SUCCESS)
      {
!       call MTS300Control.start();
!       call Sounder.start();
!       call MTS300Timer.startPeriodic( 300 );
      }
      else
--- 127,132 ----
      if (err == SUCCESS)
      {
!       call Sounder.beep(1000);
!       call MTS300Timer.startPeriodic( 1000 );
      }
      else
***************
*** 183,192 ****
  
      call Leds.led1Toggle();
-     counter++;
- 
-     if(counter==1)
-     {
-       call Sounder.stop();
-     }
  
      if (sending_packet) return ;
--- 165,168 ----
***************
*** 198,218 ****
        return ;
      }
- 
-     if (packet_ready)
-     {
-       atomic packet_ready = FALSE;
-       // check length of the allocated buffer to see if it is enough for our packet
-       if (call RadioPacket.maxPayloadLength() < sizeof(Mts300Msg))
-       {
-         return ;
-       }
-       // OK, the buffer is large enough
-       //pMsg->vref = counter;
-       if (call UartSend.send(AM_BROADCAST_ADDR, &packet, sizeof(Mts300Msg)) == SUCCESS)
-       {
-         sending_packet = TRUE;
-         call Leds.led2On();
-       }
-     }
    }
  
--- 174,177 ----
***************
*** 231,235 ****
        pMsg->vref = 0;
      }
- //    atomic packet_ready = TRUE;
        atomic state = STATE_LIGHT_START;
        call Light.read();
--- 190,193 ----
***************
*** 252,258 ****
      atomic state = STATE_TEMP_START;
      call Temp.read();
    }
  
- 
    /**
     * Temperature data read
--- 210,217 ----
      atomic state = STATE_TEMP_START;
      call Temp.read();
+ //    atomic state = STATE_MIC_START;
+ //    call Microphone.read();
    }
  
    /**
     * Temperature data read
***************
*** 346,350 ****
        pMsg->accelY = 0;
      }
- //    atomic packet_ready = TRUE;
      atomic state = STATE_MAGX_START;
      call MagX.read();
--- 305,308 ----
***************
*** 384,387 ****
--- 342,346 ----
      }
      atomic packet_ready = TRUE;
+     post send_msg();
    }
  



More information about the Tinyos-2-commits mailing list