[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/handhelds/tos/platform/shimmer2 .platform, NONE, 1.1 CC2420LowLevelC.nc, NONE, 1.1 HPLUARTC.nc, NONE, 1.1 RovingNetworksC.nc, NONE, 1.1 SDC.nc, NONE, 1.1 TLV2548_ADCC.nc, NONE, 1.1 UserButtonC.nc, NONE, 1.1 hardware.h, NONE, 1.1

steve ayer ayer1 at users.sourceforge.net
Tue Jan 22 12:26:13 PST 2008


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

Added Files:
	.platform CC2420LowLevelC.nc HPLUARTC.nc RovingNetworksC.nc 
	SDC.nc TLV2548_ADCC.nc UserButtonC.nc hardware.h 
Log Message:

first public release of impending new platform, SHIMMER2, which
enhances the SHIMMER model by the addition of h/w features that turn
it into an sd dongle when docked on the new programming/charging
dock.  power-saving features allow for power-off of bt module and sd
as well.  tilt switch was added.  


--- NEW FILE: .platform ---
@opts = ("-gcc=msp430-gcc",
         "-mmcu=msp430x1611",
         "-fnesc-target=msp430",
         "-fnesc-no-debug");

@commonplatforms = ("msp430_crl_base","msp430");


--- 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.Port12;
  CC2420LowLevelM.FIFOInterrupt  -> MSP430InterruptC.Port15;
}

--- NEW FILE: HPLUARTC.nc ---
// $Id: HPLUARTC.nc,v 1.1 2008/01/22 20:26:11 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 2008/01/22 20:26:11 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: RovingNetworksC.nc ---
/*
 * Copyright (c) 2007, 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:  Steve Ayer
 *           February, 2007
 */


configuration RovingNetworksC {
  provides {
    interface StdControl;
    interface Bluetooth;
  }
}
implementation {
  components RovingNetworksM, MSP430InterruptM, MessagePoolM, HPLUSART1M, TimerC, LedsC;

  StdControl = RovingNetworksM;
  Bluetooth = RovingNetworksM;
  RovingNetworksM.UARTControl     -> HPLUSART1M;
  RovingNetworksM.UARTData        -> HPLUSART1M;
  RovingNetworksM.RTSInterrupt     -> MSP430InterruptM.Port16;
  RovingNetworksM.ConnectionInterrupt -> MSP430InterruptM.Port26;
  RovingNetworksM.MessagePool      -> MessagePoolM;
  RovingNetworksM.Leds             -> LedsC;
}

--- NEW FILE: SDC.nc ---
/*
 * 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: Steve Ayer
 *          July, 2006
 *
 * communicate with a micro-sd slot resident on shimmer
 */

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

  StdControl = SD_M;
  SD = SD_M;
  SD_M.USARTControl  -> HPLUSART0M;
  SD_M.DockInterrupt   -> MSP430InterruptC.Port23;
  SD_M.Leds           -> LedsC;
}

--- NEW FILE: TLV2548_ADCC.nc ---
/*
 * Copyright (c) 2007, 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: Steve Ayer
 *          October, 2007
 *
 */

configuration TLV2548_ADCC {
  provides {
    interface StdControl;
    interface TLV2548_ADC;
  }
  //  uses interface MSP430Interrupt as ADCInterrupt;
}
implementation {
  components TLV2548_ADCM, MSP430InterruptC, HPLUSART0M, TimerC;

  StdControl = TLV2548_ADCM;
  TLV2548_ADC = TLV2548_ADCM;

  TLV2548_ADCM.USARTControl  -> HPLUSART0M;
  TLV2548_ADCM.Timer         -> TimerC.Timer[unique("Timer")];
  
  TLV2548_ADCM.ADCInterrupt  -> MSP430InterruptC.Port24;
}

--- NEW FILE: UserButtonC.nc ---
//$Id: UserButtonC.nc,v 1.1 2008/01/22 20:26:11 ayer1 Exp $

/* "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."
 */

/**
 * Init/start/stop the user button with StdControl and get interrupt events
 * when the button is released with MSP430Event.
 *
 * @author Cory Sharp <cssharp at eecs.berkeley.edu>
 * @author Andrew Redfern <aredfern at kingkong.me.berkeley.edu>
 */

/**
 * SHIMMER doesn't have a userbutton on the device itself, but the
 * programming board does have a user button which can be accessed
 * when the SHIMMER is docked.
 */

configuration UserButtonC
{
  provides interface StdControl;
  provides interface MSP430Event as UserButton;
}
implementation
{
  components UserButtonM, 
    MSP430GeneralIOC, 
    MSP430InterruptC, 
    TimerC;

  // TimerC must be initialized!

  StdControl = UserButtonM;
  UserButton = UserButtonM;

  UserButtonM.MSP430Interrupt -> MSP430InterruptC.Port20;
  UserButtonM.MSP430GeneralIO -> MSP430GeneralIOC.Port20;
  UserButtonM -> TimerC.Timer[unique("Timer")];
}

--- NEW FILE: hardware.h ---
/*
 * Copyright (c) 2007, 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
 *         July 2007
 */


#ifndef _H_hardware_h
#define _H_hardware_h

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

#include "CC2420Const.h"


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

// CC2420 RADIO
TOSH_ASSIGN_PIN(RADIO_FIFO,  1, 5);
TOSH_ASSIGN_PIN(RADIO_FIFOP, 1, 2);
TOSH_ASSIGN_PIN(RADIO_CCA,   2, 7);

// vref is legacy from telos and cc2420 lib; schematic and cc2420 pin say vreg_en
TOSH_ASSIGN_PIN(RADIO_VREF,  5, 6);   

TOSH_ASSIGN_PIN(RADIO_SFD,   1, 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,      2, 6);
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);

TOSH_ASSIGN_PIN(VSENSE_REG,   6, 0);

TOSH_ASSIGN_PIN(TILT,  2, 4);

// 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_6, 6, 6);
TOSH_ASSIGN_PIN(ADC_7, 6, 7);

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);

TOSH_ASSIGN_PIN(VSENSE_ADC6, 6, 6);
TOSH_ASSIGN_PIN(VSENSE_ADC7,  6, 7);

/* OSRAM OLED Calgary
 *  old assignments; can't be used
 *  TOSH_ASSIGN_PIN(LCD_RESET_L, 6, 1);   //  aka adc_1
 *  TOSH_ASSIGN_PIN(LCD_CS_N,  6, 2);   //  aka adc_2
 *  TOSH_ASSIGN_PIN(LCD_REG_ENABLE,  6, 6);   //  aka adc_2
 *  TOSH_ASSIGN_PIN(LCD_CMD_L,   1, 1);   //  aka bsl_tx (prog_out)
*/

// bus arbitration pins
TOSH_ASSIGN_PIN(SW_SD_PWR_N, 4, 5);
TOSH_ASSIGN_PIN(SW_BT_PWR_N, 4, 6);

// if used as expansion GPIOs
TOSH_ASSIGN_PIN(SER0_RTS, 1, 3);
TOSH_ASSIGN_PIN(SER0_CTS, 1, 4);

TOSH_ASSIGN_PIN(SIMO0, 3, 1);
TOSH_ASSIGN_PIN(SOMI0, 3, 2);
TOSH_ASSIGN_PIN(UCLK0, 3, 3);
TOSH_ASSIGN_PIN(UTXD0, 3, 4);
TOSH_ASSIGN_PIN(URXD0, 3, 5);

TOSH_ASSIGN_PIN(SIMO1, 5, 1);
TOSH_ASSIGN_PIN(SOMI1, 5, 2);
TOSH_ASSIGN_PIN(UCLK1, 5, 3);
TOSH_ASSIGN_PIN(UTXD1, 3, 6);
TOSH_ASSIGN_PIN(URXD1, 3, 7);

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

// 1-Wire
TOSH_ASSIGN_PIN(ONEWIRE, 4, 7);

// ROSC
TOSH_ASSIGN_PIN(ROSC, 2, 5);

// docked signal from programming board
TOSH_ASSIGN_PIN(DOCK_N, 2, 3);

// ACCEL
TOSH_ASSIGN_PIN(ACCEL_SEL0,  4, 1);
TOSH_ASSIGN_PIN(ACCEL_SEL1,  4, 4);
TOSH_ASSIGN_PIN(ACCEL_SLEEP_N, 5, 0);

void TOSH_SET_PIN_DIRECTIONS(void)
{
  //LEDS
  TOSH_SEL_RED_LED_IOFUNC();
  TOSH_MAKE_RED_LED_OUTPUT();
  TOSH_SEL_YELLOW_LED_IOFUNC();
  TOSH_MAKE_YELLOW_LED_OUTPUT();
  TOSH_SEL_GREEN_LED_IOFUNC();
  TOSH_MAKE_GREEN_LED_OUTPUT();

    //RADIO PINS
  //CC2420 pins
  TOSH_MAKE_RADIO_VREF_OUTPUT();
  TOSH_SEL_RADIO_VREF_IOFUNC();
  TOSH_CLR_RADIO_VREF_PIN();    // power down 

  TOSH_MAKE_RADIO_CSN_OUTPUT();
  TOSH_SEL_RADIO_CSN_IOFUNC();
  TOSH_SET_RADIO_CSN_PIN();

  // should be reset_n
  TOSH_MAKE_RADIO_RESET_OUTPUT();
  TOSH_SEL_RADIO_RESET_IOFUNC();
  TOSH_CLR_RADIO_RESET_PIN();

  TOSH_SEL_RADIO_CCA_IOFUNC();
  TOSH_MAKE_RADIO_CCA_OUTPUT();
  TOSH_SEL_RADIO_FIFO_IOFUNC();
  TOSH_MAKE_RADIO_FIFO_OUTPUT();
  TOSH_SEL_RADIO_FIFOP_IOFUNC();
  TOSH_MAKE_RADIO_FIFOP_OUTPUT();
  TOSH_SEL_RADIO_SFD_IOFUNC();
  TOSH_MAKE_RADIO_SFD_OUTPUT();

  TOSH_SEL_SD_CS_N_IOFUNC();
  TOSH_MAKE_SD_CS_N_OUTPUT();
  TOSH_SET_SD_CS_N_PIN();

  // BT PINS
  TOSH_MAKE_BT_RESET_OUTPUT();  
  TOSH_SEL_BT_RESET_IOFUNC();    
  TOSH_CLR_BT_RESET_PIN();   // mitsumi module disabled by clr

  TOSH_MAKE_BT_RTS_OUTPUT();      
  TOSH_SEL_BT_RTS_IOFUNC();

  TOSH_MAKE_BT_PIO_OUTPUT();
  TOSH_SEL_BT_PIO_IOFUNC();

  TOSH_MAKE_BT_CTS_OUTPUT();
  TOSH_SEL_BT_CTS_IOFUNC();

  TOSH_MAKE_BT_TXD_OUTPUT();
  TOSH_SEL_BT_TXD_MODFUNC();

  TOSH_MAKE_BT_RXD_OUTPUT();
  TOSH_SEL_BT_RXD_IOFUNC();

  // BSL Prog Pins tristate em
  TOSH_MAKE_PROG_IN_OUTPUT();
  TOSH_MAKE_PROG_OUT_OUTPUT();
  TOSH_SEL_PROG_IN_IOFUNC();
  TOSH_SEL_PROG_OUT_IOFUNC();

  TOSH_SEL_VSENSE_REG_IOFUNC();
  TOSH_MAKE_VSENSE_REG_INPUT();

  // ADC lines
  TOSH_SEL_ADC_0_IOFUNC();
  TOSH_MAKE_ADC_0_OUTPUT();
  TOSH_SEL_ADC_1_IOFUNC();
  TOSH_MAKE_ADC_1_OUTPUT();
  TOSH_SEL_ADC_2_IOFUNC();
  TOSH_MAKE_ADC_2_OUTPUT();
  TOSH_SEL_ADC_6_IOFUNC();
  TOSH_MAKE_ADC_6_OUTPUT();
  TOSH_SEL_ADC_7_IOFUNC();
  TOSH_MAKE_ADC_7_OUTPUT();

  TOSH_SEL_ADC_ACCELZ_IOFUNC();
  TOSH_MAKE_ADC_ACCELZ_OUTPUT();
  TOSH_SEL_ADC_ACCELY_IOFUNC();
  TOSH_MAKE_ADC_ACCELY_OUTPUT();
  TOSH_SEL_ADC_ACCELX_IOFUNC();
  TOSH_MAKE_ADC_ACCELX_OUTPUT();
  
  TOSH_SEL_ROSC_IOFUNC();
  TOSH_MAKE_ROSC_INPUT();

  // 1-wire function
  TOSH_SEL_ONEWIRE_IOFUNC();
  TOSH_MAKE_ONEWIRE_OUTPUT();

  // docked pin
  TOSH_SEL_DOCK_N_IOFUNC();
  TOSH_MAKE_DOCK_N_INPUT();

  /*
   *  Accelerometer pin definitions
   * unless the accel_sel0 pin is cleared, 
   * a severe quiescent power hit occurs on the msp430
   * we go from 3.7 ua to 65.1 ua when asleep!
   */
  TOSH_SEL_ACCEL_SEL0_IOFUNC();
  TOSH_MAKE_ACCEL_SEL0_OUTPUT();
  TOSH_CLR_ACCEL_SEL0_PIN();
  TOSH_SEL_ACCEL_SEL1_IOFUNC();
  TOSH_MAKE_ACCEL_SEL1_OUTPUT();
  TOSH_CLR_ACCEL_SEL1_PIN();
  TOSH_SEL_ACCEL_SLEEP_N_IOFUNC();
  TOSH_MAKE_ACCEL_SLEEP_N_OUTPUT();
  TOSH_CLR_ACCEL_SLEEP_N_PIN();

  // bus arbitration pins 
  TOSH_SEL_SW_SD_PWR_N_IOFUNC();
  TOSH_MAKE_SW_SD_PWR_N_OUTPUT();
  TOSH_SET_SW_SD_PWR_N_PIN();     // power down sd module; overridden by dock pin on programming board
  TOSH_SEL_SW_BT_PWR_N_IOFUNC();
  TOSH_MAKE_SW_BT_PWR_N_OUTPUT();
  TOSH_SET_SW_BT_PWR_N_PIN();     // power down bt module; overridden by dock pin on programming board

  // idle expansion header pins
  TOSH_SEL_SER0_CTS_IOFUNC();
  TOSH_MAKE_SER0_CTS_OUTPUT();
  TOSH_SEL_SER0_RTS_IOFUNC();
  TOSH_MAKE_SER0_RTS_OUTPUT();

  // this pin is now tied to the user button on the prog board
  TOSH_SEL_GIO0_IOFUNC();
  TOSH_MAKE_GIO0_INPUT();

  TOSH_SEL_GIO1_IOFUNC();
  TOSH_MAKE_GIO1_OUTPUT();

  TOSH_SEL_UTXD0_IOFUNC();
  TOSH_MAKE_UTXD0_OUTPUT();
  TOSH_SEL_URXD0_IOFUNC();
  TOSH_MAKE_URXD0_OUTPUT();
  TOSH_SEL_UCLK0_IOFUNC();
  TOSH_MAKE_UCLK0_OUTPUT();
  TOSH_SEL_SIMO0_IOFUNC();
  TOSH_MAKE_SIMO0_OUTPUT();
  TOSH_SEL_SOMI0_IOFUNC();
  TOSH_MAKE_SOMI0_OUTPUT();

  TOSH_SEL_UTXD1_IOFUNC();
  TOSH_MAKE_UTXD1_OUTPUT();
  TOSH_SEL_URXD1_IOFUNC();
  TOSH_MAKE_URXD1_OUTPUT();
  TOSH_SEL_UCLK1_IOFUNC();
  TOSH_MAKE_UCLK1_OUTPUT();
  TOSH_SEL_SIMO1_IOFUNC();
  TOSH_MAKE_SIMO1_OUTPUT();
  TOSH_SEL_SOMI1_IOFUNC();
  TOSH_MAKE_SOMI1_OUTPUT();
}

#endif // _H_hardware_h




More information about the Tinyos-contrib-commits mailing list