[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/handhelds/tos/platform/telosb
DS2411.nc, NONE, 1.1 DS2411C.nc, NONE, 1.1 DS2411M.nc, NONE,
1.1 DS2411Pin.nc, NONE, 1.1 DS2411PinC.nc, NONE,
1.1 DS2411PinM.nc, NONE, 1.1 HPLSTM25PC.nc, NONE,
1.1 HPLSTM25PM.nc, NONE, 1.1 I2CPacketC.nc, NONE,
1.1 I2CPacketM.nc, NONE, 1.1 LedsC.nc, NONE, 1.1 README.DS2411,
NONE, 1.1 SDC.nc, NONE, 1.1 TOSBoot_platform.h, NONE,
1.1 UserButtonC.nc, NONE, 1.1 UserButtonM.nc, NONE,
1.1 hardware.h, NONE, 1.1
steve ayer
ayer1 at users.sourceforge.net
Thu Aug 3 12:16:52 PDT 2006
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/handhelds/tos/platform/msp430_crl_base
HPLUSARTControl.nc, NONE, 1.1 DMA_M.nc, 1.1, 1.2 HPLUSART0M.nc,
1.1, 1.2 HPLUSART1M.nc, 1.1, 1.2
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/handhelds/tos/platform/shimmer
BlueRadioC.nc, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/contrib/handhelds/tos/platform/telosb
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv16969/tos/platform/telosb
Added Files:
DS2411.nc DS2411C.nc DS2411M.nc DS2411Pin.nc DS2411PinC.nc
DS2411PinM.nc HPLSTM25PC.nc HPLSTM25PM.nc I2CPacketC.nc
I2CPacketM.nc LedsC.nc README.DS2411 SDC.nc TOSBoot_platform.h
UserButtonC.nc UserButtonM.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: DS2411.nc ---
//$Id: DS2411.nc,v 1.1 2006/08/03 19:16:50 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."
*/
//@author Cory Sharp <cssharp at eecs.berkeley.edu>
interface DS2411
{
command result_t init();
command void copy_id( uint8_t* id ); // 6 bytes
command uint8_t get_id_byte( uint8_t index );
command uint8_t get_family();
command uint8_t get_crc();
command bool is_crc_okay();
}
--- NEW FILE: DS2411C.nc ---
//$Id: DS2411C.nc,v 1.1 2006/08/03 19:16:50 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."
*/
//@author Cory Sharp <cssharp at eecs.berkeley.edu>
configuration DS2411C
{
provides interface DS2411;
}
implementation
{
components DS2411M, DS2411PinC;
DS2411 = DS2411M;
DS2411M.DS2411Pin -> DS2411PinC.DS2411Pin;
}
--- NEW FILE: DS2411M.nc ---
//$Id: DS2411M.nc,v 1.1 2006/08/03 19:16:50 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."
*/
//@author Cory Sharp <cssharp at eecs.berkeley.edu>
/*
The 1-wire timings suggested by the DS2411 data sheet are incorrect,
incomplete, or unclear. The timings provided the app note 522 work:
http://www.maxim-ic.com/appnotes.cfm/appnote_number/522
*/
module DS2411M
{
provides interface DS2411;
uses interface DS2411Pin;
}
implementation
{
uint8_t m_id[8];
void uwait( uint16_t usec )
{
const uint16_t t0 = TAR;
while( (TAR-t0) < usec );
}
enum
{
STD_A = 6,
STD_B = 64,
STD_C = 60,
STD_D = 10,
STD_E = 9,
STD_F = 55,
STD_G = 0,
STD_H = 480,
STD_I = 90,
STD_J = 220,
};
void init_pins()
{
TOSH_MAKE_ONEWIRE_INPUT();
TOSH_CLR_ONEWIRE_PIN();
}
bool reset() // >= 960us
{
int present;
call DS2411Pin.output_low();
uwait(STD_H); //t_RSTL
call DS2411Pin.prepare_read();
uwait(STD_I); //t_MSP
present = call DS2411Pin.read();
uwait(STD_J); //t_REC
return (present == 0);
}
void write_bit_one() // >= 70us
{
call DS2411Pin.output_low();
uwait(STD_A); //t_W1L
call DS2411Pin.output_high();
uwait(STD_B); //t_SLOT - t_W1L
}
void write_bit_zero() // >= 70us
{
call DS2411Pin.output_low();
uwait(STD_C); //t_W0L
call DS2411Pin.output_high();
uwait(STD_D); //t_SLOT - t_W0L
}
void write_bit( int is_one ) // >= 70us
{
if(is_one)
write_bit_one();
else
write_bit_zero();
}
bool read_bit() // >= 70us
{
int bit;
call DS2411Pin.output_low();
uwait(STD_A); //t_RL
call DS2411Pin.prepare_read();
uwait(STD_E); //near-max t_MSR
bit = call DS2411Pin.read();
uwait(STD_F); //t_REC
return bit;
}
void write_byte( uint8_t byte ) // >= 560us
{
uint8_t bit;
for( bit=0x01; bit!=0; bit<<=1 )
write_bit( byte & bit );
}
uint8_t read_byte() // >= 560us
{
uint8_t byte = 0;
uint8_t bit;
for( bit=0x01; bit!=0; bit<<=1 )
{
if( read_bit() )
byte |= bit;
}
return byte;
}
uint8_t crc8_byte( uint8_t crc, uint8_t byte )
{
int i;
crc ^= byte;
for( i=0; i<8; i++ )
{
if( crc & 1 )
crc = (crc >> 1) ^ 0x8c;
else
crc >>= 1;
}
return crc;
}
uint8_t crc8_bytes( uint8_t crc, uint8_t* bytes, uint8_t len )
{
uint8_t* end = bytes+len;
while( bytes != end )
crc = crc8_byte( crc, *bytes++ );
return crc;
}
command result_t DS2411.init() // >= 6000us
{
int retry = 5;
uint8_t id[8];
bzero( m_id, 8 );
call DS2411Pin.init();
while( retry-- > 0 )
{
int crc = 0;
if( reset() )
{
uint8_t* byte;
write_byte(0x33); //read rom
for( byte=id+7; byte!=id-1; byte-- )
crc = crc8_byte( crc, *byte=read_byte() );
if( crc == 0 )
{
memcpy( m_id, id, 8 );
return SUCCESS;
}
}
}
return FAIL;
}
command uint8_t DS2411.get_id_byte( uint8_t index )
{
return (index < 6) ? m_id[index+1] : 0;
}
command void DS2411.copy_id( uint8_t* id )
{
memcpy( id, m_id+1, 6 );
}
command uint8_t DS2411.get_family()
{
return m_id[7];
}
command uint8_t DS2411.get_crc()
{
return m_id[0];
}
uint8_t calc_crc()
{
return crc8_bytes( 0, m_id+1, 7 );
}
command bool DS2411.is_crc_okay()
{
return (call DS2411.get_crc() == calc_crc());
}
}
--- NEW FILE: DS2411Pin.nc ---
//$Id: DS2411Pin.nc,v 1.1 2006/08/03 19:16:50 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."
*/
//@author Cory Sharp <cssharp at eecs.berkeley.edu>
interface DS2411Pin
{
command void init();
command void output_low();
command void output_high();
command void prepare_read();
command uint8_t read(); //zero=0, nonzero=1
}
--- NEW FILE: DS2411PinC.nc ---
//$Id: DS2411PinC.nc,v 1.1 2006/08/03 19:16:50 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."
*/
//@author Cory Sharp <cssharp at eecs.berkeley.edu>
configuration DS2411PinC
{
provides interface DS2411Pin;
}
implementation
{
components DS2411PinM, MSP430GeneralIOC;
DS2411Pin = DS2411PinM;
DS2411PinM.MSP430Pin -> MSP430GeneralIOC.Port24;
}
--- NEW FILE: DS2411PinM.nc ---
//$Id: DS2411PinM.nc,v 1.1 2006/08/03 19:16:50 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."
*/
//@author Cory Sharp <cssharp at eecs.berkeley.edu>
module DS2411PinM
{
provides interface DS2411Pin;
uses interface MSP430GeneralIO as MSP430Pin;
}
implementation
{
command void DS2411Pin.init()
{
call MSP430Pin.selectIOFunc();
call MSP430Pin.makeInput();
call MSP430Pin.setLow();
}
command void DS2411Pin.output_low()
{
call MSP430Pin.makeOutput();
}
command void DS2411Pin.output_high()
{
call MSP430Pin.makeInput();
}
command void DS2411Pin.prepare_read()
{
call MSP430Pin.makeInput();
}
command uint8_t DS2411Pin.read()
{
return call MSP430Pin.getRaw();
}
}
--- NEW FILE: HPLSTM25PC.nc ---
// $Id: HPLSTM25PC.nc,v 1.1 2006/08/03 19:16:50 ayer1 Exp $
/* tab:4
* "Copyright (c) 2000-2004 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."
*/
/*
* @author: Jonathan Hui <jwhui at cs.berkeley.edu>
*/
includes HALSTM25P;
configuration HPLSTM25PC {
provides {
interface StdControl;
interface HPLSTM25P;
}
}
implementation {
components
HPLSTM25PM,
BusArbitrationC,
HPLUSART0M,
LedsC,
Main;
StdControl = HPLSTM25PM;
HPLSTM25P = HPLSTM25PM;
Main.StdControl -> BusArbitrationC;
HPLSTM25PM.BusArbitration -> BusArbitrationC.BusArbitration[unique("BusArbitration")];
HPLSTM25PM.Leds -> LedsC;
HPLSTM25PM.USARTControl -> HPLUSART0M;
}
--- NEW FILE: HPLSTM25PM.nc ---
// $Id: HPLSTM25PM.nc,v 1.1 2006/08/03 19:16:50 ayer1 Exp $
/* tab:4
* "Copyright (c) 2000-2004 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."
*/
/*
* @author: Jonathan Hui <jwhui at cs.berkeley.edu>
*/
module HPLSTM25PM {
provides {
interface StdControl;
interface HPLSTM25P;
}
uses {
interface BusArbitration;
interface HPLUSARTControl as USARTControl;
interface Leds;
}
}
implementation {
command result_t StdControl.init() {
return SUCCESS;
}
command result_t StdControl.start() {
call USARTControl.setModeSPI();
call USARTControl.disableRxIntr();
call USARTControl.disableTxIntr();
return SUCCESS;
}
command result_t StdControl.stop() {
call USARTControl.disableSPI();
return SUCCESS;
}
async command result_t HPLSTM25P.getBus() {
return call BusArbitration.getBus();
}
async command result_t HPLSTM25P.releaseBus() {
return call BusArbitration.releaseBus();
}
async command void HPLSTM25P.beginCmd() {
TOSH_CLR_FLASH_CS_PIN();
call HPLSTM25P.unhold();
}
async command void HPLSTM25P.endCmd() {
while(!(call USARTControl.isTxEmpty()));
TOSH_SET_FLASH_CS_PIN();
}
async command void HPLSTM25P.hold() {
TOSH_CLR_FLASH_HOLD_PIN();
}
async command void HPLSTM25P.unhold() {
TOSH_SET_FLASH_HOLD_PIN();
}
async command void HPLSTM25P.txBuf(void* buf, stm25p_addr_t len) {
uint8_t* tmpBuf = buf;
call USARTControl.isTxIntrPending();
for ( ; len; len-- ) {
call USARTControl.tx(*tmpBuf++);
while(!(call USARTControl.isTxIntrPending()));
}
}
async command uint16_t HPLSTM25P.rxBuf(void* buf, stm25p_addr_t len, uint16_t crc) {
uint8_t* tmpBuf = buf;
uint8_t tmp;
call USARTControl.rx(); // clear receive interrupt
call USARTControl.tx(0);
for ( ; len > 0; len-- ) {
atomic {
while(!call USARTControl.isTxIntrPending());
call USARTControl.tx(0);
while(!call USARTControl.isRxIntrPending());
tmp = call USARTControl.rx();
}
if (buf != NULL)
*tmpBuf++ = tmp;
else
crc = crcByte(crc, tmp);
}
return crc;
}
event result_t BusArbitration.busFree() { return SUCCESS; }
}
--- NEW FILE: I2CPacketC.nc ---
// $Id: I2CPacketC.nc,v 1.1 2006/08/03 19:16:50 ayer1 Exp $
/*
* "Copyright (c) 2000-2005 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."
*/
/**
* @author Joe Polastre
* Revision: $Revision: 1.1 $
*
* Provides the ability to write or read a series of bytes to/from the
* I2C bus.
**/
configuration I2CPacketC
{
provides {
interface StdControl;
interface MSP430I2CPacket;
}
}
implementation {
components I2CPacketM, MSP430I2CC as XI2C, BusArbitrationC;
StdControl = BusArbitrationC;
StdControl = I2CPacketM;
MSP430I2CPacket = I2CPacketM.I2CPacket;
I2CPacketM.LPacket -> XI2C;
I2CPacketM.LControl -> XI2C;
I2CPacketM.BusArbitration -> BusArbitrationC.BusArbitration[unique("BusArbitration")];
}
--- NEW FILE: I2CPacketM.nc ---
// $Id: I2CPacketM.nc,v 1.1 2006/08/03 19:16:50 ayer1 Exp $
/*
* "Copyright (c) 2000-2005 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."
*/
/**
* @author Joe Polastre
* Revision: $Revision: 1.1 $
*
* Provides the ability to write or read a series of bytes to/from the
* I2C bus.
**/
module I2CPacketM
{
provides {
interface MSP430I2CPacket as I2CPacket;
interface StdControl;
}
uses {
interface MSP430I2CPacket as LPacket;
interface StdControl as LControl;
interface BusArbitration;
}
}
implementation
{
command result_t StdControl.init() {
call LControl.init();
return SUCCESS;
}
command result_t StdControl.start() {
return SUCCESS;
}
command result_t StdControl.stop() {
return SUCCESS;
}
command result_t I2CPacket.readPacket(uint16_t _addr, uint8_t _length, uint8_t* _data) {
// bus arbitration occurs here
if (call BusArbitration.getBus() == SUCCESS) {
if (call LControl.start())
return call LPacket.readPacket(_addr, _length, _data);
}
return FAIL;
}
event void LPacket.readPacketDone(uint16_t _addr, uint8_t _length, uint8_t* _data, result_t _result) {
call LControl.stop();
call BusArbitration.releaseBus();
signal I2CPacket.readPacketDone(_addr, _length, _data, _result);
}
command result_t I2CPacket.writePacket(uint16_t _addr, uint8_t _length, uint8_t* _data) {
// bus arbitration occurs here
if (call BusArbitration.getBus() == SUCCESS) {
if (call LControl.start())
return call LPacket.writePacket(_addr, _length, _data);
}
return FAIL;
}
event void LPacket.writePacketDone(uint16_t _addr, uint8_t _length, uint8_t* _data, result_t _result) {
call LControl.stop();
call BusArbitration.releaseBus();
signal I2CPacket.writePacketDone(_addr, _length, _data, _result);
}
event result_t BusArbitration.busFree() { return SUCCESS; }
}
--- 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() {
return SUCCESS;
}
async command result_t Leds.orangeOff() {
return SUCCESS;
}
async command result_t Leds.orangeToggle() {
return SUCCESS;
}
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: README.DS2411 ---
$Id: README.DS2411,v 1.1 2006/08/03 19:16:50 ayer1 Exp $
README for DS2411
Author/Contact: tinyos-help at millennium.berkeley.edu
@author Cory Sharp <cssharp at eecs.berkeley.edu>
Description:
The DS2411 is a serial ID that provides a distinct, unique 48-bit number.
It is intended to be used in conjunction with a 16-bit IEEE OUI to produce
a unique 64-bit mote identifier number.
The DS2411 uses the 1-Wire protocol. This module has been abstracted to
live in the to-exist tos/chips/ heirarchy. The following interfaces,
configuration, and implementation files are intended to live in
tos/chips/:
DS2411.nc
DS2411C.nc
DS2411M.nc
DS2411Pin.nc
DS2411 defines the interface to the chip, and DS2411M implements the
(hopefully) platform-independent chip-logic. DS2411Pin defines a semantic
interface for iteracting with the DS2411 hardware IO pin. DS2411C in part
wires to the DS2411PinC configuration presumably provided by the platform.
The following configuration and module files must be provided by the
platform:
DS2411PinC.nc
DS2411PinM.nc
DS2411PinC and DS2411PinM implement the basic hardware semantics for
interacting with the DS2411 at the pin level. The more complex DS2411
logic is built given this minimal platform specific implementation.
--- 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, HPLUSART1M, TimerC, LedsC;
StdControl = SD_M;
SD = SD_M;
SD_M.USARTControl -> HPLUSART1M;
SD_M.Timer -> TimerC.Timer[unique("Timer")];
SD_M.Leds -> LedsC;
}
--- NEW FILE: TOSBoot_platform.h ---
// $Id: TOSBoot_platform.h,v 1.1 2006/08/03 19:16:50 ayer1 Exp $
/* tab:2
* "Copyright (c) 2000-2005 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."
*/
/**
* @author Jonathan Hui <jwhui at cs.berkeley.edu>
*/
#ifndef __TOSBOOT_PLATFORM_H__
#define __TOSBOOT_PLATFORM_H__
enum {
// address of TOSBoot args in internal flash
TOSBOOT_ARGS_ADDR = 0x70,
// number of resets to force golden image
TOSBOOT_GESTURE_MAX_COUNT = 3,
// address of the golden image in external flash
TOSBOOT_GOLDEN_IMG_ADDR = 0xf0000L,
// size of each internal program flash page
TOSBOOT_INT_PAGE_SIZE = 512L,
};
enum {
DELUGE_MIN_ADV_PERIOD_LOG2 = 9,
DELUGE_QSIZE = 1,
};
#endif
--- NEW FILE: UserButtonC.nc ---
//$Id: UserButtonC.nc,v 1.1 2006/08/03 19:16:50 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>
*/
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 -> MSP430InterruptC.Port27;
UserButtonM -> MSP430GeneralIOC.Port27;
UserButtonM -> TimerC.Timer[unique("Timer")];
}
--- NEW FILE: UserButtonM.nc ---
//$Id: UserButtonM.nc,v 1.1 2006/08/03 19:16:50 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."
*/
/**
* Andew's timer debouce logic used from the CountInput application.
*
* @author Cory Sharp <cssharp at eecs.berkeley.edu>
* @author Andrew Redfern <aredfern at kingkong.me.berkeley.edu>
*/
module UserButtonM
{
provides interface StdControl;
provides interface MSP430Event as UserButton;
uses interface MSP430Interrupt;
uses interface MSP430GeneralIO;
uses interface Timer;
}
implementation
{
command result_t StdControl.init()
{
atomic
{
call MSP430Interrupt.disable();
call MSP430GeneralIO.makeInput();
call MSP430GeneralIO.selectIOFunc();
call MSP430Interrupt.edge(TRUE);
call MSP430Interrupt.clear();
call MSP430Interrupt.enable();
}
return SUCCESS;
}
command result_t StdControl.start()
{
atomic
{
call MSP430Interrupt.clear();
call MSP430Interrupt.enable();
}
return SUCCESS;
}
command result_t StdControl.stop()
{
atomic
{
call MSP430Interrupt.disable();
}
return SUCCESS;
}
event result_t Timer.fired()
{
atomic
{
call MSP430Interrupt.clear();
call MSP430Interrupt.enable();
}
return SUCCESS;
}
task void debounce()
{
call Timer.start( TIMER_ONE_SHOT, 100 );
}
async event void MSP430Interrupt.fired()
{
atomic
{
signal UserButton.fired();
// debounce
call MSP430Interrupt.disable();
post debounce();
}
}
}
--- NEW FILE: hardware.h ---
#ifndef _H_hardware_h
#define _H_hardware_h
#include "msp430hardware.h"
#include "MSP430ADC12.h"
#include "CC2420Const.h"
#include "AM.h"
// LEDs
TOSH_ASSIGN_PIN(RED_LED, 5, 4);
TOSH_ASSIGN_PIN(GREEN_LED, 5, 5);
TOSH_ASSIGN_PIN(YELLOW_LED, 5, 6);
// CC2420 RADIO #defines
TOSH_ASSIGN_PIN(RADIO_CSN, 4, 2);
TOSH_ASSIGN_PIN(RADIO_VREF, 4, 5);
TOSH_ASSIGN_PIN(RADIO_RESET, 4, 6);
TOSH_ASSIGN_PIN(RADIO_FIFOP, 1, 0);
TOSH_ASSIGN_PIN(RADIO_SFD, 4, 1);
TOSH_ASSIGN_PIN(RADIO_GIO0, 1, 3);
TOSH_ASSIGN_PIN(RADIO_FIFO, 1, 3);
TOSH_ASSIGN_PIN(RADIO_GIO1, 1, 4);
TOSH_ASSIGN_PIN(RADIO_CCA, 1, 4);
TOSH_ASSIGN_PIN(CC_FIFOP, 1, 0);
TOSH_ASSIGN_PIN(CC_FIFO, 1, 3);
TOSH_ASSIGN_PIN(CC_SFD, 4, 1);
TOSH_ASSIGN_PIN(CC_VREN, 4, 5);
TOSH_ASSIGN_PIN(CC_RSTN, 4, 6);
// UART pins
TOSH_ASSIGN_PIN(SOMI0, 3, 2);
TOSH_ASSIGN_PIN(SIMO0, 3, 1);
TOSH_ASSIGN_PIN(UCLK0, 3, 3);
TOSH_ASSIGN_PIN(UTXD0, 3, 4);
TOSH_ASSIGN_PIN(URXD0, 3, 5);
TOSH_ASSIGN_PIN(UTXD1, 3, 6);
TOSH_ASSIGN_PIN(URXD1, 3, 7);
TOSH_ASSIGN_PIN(UCLK1, 5, 3);
TOSH_ASSIGN_PIN(SOMI1, 5, 2);
TOSH_ASSIGN_PIN(SIMO1, 5, 1);
TOSH_ASSIGN_PIN(STE1, 5, 0);
// for hacked-in sd slot
#define USART1_SD
TOSH_ASSIGN_PIN(SD_CS_N, 5, 0);
// ADC
TOSH_ASSIGN_PIN(ADC0, 6, 0);
TOSH_ASSIGN_PIN(ADC1, 6, 1);
TOSH_ASSIGN_PIN(ADC2, 6, 2);
TOSH_ASSIGN_PIN(ADC3, 6, 3);
TOSH_ASSIGN_PIN(ADC4, 6, 4);
TOSH_ASSIGN_PIN(ADC5, 6, 5);
TOSH_ASSIGN_PIN(ADC6, 6, 6);
TOSH_ASSIGN_PIN(ADC7, 6, 7);
// HUMIDITY
TOSH_ASSIGN_PIN(HUM_SDA, 1, 5);
TOSH_ASSIGN_PIN(HUM_SCL, 1, 6);
TOSH_ASSIGN_PIN(HUM_PWR, 1, 7);
// GIO pins
TOSH_ASSIGN_PIN(GIO0, 2, 0);
TOSH_ASSIGN_PIN(GIO1, 2, 1);
TOSH_ASSIGN_PIN(GIO2, 2, 3);
TOSH_ASSIGN_PIN(GIO3, 2, 6);
// 1-Wire
TOSH_ASSIGN_PIN(ONEWIRE, 2, 4);
// FLASH
TOSH_ASSIGN_PIN(FLASH_PWR, 4, 3);
TOSH_ASSIGN_PIN(FLASH_CS, 4, 4);
TOSH_ASSIGN_PIN(FLASH_HOLD, 4, 7);
// Detect if the mote is plugged into USB
TOSH_ASSIGN_PIN(USB_DETECT, 1, 2);
// PROGRAMMING PINS (tri-state)
//TOSH_ASSIGN_PIN(TCK, );
TOSH_ASSIGN_PIN(PROG_RX, 1, 1);
TOSH_ASSIGN_PIN(PROG_TX, 2, 2);
// send a bit via bit-banging to the flash
void TOSH_FLASH_M25P_DP_bit(bool set) {
if (set)
TOSH_SET_SIMO0_PIN();
else
TOSH_CLR_SIMO0_PIN();
TOSH_SET_UCLK0_PIN();
TOSH_CLR_UCLK0_PIN();
}
// put the flash into deep sleep mode
// important to do this by default
void TOSH_FLASH_M25P_DP() {
// SIMO0, UCLK0
TOSH_MAKE_SIMO0_OUTPUT();
TOSH_MAKE_UCLK0_OUTPUT();
TOSH_MAKE_FLASH_HOLD_OUTPUT();
TOSH_MAKE_FLASH_CS_OUTPUT();
TOSH_SET_FLASH_HOLD_PIN();
TOSH_SET_FLASH_CS_PIN();
TOSH_wait();
// initiate sequence;
TOSH_CLR_FLASH_CS_PIN();
TOSH_CLR_UCLK0_PIN();
TOSH_FLASH_M25P_DP_bit(TRUE); // 0
TOSH_FLASH_M25P_DP_bit(FALSE); // 1
TOSH_FLASH_M25P_DP_bit(TRUE); // 2
TOSH_FLASH_M25P_DP_bit(TRUE); // 3
TOSH_FLASH_M25P_DP_bit(TRUE); // 4
TOSH_FLASH_M25P_DP_bit(FALSE); // 5
TOSH_FLASH_M25P_DP_bit(FALSE); // 6
TOSH_FLASH_M25P_DP_bit(TRUE); // 7
TOSH_SET_FLASH_CS_PIN();
TOSH_SET_SIMO0_PIN();
TOSH_MAKE_SIMO0_INPUT();
TOSH_MAKE_UCLK0_INPUT();
TOSH_CLR_FLASH_HOLD_PIN();
}
// need to undef atomic inside header files or nesC ignores the directive
#undef atomic
void TOSH_SET_PIN_DIRECTIONS(void)
{
// reset all of the ports to be input and using i/o functionality
atomic
{
P1SEL = 0;
P2SEL = 0;
P3SEL = 0;
P4SEL = 0;
P5SEL = 0;
P6SEL = 0;
P1DIR = 0xe0;
P1OUT = 0x00;
P2DIR = 0x7b;
P2OUT = 0x10;
P3DIR = 0xf1;
P3OUT = 0x00;
P4DIR = 0xfd;
P4OUT = 0xdd;
P5DIR = 0xff;
P5OUT = 0xff;
P6DIR = 0xff;
P6OUT = 0x00;
P1IE = 0;
P2IE = 0;
// the commands above take care of the pin directions
// there is no longer a need for explicit set pin
// directions using the TOSH_SET/CLR macros
// wait 10ms for the flash to startup
TOSH_uwait(1024*10);
// Put the flash in deep sleep state
TOSH_FLASH_M25P_DP();
}//atomic
}
#endif // _H_hardware_h
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/handhelds/tos/platform/msp430_crl_base
HPLUSARTControl.nc, NONE, 1.1 DMA_M.nc, 1.1, 1.2 HPLUSART0M.nc,
1.1, 1.2 HPLUSART1M.nc, 1.1, 1.2
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/handhelds/tos/platform/shimmer
BlueRadioC.nc, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-contrib-commits
mailing list