[Tinyos-commits] CVS: tinyos-1.x/tos/lib/Deluge/TOSBoot/msp430 HPLUSART0M.nc, 1.1, 1.2 HPLUSARTControl.nc, 1.1, 1.2

Jonathan Hui jwhui at users.sourceforge.net
Fri Sep 16 16:13:49 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/tos/lib/Deluge/TOSBoot/msp430
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14730/msp430

Modified Files:
	HPLUSART0M.nc HPLUSARTControl.nc 
Log Message:

Changes requested by Joe Polastre. Reduced code size for msp.



Index: HPLUSART0M.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/Deluge/TOSBoot/msp430/HPLUSART0M.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HPLUSART0M.nc	22 Jul 2005 17:40:10 -0000	1.1
--- HPLUSART0M.nc	16 Sep 2005 23:13:47 -0000	1.2
***************
*** 37,51 ****
      // USART0 SPI module disable
      ME1 &= ~USPIE0;
-     TOSH_SEL_SIMO0_IOFUNC();
-     TOSH_SEL_SOMI0_IOFUNC();
-     TOSH_SEL_UCLK0_IOFUNC();
    }
    
    command void HPLUSARTControl.setModeSPI() {
  
-     TOSH_SEL_SIMO0_MODFUNC();
-     TOSH_SEL_SOMI0_MODFUNC();
-     TOSH_SEL_UCLK0_MODFUNC();
- 
      // 8-bit char, SPI-mode, USART as master
      U0CTL = SWRST | CHAR | SYNC | MM;
--- 37,44 ----
***************
*** 56,61 ****
      // as fast as possible
      U0BR0 = 0x02;
-     U0BR1 = 0x00;
-     U0MCTL = 0;
  
      // enable SPI
--- 49,52 ----
***************
*** 64,69 ****
      
      // clear interrupts
!     IFG1 &= ~(UTXIFG0 | URXIFG0);
  
    }
  
--- 55,80 ----
      
      // clear interrupts
!     IFG1 = 0;
! 
!   }
  
+   command void HPLUSARTControl.disableI2C() {
+     U0CTL = 0;
+     I2CTCTL = 0;
+     call HPLUSARTControl.disableSPI();
+   }
+ 
+   command void HPLUSARTControl.setModeI2C() {
+    
+     // Recommended init procedure
+     U0CTL = I2C + SYNC + MST;
+ 
+     // use 1MHz SMCLK as the I2C reference
+     I2CTCTL = I2CSSEL_2 | I2CTRX;
+ 
+     // Enable I2C
+     U0CTL |= I2CEN;
+ 
+     return;
    }
  

Index: HPLUSARTControl.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/Deluge/TOSBoot/msp430/HPLUSARTControl.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HPLUSARTControl.nc	22 Jul 2005 17:40:10 -0000	1.1
--- HPLUSARTControl.nc	16 Sep 2005 23:13:47 -0000	1.2
***************
*** 35,38 ****
--- 35,40 ----
    command void disableSPI();
    command void setModeSPI();
+   command void disableI2C();
+   command void setModeI2C();
    command result_t isTxEmpty();
    command result_t isTxIntrPending();



More information about the Tinyos-commits mailing list