[Tinyos-beta-commits]
CVS: tinyos-1.x/beta/Deluge/Deluge/TOSBoot/msp430
PluginC.nc, NONE, 1.1 PowerOffM.nc, NONE, 1.1 hardware.h, 1.1, 1.2
Jonathan Hui
jwhui at users.sourceforge.net
Sun May 1 21:56:03 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot/msp430
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11218/msp430
Modified Files:
hardware.h
Added Files:
PluginC.nc PowerOffM.nc
Log Message:
Added power down functionality to TOSBoot for telosb. Provides on/off
capability for any app that has TOSBoot installed. An added advantage
is that it doesn't require messing with setting up the NMI. Adds about
60 bytes of program code.
To power off a telosb, hold down the user button while pressing and
releasing the reset switch. Power down is signified by all three LEDs
dimming to off simultaneously, as it does in PowerButtonC. To power
on, simply press and release the reset switch.
--- NEW FILE: PluginC.nc ---
// $Id: PluginC.nc,v 1.1 2005/05/02 04:56:01 jwhui Exp $
/* tab:2
*
*
* "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>
*/
configuration PluginC {
provides {
interface StdControl;
}
}
implementation {
components LedsC, PowerOffM;
StdControl = PowerOffM;
PowerOffM.Leds -> LedsC;
}
--- NEW FILE: PowerOffM.nc ---
// $Id: PowerOffM.nc,v 1.1 2005/05/02 04:56:01 jwhui Exp $
/* tab:2
*
*
* "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 PowerOffM {
provides {
interface StdControl;
}
uses {
interface Leds;
}
}
implementation {
void haltsystem() {
uint16_t _lpmreg;
int i;
TOSH_SET_PIN_DIRECTIONS();
call Leds.set(0);
for (i = 1024; i > 0; i=i-4) {
call Leds.set(0x7);
TOSH_uwait(i);
call Leds.set(0);
TOSH_uwait(1024-i);
}
_lpmreg = LPM4_bits;
_lpmreg |= SR_GIE;
__asm__ __volatile__( "bis %0, r2" : : "m" ((uint16_t)_lpmreg) );
}
command result_t StdControl.init() {
return SUCCESS;
}
command result_t StdControl.start() {
TOSH_MAKE_USERINT_INPUT();
// if user button is pressed, power down
if (!TOSH_READ_USERINT_PIN())
haltsystem();
return SUCCESS;
}
command result_t StdControl.stop() {
return SUCCESS;
}
}
Index: hardware.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot/msp430/hardware.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** hardware.h 21 Apr 2005 17:31:41 -0000 1.1
--- hardware.h 2 May 2005 04:56:01 -0000 1.2
***************
*** 63,66 ****
--- 63,67 ----
TOSH_ASSIGN_PIN(GIO2, 2, 3);
TOSH_ASSIGN_PIN(GIO3, 2, 6);
+ TOSH_ASSIGN_PIN(USERINT, 2, 7);
// 1-Wire
More information about the Tinyos-beta-commits
mailing list