[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/handhelds/tos/platform/shimmer BlueRadioC.nc, NONE, 1.1 CC2420LowLevelC.nc, NONE, 1.1 HPLUARTC.nc, NONE, 1.1 LedsC.nc, NONE, 1.1 SDC.nc, NONE, 1.1 hardware.h, NONE, 1.1

steve ayer ayer1 at users.sourceforge.net
Thu Aug 3 12:16:52 PDT 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/handhelds/tos/platform/shimmer
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv16969/tos/platform/shimmer

Added Files:
	BlueRadioC.nc CC2420LowLevelC.nc HPLUARTC.nc LedsC.nc SDC.nc 
	hardware.h 
Log Message:

added shimmer platform, including programming mods to bsl.py
interface and lib updates to DMA->ADC machinery, test code
added SD lib module, test code
updates telos_ap.c/Makefile to handle old (pre-2.6.15) and new kernel ip api 
commented out interrupt flag clearing in setmodespi in hplusart[0-1]m.nc, because this breaks some spi comm initializations
added telosb platform to handle interface skew between new (shimmer) and old (telosb) platforms


--- NEW FILE: BlueRadioC.nc ---
/**
 * Copyright (c) 2006 Intel 
 * 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 Hewlett-Packard Company 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.
 *
 * Author: Leonidas Kontothanassis (kthanasi at intel.com)
 * July 2006         
 *
 * Configuration of BlueRadios BR-C29 for Shimmer
 */

configuration BlueRadioC {
  provides interface BlueRadio;
}
implementation {
  components BlueRadioM, HPLUSART1M, MSP430InterruptM, MessagePoolM, TimerC;

  BlueRadio = BlueRadioM;

  BlueRadioM.HPLUSARTControl  -> HPLUSART1M;
  BlueRadioM.HPLUSARTFeedback  -> HPLUSART1M;
  BlueRadioM.Port14 -> MSP430InterruptM.Port14;
  BlueRadioM.MessagePool -> MessagePoolM;
  BlueRadioM.Timer -> TimerC.Timer[unique("Timer")];

}

--- NEW FILE: CC2420LowLevelC.nc ---
/**
 * Copyright (c) 2004,2005 Hewlett-Packard Company
 * 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 Hewlett-Packard Company 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.
 *
 * Abstraction interface for CC2420LowLevel
 */

configuration CC2420LowLevelC {
  provides { 
    interface StdControl;
    interface CC2420LowLevel;
    interface CC2420Interrupt as CC2420InterruptFIFO;
    interface CC2420Interrupt as CC2420InterruptFIFOP;
  }
}
implementation {
  components CC2420LowLevelM, HPLUSART1M, MSP430InterruptC;

  StdControl         = CC2420LowLevelM;
  CC2420LowLevel     = CC2420LowLevelM;
  CC2420InterruptFIFO  = CC2420LowLevelM.CC2420InterruptFIFO;
  CC2420InterruptFIFOP = CC2420LowLevelM.CC2420InterruptFIFOP;

  CC2420LowLevelM.USARTControl   -> HPLUSART1M;
  CC2420LowLevelM.FIFOPInterrupt -> MSP430InterruptC.Port26;
  CC2420LowLevelM.FIFOInterrupt  -> MSP430InterruptC.Port10;
}

--- NEW FILE: HPLUARTC.nc ---
// $Id: HPLUARTC.nc,v 1.1 2006/08/03 19:16:50 ayer1 Exp $

/*									tab:4
 * "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-2003 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.
 */
/*
 *
 * Authors:		Joe Polastre
 * Date last modified:  $Id: HPLUARTC.nc,v 1.1 2006/08/03 19:16:50 ayer1 Exp $
 *
 */

/**
 * UART configuration for HP Labs ZTAG
 * @author Jamey Hicks
 */

configuration HPLUARTC {
  provides interface HPLUART as UART;
}
implementation
{
  components HPLUARTM, HPLUSART0M as HPLUSART;

  UART=HPLUARTM;
  HPLUARTM.USARTControl -> HPLUSART;
  HPLUARTM.USARTData -> HPLUSART;
}


--- NEW FILE: LedsC.nc ---
// $Id: LedsC.nc,v 1.1 2006/08/03 19:16:50 ayer1 Exp $

/*									tab:4
 * "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-2003 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.
 */
/*
 *
 * Authors:		Jason Hill, David Gay, Philip Levis
 * Date last modified:  6/2/03
 *
 */

/**
 * @author Jason Hill
 * @author David Gay
 * @author Philip Levis
 * @author Jamey Hicks
 */

module LedsC {
  provides interface Leds;
}
implementation
{
  uint8_t ledsOn;

  enum {
    RED_BIT = 1,
    YELLOW_BIT = 2,
    ORANGE_BIT = 3,
    GREEN_BIT = 4
  };

  async command result_t Leds.init() {
    atomic {
      ledsOn = 0;
      //      dbg(DBG_BOOT, "LEDS: initialized.\n");
      TOSH_MAKE_RED_LED_OUTPUT();
      TOSH_SET_RED_LED_PIN();
      TOSH_MAKE_YELLOW_LED_OUTPUT();
      TOSH_SET_YELLOW_LED_PIN();
      TOSH_MAKE_GREEN_LED_OUTPUT();
      TOSH_SET_GREEN_LED_PIN();
      TOSH_MAKE_ORANGE_LED_OUTPUT();
      TOSH_SET_ORANGE_LED_PIN();
    }
    return SUCCESS;
  }

  async command result_t Leds.redOn() {
    atomic {
      TOSH_CLR_RED_LED_PIN();
      ledsOn |= RED_BIT;
    }
    return SUCCESS;
  }

  async command result_t Leds.redOff() {
    atomic {
      TOSH_SET_RED_LED_PIN();
      ledsOn &= ~RED_BIT;
    }
     return SUCCESS;
  }

  async command result_t Leds.redToggle() {
    result_t rval;
    atomic {
      if (ledsOn & RED_BIT)
	rval = call Leds.redOff();
      else
	rval = call Leds.redOn();
    }
   return rval;
  }

  async command result_t Leds.greenOn() {
    atomic {
      TOSH_CLR_GREEN_LED_PIN();
      ledsOn |= GREEN_BIT;
    }
    return SUCCESS;
  }

  async command result_t Leds.greenOff() {
    atomic {
      TOSH_SET_GREEN_LED_PIN();
      ledsOn &= ~GREEN_BIT;
    }
    return SUCCESS;
  }

  async command result_t Leds.greenToggle() {
    result_t rval;
    atomic {
      if (ledsOn & GREEN_BIT)
	rval = call Leds.greenOff();
      else
	rval = call Leds.greenOn();
    }
    return rval;

  }

  async command result_t Leds.yellowOn() {
    //    dbg(DBG_LED, "LEDS: Yellow on.\n");
    atomic {
      TOSH_CLR_YELLOW_LED_PIN();
      ledsOn |= YELLOW_BIT;
    }
    return SUCCESS;
  }

  async command result_t Leds.yellowOff() {
    //    dbg(DBG_LED, "LEDS: Yellow off.\n");
    atomic {
      TOSH_SET_YELLOW_LED_PIN();
      ledsOn &= ~YELLOW_BIT;
    }
    return SUCCESS;
  }

  async command result_t Leds.yellowToggle() {
    result_t rval;
    atomic {
      if (ledsOn & YELLOW_BIT)
	rval = call Leds.yellowOff();
      else
	rval = call Leds.yellowOn();
    }
    return rval;
  }
  
  async command result_t Leds.orangeOn() {
    atomic {
      TOSH_CLR_ORANGE_LED_PIN();
      ledsOn |= ORANGE_BIT;
    }
    return SUCCESS;
  }

  async command result_t Leds.orangeOff() {
    atomic {
      TOSH_SET_ORANGE_LED_PIN();
      ledsOn &= ~ORANGE_BIT;
    }
    return SUCCESS;
  }

  async command result_t Leds.orangeToggle() {
    result_t rval;
    atomic {
      if (ledsOn & ORANGE_BIT)
	rval = call Leds.orangeOff();
      else
	rval = call Leds.orangeOn();
    }
    return rval;

  }

  async command uint8_t Leds.get() {
    uint8_t rval;
    atomic {
      rval = ledsOn;
    }
    return rval;
  }
  
  async command result_t Leds.set(uint8_t ledsNum) {
    atomic {
      ledsOn = (ledsNum & 0x7);
      if (ledsOn & RED_BIT) 
	TOSH_CLR_RED_LED_PIN();
      else
	TOSH_SET_RED_LED_PIN();
      if (ledsOn & YELLOW_BIT ) 
	TOSH_CLR_YELLOW_LED_PIN();
      else 
	TOSH_SET_YELLOW_LED_PIN();
    }
    return SUCCESS;
  }
}

--- NEW FILE: SDC.nc ---
/**
 * Copyright (c) 2005 Hewlett-Packard Company
 * 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 Hewlett-Packard Company 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.
 *
 * communicate with a micro-sd slot wired to a telosb header
 */

configuration SDC {
  provides {
    interface StdControl;
    interface SD;
  }
}
implementation {
  components SD_M, HPLUSART0M, TimerC, LedsC;

  StdControl = SD_M;
  SD = SD_M;
  SD_M.USARTControl  -> HPLUSART0M;
  SD_M.Timer           -> TimerC.Timer[unique("Timer")];
  SD_M.Leds           -> LedsC;
}

--- NEW FILE: hardware.h ---
/*
 * Copyright (c) 2006, Intel 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 Intel 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 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.
 *
 * author: Steven Ayer
 *         June 2006
 */


#ifndef _H_hardware_h
#define _H_hardware_h

#include "msp430hardware.h"
#include "MSP430ADC12.h"

#include "CC2420Const.h"

#define SHIMMER 1


// LEDs
TOSH_ASSIGN_PIN(RED_LED,    4, 0);
TOSH_ASSIGN_PIN(ORANGE_LED, 4, 1);
TOSH_ASSIGN_PIN(YELLOW_LED, 4, 2);
TOSH_ASSIGN_PIN(GREEN_LED,  4, 3);

// CC2420 RADIO #defines
TOSH_ASSIGN_PIN(RADIO_FIFO,      1, 0);
TOSH_ASSIGN_PIN(RADIO_TIMED_SFD, 1, 2);
TOSH_ASSIGN_PIN(RADIO_FIFOP,     2, 6);
TOSH_ASSIGN_PIN(RADIO_CCA,       2, 7);

TOSH_ASSIGN_PIN(RADIO_1V8_EN,    4, 7);
TOSH_ASSIGN_PIN(RADIO_VREF,      5, 6);    // unused in shimmer

TOSH_ASSIGN_PIN(RADIO_SFD,       5, 0);
TOSH_ASSIGN_PIN(RADIO_SIMO1,     5, 1);
TOSH_ASSIGN_PIN(RADIO_SOMI1,     5, 2);
TOSH_ASSIGN_PIN(RADIO_CSN,       5, 4);
TOSH_ASSIGN_PIN(RADIO_RESET,     5, 7);

// BT pins
TOSH_ASSIGN_PIN(BT_PIO,          1, 5);
TOSH_ASSIGN_PIN(BT_RTS,          1, 6);
TOSH_ASSIGN_PIN(BT_CTS,          1, 7);
TOSH_ASSIGN_PIN(BT_TXD,          3, 6);
TOSH_ASSIGN_PIN(BT_RXD,          3, 7);
TOSH_ASSIGN_PIN(BT_RESET,        5, 5);

//BSL Pins
TOSH_ASSIGN_PIN(PROG_OUT,  1, 1);
TOSH_ASSIGN_PIN(PROG_IN,   2, 2);

// SD uart chip-select
TOSH_ASSIGN_PIN(SD_CS_N, 3, 0);

// ADC lines on the testpoints
TOSH_ASSIGN_PIN(ADC_0, 6, 0);
TOSH_ASSIGN_PIN(ADC_1, 6, 1);
TOSH_ASSIGN_PIN(ADC_2, 6, 2);

TOSH_ASSIGN_PIN(ADC_ACCELZ, 6, 3);
TOSH_ASSIGN_PIN(ADC_ACCELY,  6, 4);
TOSH_ASSIGN_PIN(ADC_ACCELX, 6, 5);

TOSH_ASSIGN_PIN(DAC0_AN, 6, 6);
TOSH_ASSIGN_PIN(DAC1_AN, 6, 7);


// UART pins
// SPI1 attached to bt, cc2420
TOSH_ASSIGN_PIN(UCLK1, 5, 3);
TOSH_ASSIGN_PIN(SOMI1, 5, 2);
TOSH_ASSIGN_PIN(SIMO1, 5, 1);

// used as GPIOs
TOSH_ASSIGN_PIN(UCLK0, 3, 3);
TOSH_ASSIGN_PIN(SOMI0, 3, 2);
TOSH_ASSIGN_PIN(SIMO0, 3, 1);

// connected to ftdi
TOSH_ASSIGN_PIN(UTXD0, 3, 4);
TOSH_ASSIGN_PIN(URXD0, 3, 5);
TOSH_ASSIGN_PIN(UTXD1, 3, 6);
TOSH_ASSIGN_PIN(URXD1, 3, 7);



// GIO pins
TOSH_ASSIGN_PIN(SER0_RTS, 1, 3);
TOSH_ASSIGN_PIN(SER0_CTS, 1, 4);


TOSH_ASSIGN_PIN(GIO0, 2, 0);
TOSH_ASSIGN_PIN(GIO1, 2, 1);


// 1-Wire
TOSH_ASSIGN_PIN(ONEWIRE_PWR,  2, 3);
TOSH_ASSIGN_PIN(ONEWIRE, 2, 4);

// ACCEL
TOSH_ASSIGN_PIN(ACCEL_SEL0_N,  4, 3);
TOSH_ASSIGN_PIN(ACCEL_SEL1_N,  4, 4);
TOSH_ASSIGN_PIN(ACCEL_SLEEP_N, 4, 5);


void TOSH_SET_PIN_DIRECTIONS(void)
{
  // Prog Pins tristate em
  TOSH_MAKE_PROG_IN_INPUT();
  TOSH_MAKE_PROG_OUT_INPUT();
  
  //LEDS
  TOSH_SET_RED_LED_PIN();
  TOSH_SET_YELLOW_LED_PIN();
  TOSH_SET_ORANGE_LED_PIN();
  TOSH_SET_GREEN_LED_PIN();
  TOSH_MAKE_RED_LED_OUTPUT();
  TOSH_MAKE_YELLOW_LED_OUTPUT();
  TOSH_MAKE_ORANGE_LED_OUTPUT();
  TOSH_MAKE_GREEN_LED_OUTPUT();

    //RADIO PINS
  //CC2420 pins
  TOSH_MAKE_RADIO_RESET_OUTPUT();
  TOSH_SET_RADIO_RESET_PIN();

  TOSH_MAKE_RADIO_1V8_EN_OUTPUT();
  TOSH_CLR_RADIO_1V8_EN_PIN();

  TOSH_MAKE_RADIO_CSN_OUTPUT();
  TOSH_CLR_RADIO_CSN_PIN();

  TOSH_MAKE_RADIO_CCA_INPUT();
  TOSH_MAKE_RADIO_FIFO_INPUT();
  TOSH_MAKE_RADIO_FIFOP_INPUT();
  TOSH_MAKE_RADIO_SFD_INPUT();

  TOSH_MAKE_ONEWIRE_PWR_OUTPUT();
  TOSH_SET_ONEWIRE_PWR_PIN();

  TOSH_MAKE_SD_CS_N_OUTPUT();
  TOSH_SET_SD_CS_N_PIN();

  TOSH_MAKE_BT_RESET_OUTPUT();  
  TOSH_SET_BT_RESET_PIN();

  TOSH_MAKE_BT_RTS_INPUT();      
  TOSH_SEL_BT_RTS_IOFUNC();

  TOSH_MAKE_BT_CTS_OUTPUT();      
  TOSH_SEL_BT_CTS_IOFUNC();

  // ADC lines
  TOSH_MAKE_ADC_0_INPUT();
  TOSH_MAKE_ADC_1_INPUT();
  TOSH_MAKE_ADC_2_INPUT();
  
  TOSH_MAKE_ADC_ACCELZ_INPUT();
  TOSH_MAKE_ADC_ACCELY_INPUT();
  TOSH_MAKE_ADC_ACCELX_INPUT();
  
}

#endif // _H_hardware_h




More information about the Tinyos-contrib-commits mailing list