[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Deluge/Deluge/TOSBoot
Leds.nc, 1.2, 1.3 LedsC.nc, 1.2, 1.3 TOSBootM.nc, 1.13, 1.14
Jonathan Hui
jwhui at users.sourceforge.net
Tue Jul 12 15:10:35 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1222
Modified Files:
Leds.nc LedsC.nc TOSBootM.nc
Log Message:
- Reduced code size to 1960 bytes.
Index: Leds.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot/Leds.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Leds.nc 18 May 2005 06:44:45 -0000 1.2
--- Leds.nc 12 Jul 2005 22:10:32 -0000 1.3
***************
*** 31,33 ****
--- 31,35 ----
interface Leds {
command void set(uint8_t ledsOn);
+ command void flash(uint8_t a);
+ command void glow(uint8_t a, uint8_t b);
}
Index: LedsC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot/LedsC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** LedsC.nc 18 May 2005 06:44:45 -0000 1.2
--- LedsC.nc 12 Jul 2005 22:10:32 -0000 1.3
***************
*** 56,58 ****
--- 56,80 ----
}
+ command void Leds.flash(uint8_t a) {
+ uint8_t i, j;
+ for ( i = 3; i; i-- ) {
+ call Leds.set(a);
+ for ( j = 4; j; j-- )
+ wait(0xffff);
+ call Leds.set(0);
+ for ( j = 4; j; j-- )
+ wait(0xffff);
+ }
+ }
+
+ command void Leds.glow(uint8_t a, uint8_t b) {
+ int i;
+ for (i = 1536; i > 0; i -= 4) {
+ call Leds.set(a);
+ wait(i);
+ call Leds.set(b);
+ wait(1536-i);
+ }
+ }
+
}
Index: TOSBootM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot/TOSBootM.nc,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** TOSBootM.nc 12 Jul 2005 20:09:08 -0000 1.13
--- TOSBootM.nc 12 Jul 2005 22:10:32 -0000 1.14
***************
*** 57,86 ****
uint8_t output = 0x7;
uint8_t i;
- uint16_t j;
-
- call Leds.set(0x7);
- for (i = 3; i; i--, output >>= 1 ) {
- for (j = 1536; j > 0; j -= 4) {
- call Leds.set(output);
- wait(j);
- call Leds.set(output >> 0x1);
- wait(1536-j);
- }
- }
! }
!
! void codeNotify(uint8_t output) {
!
! uint8_t i, j;
!
! for ( i = 3; i; i-- ) {
! call Leds.set(output);
! for ( j = 4; j; j-- )
! wait(0xffff);
! call Leds.set(0);
! for ( j = 4; j; j-- )
! wait(0xffff);
! }
}
--- 57,63 ----
uint8_t output = 0x7;
uint8_t i;
! for (i = 3; i; i--, output >>= 1 )
! call Leds.glow(output, output >> 1);
}
***************
*** 98,102 ****
uint16_t crcTarget = 0, crcTmp = 0;
uint16_t addr, len;
- uint16_t j;
pgnum_t numPgs;
uint8_t i;
--- 75,78 ----
***************
*** 119,124 ****
// read crc
call ExtFlash.startRead(startAddr + i*sizeof(uint16_t));
! crcTarget = 0;
! crcTarget |= (uint16_t)(call ExtFlash.readByte() & 0xff);
crcTarget |= (uint16_t)(call ExtFlash.readByte() & 0xff) << 8;
call ExtFlash.stopRead();
--- 95,99 ----
// read crc
call ExtFlash.startRead(startAddr + i*sizeof(uint16_t));
! crcTarget = (uint16_t)(call ExtFlash.readByte() & 0xff);
crcTarget |= (uint16_t)(call ExtFlash.readByte() & 0xff) << 8;
call ExtFlash.stopRead();
***************
*** 126,130 ****
// compute crc
call ExtFlash.startRead(startAddr + addr);
! for ( j = 0, crcTmp = 0; j < len; j++ )
crcTmp = crcByte(crcTmp, call ExtFlash.readByte());
call ExtFlash.stopRead();
--- 101,105 ----
// compute crc
call ExtFlash.startRead(startAddr + addr);
! for ( crcTmp = 0; len; len-- )
crcTmp = crcByte(crcTmp, call ExtFlash.readByte());
call ExtFlash.stopRead();
***************
*** 133,138 ****
len = DELUGE_BYTES_PER_PAGE;
- call Leds.set(i);
-
}
--- 108,111 ----
***************
*** 215,219 ****
if ( !call Voltage.okToProgram() ) {
// give user some time and count down LEDs
! codeNotify(LEDS_LOWBATT);
startupLeds();
runApp();
--- 188,192 ----
if ( !call Voltage.okToProgram() ) {
// give user some time and count down LEDs
! call Leds.flash(LEDS_LOWBATT);
startupLeds();
runApp();
***************
*** 224,230 ****
// increment gesture counter, see if it exceeds threshold
! if (++args.gestureCount >= TOSBOOT_GESTURE_MAX_COUNT - 1) {
// gesture has been detected, display receipt of gesture on LEDs
! codeNotify(LEDS_GESTURE);
// load golden image from flash
--- 197,203 ----
// increment gesture counter, see if it exceeds threshold
! if ( ++args.gestureCount >= TOSBOOT_GESTURE_MAX_COUNT - 1 ) {
// gesture has been detected, display receipt of gesture on LEDs
! call Leds.flash(LEDS_GESTURE);
// load golden image from flash
More information about the Tinyos-beta-commits
mailing list