[Tinyos-2-commits] CVS: tinyos-2.x/tos/sensorboards/im2sb LIS3L02DQC.nc, NONE, 1.1.2.1 LIS3L02DQInternalC.nc, NONE, 1.1.2.1 LIS3L02DQInternalP.nc, NONE, 1.1.2.1 MAX136xC.nc, NONE, 1.1.2.1 MAX136xInternalC.nc, NONE, 1.1.2.1 MAX136xInternalP.nc, NONE, 1.1.2.1 TMP175C.nc, NONE, 1.1.2.1 TMP175InternalC.nc, NONE, 1.1.2.1 TMP175InternalP.nc, NONE, 1.1.2.1 im2sb.h, 1.1.2.1, 1.1.2.2

Philip Buonadonna philipb at users.sourceforge.net
Thu Jul 6 16:23:43 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/im2sb
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv9169

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	im2sb.h 
Added Files:
      Tag: tinyos-2_0_devel-BRANCH
	LIS3L02DQC.nc LIS3L02DQInternalC.nc LIS3L02DQInternalP.nc 
	MAX136xC.nc MAX136xInternalC.nc MAX136xInternalP.nc TMP175C.nc 
	TMP175InternalC.nc TMP175InternalP.nc 
Log Message:
Updated support for IntelMote2 Sensor Board.

--- NEW FILE: LIS3L02DQC.nc ---
/* $Id: LIS3L02DQC.nc,v 1.1.2.1 2006/07/06 23:23:41 philipb Exp $ */
/*
 * Copyright (c) 2005 Arch Rock Corporation 
 * 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 Arch Rock Corporation 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 ARCHED
 * ROCK 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.
 */
/**
 *
 * @author Kaisen Lin
 * @author Phil Buonadonna
 */

#include "im2sb.h"

generic configuration LIS3L02DQC() {
  //provides interface Init;
  provides interface SplitControl;
  provides interface Read<uint16_t> as AccelX;
  provides interface Read<uint16_t> as AccelY;
  provides interface Read<uint16_t> as AccelZ;
  provides interface HalLIS3L02DQAdvanced;
}

implementation {
  components new HalLIS3L02DQReaderP();
  components HalLIS3L02DQControlP;
  AccelX = HalLIS3L02DQReaderP.AccelX;
  AccelY = HalLIS3L02DQReaderP.AccelY;
  AccelZ = HalLIS3L02DQReaderP.AccelZ;
  HalLIS3L02DQAdvanced = HalLIS3L02DQControlP.Advanced;
  
  enum { ACCELX_KEY = unique("LIS3L02DQ.Resource"),
	 ACCELY_KEY = unique("LIS3L02DQ.Resource"),
	 ACCELZ_KEY = unique("LIS3L02DQ.Resource"),
	 ADV_KEY = unique("LIS3L02DQ.Resource"),
	 READER_ID = unique("LIS3L02DQ.HplAccess"),
  };

  components LIS3L02DQInternalC;
  HalLIS3L02DQReaderP.AccelXResource -> LIS3L02DQInternalC.Resource[ACCELX_KEY];
  HalLIS3L02DQReaderP.AccelYResource -> LIS3L02DQInternalC.Resource[ACCELY_KEY];
  HalLIS3L02DQReaderP.AccelZResource -> LIS3L02DQInternalC.Resource[ACCELZ_KEY];
  HalLIS3L02DQControlP.Resource -> LIS3L02DQInternalC.Resource[ADV_KEY];
  HalLIS3L02DQReaderP.Hpl -> LIS3L02DQInternalC.HplLIS3L02DQ[READER_ID];

  SplitControl = LIS3L02DQInternalC;
}

--- NEW FILE: LIS3L02DQInternalC.nc ---
/* $Id: LIS3L02DQInternalC.nc,v 1.1.2.1 2006/07/06 23:23:41 philipb Exp $ */
/*
 * Copyright (c) 2005 Arch Rock Corporation 
 * 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 Arch Rock Corporation 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 ARCHED
 * ROCK 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.
 */
/**
 *
 * @author Kaisen Lin
 * @author Phil Buonadonna
 */

#include "im2sb.h"

configuration LIS3L02DQInternalC {
  provides interface Resource[uint8_t id];
  provides interface HplLIS3L02DQ[uint8_t id];
  provides interface SplitControl;
}

implementation {
  components new FcfsArbiterC( "LIS3L02DQ.Resource" ) as Arbiter;
  components MainC;
  Resource = Arbiter;
  MainC.SoftwareInit -> Arbiter;

  components HplLIS3L02DQLogicSPIP as Logic;
  MainC.SoftwareInit -> Logic;

  components HplPXA27xSSP1C;
  // 0: Motorola SPI
  // 3: random guess what SSP Clock Rate should be
  // 7: 8 bit data size OR 15: 16 bit data size?
  // FALSE: No "Receive without transmit"
  components new HalPXA27xSpiPioM(0, 128, 7, FALSE) as HalSpi;
  HalSpi.SSP -> HplPXA27xSSP1C;
  MainC.SoftwareInit -> HalSpi;
  Logic.SpiPacket -> HalSpi.SpiPacket[unique("SPIInstance")];

  components LIS3L02DQInternalP as Internal;
  HplLIS3L02DQ = Internal;
  Internal.ToHPLC -> Logic.HplLIS3L02DQ;
  
  SplitControl = Logic;

  components HplPXA27xGPIOC;
  Logic.SPICLK -> HplPXA27xGPIOC.HplPXA27xGPIOPin[SSP1_SCLK];
  Logic.SPIFRM -> HplPXA27xGPIOC.HplPXA27xGPIOPin[SSP1_SFRM];
  Logic.SPIRxD -> HplPXA27xGPIOC.HplPXA27xGPIOPin[SSP1_RXD];
  Logic.SPITxD -> HplPXA27xGPIOC.HplPXA27xGPIOPin[SSP1_TXD];

  components HalLIS3L02DQControlP as Control;
  Control.Hpl -> Logic;
  
}

--- NEW FILE: LIS3L02DQInternalP.nc ---
/* $Id: LIS3L02DQInternalP.nc,v 1.1.2.1 2006/07/06 23:23:41 philipb Exp $ */
/*
 * Copyright (c) 2005 Arch Rock Corporation 
 * 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 Arch Rock Corporation 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 ARCHED
 * ROCK 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.
 */
/**
 * This Hal module implements the TinyOS 2.0 I2CPacket interface over
 * the PXA27x I2C Hpl
 *
 * @author Kaisen Lin
 * @author Phil Buonadonna
 */

module LIS3L02DQInternalP {
  provides interface HplLIS3L02DQ[uint8_t id];
  uses interface HplLIS3L02DQ as ToHPLC;
}

implementation {
  uint8_t currentId;

  command error_t HplLIS3L02DQ.getReg[uint8_t id](uint8_t regAddr) {
    currentId = id;
    return call ToHPLC.getReg(regAddr);
  }
  command error_t HplLIS3L02DQ.setReg[uint8_t id](uint8_t regAddr, uint8_t val) {
    currentId = id;
    return call ToHPLC.setReg(regAddr, val);
  }
  async event void ToHPLC.getRegDone(error_t error, uint8_t regAddr, uint8_t val) {
    signal HplLIS3L02DQ.getRegDone[currentId](error, regAddr, val);
  }
  async event void ToHPLC.setRegDone(error_t error, uint8_t regAddr, uint8_t val) {
    signal HplLIS3L02DQ.setRegDone[currentId](error, regAddr, val);
  }
  async event void ToHPLC.alertThreshold() {
    signal HplLIS3L02DQ.alertThreshold[currentId]();
  }

  default async event void HplLIS3L02DQ.getRegDone[uint8_t id](error_t error, uint8_t regAddr, uint8_t val) { }
  default async event void HplLIS3L02DQ.setRegDone[uint8_t id](error_t error, uint8_t regAddr, uint8_t val) { }
}

--- NEW FILE: MAX136xC.nc ---
/* $Id: MAX136xC.nc,v 1.1.2.1 2006/07/06 23:23:41 philipb Exp $ */
/*
 * Copyright (c) 2005 Arch Rock Corporation 
 * 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 Arch Rock Corporation 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 ARCHED
 * ROCK 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.
 */
/**
 *
 * @author Kaisen Lin
 * @author Phil Buonadonna
 */

#include "im2sb.h"
#include "MAX136x.h"

generic configuration MAX136xC() {
  provides interface Read<max136x_data_t> as ADC;
  provides interface HalMAX136xAdvanced;
  provides interface SplitControl;
}

implementation {
  components new HalMAX136xReaderP();
  components HalMAX136xControlP;

  ADC = HalMAX136xReaderP.ADC;

  enum { ADC_KEY = unique("MAX136x.Resource"),
	 ADV_KEY = unique("MAX136x.Resource"),
	 READER_ID = unique("MAX136x.HplAccess"),
  };

  components MAX136xInternalC;
  HalMAX136xReaderP.MAX136xResource -> MAX136xInternalC.Resource[ADC_KEY];
  HalMAX136xReaderP.HplMAX136x -> MAX136xInternalC.HplMAX136x[READER_ID];
  HalMAX136xControlP.Resource -> MAX136xInternalC.Resource[ADV_KEY];
  HalMAX136xAdvanced = HalMAX136xControlP;

  SplitControl = MAX136xInternalC;
}

--- NEW FILE: MAX136xInternalC.nc ---
/* $Id: MAX136xInternalC.nc,v 1.1.2.1 2006/07/06 23:23:41 philipb Exp $ */
/*
 * Copyright (c) 2005 Arch Rock Corporation 
 * 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 Arch Rock Corporation 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 ARCHED
 * ROCK 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.
 */
/**
 *
 * @author Kaisen Lin
 * @author Phil Buonadonna
 */
#include "im2sb.h"

configuration MAX136xInternalC {
  provides interface Resource[uint8_t id];
  provides interface HplMAX136x[uint8_t id];
  provides interface SplitControl;
}

implementation {
  components new FcfsArbiterC( "MAX136x.Resource" )as Arbiter;
  components MainC;
  Resource = Arbiter;
  MainC.SoftwareInit -> Arbiter;

  components new HplMAX136xLogicP(MAX136_SLAVE_ADDR) as Logic;
  MainC.SoftwareInit -> Logic;

  components HalPXA27xI2CMasterC as I2CC;
  Logic.I2CPacket -> I2CC;

  components MAX136xInternalP as Internal;
  HplMAX136x = Internal.HplMAX136x;
  Internal.ToHPLC -> Logic.HplMAX136x;

  SplitControl = Logic;

  components HplPXA27xGPIOC;
  I2CC.I2CSCL -> HplPXA27xGPIOC.HplPXA27xGPIOPin[I2C_SCL];
  I2CC.I2CSDA -> HplPXA27xGPIOC.HplPXA27xGPIOPin[I2C_SDA];
  
  components HalMAX136xControlP;
  HalMAX136xControlP.HplMAX136x -> Logic;
}

--- NEW FILE: MAX136xInternalP.nc ---
/* $Id: MAX136xInternalP.nc,v 1.1.2.1 2006/07/06 23:23:41 philipb Exp $ */
/*
 * Copyright (c) 2005 Arch Rock Corporation 
 * 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 Arch Rock Corporation 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 ARCHED
 * ROCK 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.
 */
/**
 *
 * @author Kaisen Lin
 * @author Phil Buonadonna
 */
module MAX136xInternalP {
  provides interface HplMAX136x[uint8_t id];
  uses interface HplMAX136x as ToHPLC;
}

implementation {
  uint8_t currentId;

  command error_t HplMAX136x.measureChannels[uint8_t id](uint8_t *buf, uint8_t len) {
    currentId = id;
    return call ToHPLC.measureChannels(buf, len);
  }
  command error_t HplMAX136x.setConfig[uint8_t id](uint8_t *cfgbuf, uint8_t len) {
    currentId = id;
    return call ToHPLC.setConfig(cfgbuf, len);
  }
  async event void ToHPLC.measureChannelsDone(error_t error, uint8_t *buf, uint8_t len) {
    signal HplMAX136x.measureChannelsDone[currentId](error, buf, len);
  }
  async event void ToHPLC.setConfigDone(error_t error, uint8_t *cfgbuf, uint8_t len) {
    signal HplMAX136x.setConfigDone[currentId](error, cfgbuf, len);
  }
  async event void ToHPLC.alertThreshold() {
    signal HplMAX136x.alertThreshold[currentId]();
  }


  default async event void HplMAX136x.measureChannelsDone[uint8_t id]( error_t error, uint8_t *buf, uint8_t len ) {}
  default async event void HplMAX136x.setConfigDone[uint8_t id]( error_t error , uint8_t *cfgbuf, uint8_t len) {}
  default async event void HplMAX136x.alertThreshold[uint8_t id]() {}
}

--- NEW FILE: TMP175C.nc ---
/* $Id: TMP175C.nc,v 1.1.2.1 2006/07/06 23:23:41 philipb Exp $ */
/*
 * Copyright (c) 2005 Arch Rock Corporation 
 * 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 Arch Rock Corporation 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 ARCHED
 * ROCK 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.
 */
/**
 *
 * @author Kaisen Lin
 * @author Phil Buonadonna
 */
#include "im2sb.h"

generic configuration TMP175C() {
  provides interface Read<uint16_t> as Temperature;
  provides interface HalTMP175Advanced;
  provides interface SplitControl;
  //provides interface Init;
}

implementation {
  components new HalTMP175ReaderP();
  components HalTMP175ControlP;
  Temperature = HalTMP175ReaderP.Temperature;

  enum { TMP_KEY = unique("TMP175.Resource"),
	 ADV_KEY = unique("TMP175.Resource"),
	 READER_ID = unique("TMP175.HplAccess"),
  };

  components TMP175InternalC;
  HalTMP175ReaderP.TMP175Resource -> TMP175InternalC.Resource[TMP_KEY];
  HalTMP175ControlP.TMP175Resource -> TMP175InternalC.Resource[ADV_KEY];
  HalTMP175ReaderP.HplTMP175 -> TMP175InternalC.HplTMP175[READER_ID];
  HalTMP175Advanced = HalTMP175ControlP.HalTMP175Advanced;

  SplitControl = TMP175InternalC;
}

--- NEW FILE: TMP175InternalC.nc ---
/* $Id: TMP175InternalC.nc,v 1.1.2.1 2006/07/06 23:23:41 philipb Exp $ */
/*
 * Copyright (c) 2005 Arch Rock Corporation 
 * 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 Arch Rock Corporation 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 ARCHED
 * ROCK 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.
 */
/**
 *
 * @author Kaisen Lin
 * @author Phil Buonadonna
 */
#include "im2sb.h"

configuration TMP175InternalC {
  provides interface Resource[uint8_t id];
  provides interface HplTMP175[uint8_t id];
  provides interface SplitControl;
}

implementation {
  enum {
    ADV_ID = unique("TMP175.HplAccess"),
  };
  
  components new FcfsArbiterC( "TMP175.Resource" ) as Arbiter;
  components MainC;
  Resource = Arbiter;
  MainC.SoftwareInit -> Arbiter;

  components new HplTMP175LogicP(TMP175_SLAVE_ADDR) as Logic;
  MainC.SoftwareInit -> Logic;

  components GeneralIOC;
  Logic.AlertInterrupt -> GeneralIOC.GpioInterrupt[GPIO_TMP175_TEMP_ALERT];
  Logic.InterruptPin -> GeneralIOC.GeneralIO[GPIO_TMP175_TEMP_ALERT];

  components HalPXA27xI2CMasterC as I2CC;
  Logic.I2CPacket -> I2CC;

  components TMP175InternalP as Internal;
  HplTMP175 = Internal.HplTMP175;
  Internal.ToHPLC -> Logic.HplTMP175;

  SplitControl = Logic;

  components HplPXA27xGPIOC;
  I2CC.I2CSCL -> HplPXA27xGPIOC.HplPXA27xGPIOPin[I2C_SCL];
  I2CC.I2CSDA -> HplPXA27xGPIOC.HplPXA27xGPIOPin[I2C_SDA];

  components HalTMP175ControlP;
  HalTMP175ControlP.HplTMP175 -> Logic;
  
}

--- NEW FILE: TMP175InternalP.nc ---
/* $Id: TMP175InternalP.nc,v 1.1.2.1 2006/07/06 23:23:41 philipb Exp $ */
/*
 * Copyright (c) 2005 Arch Rock Corporation 
 * 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 Arch Rock Corporation 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 ARCHED
 * ROCK 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.
 */
/**
 *
 * @author Kaisen Lin
 * @author Phil Buonadonna
 */
module TMP175InternalP {
  provides interface HplTMP175[uint8_t id];
  uses interface HplTMP175 as ToHPLC;
}

implementation {
  uint8_t currentId;

  command error_t HplTMP175.measureTemperature[uint8_t id]() {
    currentId = id;
    return call ToHPLC.measureTemperature();
  }
  command error_t HplTMP175.setConfigReg[uint8_t id](uint8_t val) {
    currentId = id;
    return call ToHPLC.setConfigReg(val);
  }
  command error_t HplTMP175.setTLowReg[uint8_t id](uint16_t val) {
    currentId = id;
    return call ToHPLC.setTLowReg(val);
  }
  command error_t HplTMP175.setTHighReg[uint8_t id](uint16_t val) {
    currentId = id;
    return call ToHPLC.setTHighReg(val);
  }

  async event void ToHPLC.measureTemperatureDone(error_t error, uint16_t val) {
    signal HplTMP175.measureTemperatureDone[currentId](error, val);
  }
  async event void ToHPLC.setConfigRegDone(error_t error) {
    signal HplTMP175.setConfigRegDone[currentId](error);
  }
  async event void ToHPLC.setTLowRegDone(error_t error) {
    signal HplTMP175.setTLowRegDone[currentId](error);
  }
  async event void ToHPLC.setTHighRegDone(error_t error) {
    signal HplTMP175.setTHighRegDone[currentId](error);
  }
  async event void ToHPLC.alertThreshold() {
    signal HplTMP175.alertThreshold[currentId]();
  }

  default async event void HplTMP175.measureTemperatureDone[uint8_t id](error_t error, uint16_t val) { return; }
  default async event void HplTMP175.setConfigRegDone[uint8_t id](error_t error) { return; }
  default async event void HplTMP175.setTLowRegDone[uint8_t id](error_t error) { return; }
  default async event void HplTMP175.setTHighRegDone[uint8_t id](error_t error) { return; }
  default async event void HplTMP175.alertThreshold[uint8_t id]() { return; }
}

Index: im2sb.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/im2sb/Attic/im2sb.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** im2sb.h	31 May 2006 22:15:13 -0000	1.1.2.1
--- im2sb.h	6 Jul 2006 23:23:41 -0000	1.1.2.2
***************
*** 48,50 ****
--- 48,54 ----
  #define GPIO_TMP175_TEMP_ALERT		(96)
  
+ #define TSL2561_SLAVE_ADDR (0x49)
+ #define TMP175_SLAVE_ADDR (0x48)
+ #define MAX136_SLAVE_ADDR (0x35)
+ 
  #endif /* _IM2SB_H */



More information about the Tinyos-2-commits mailing list