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

Joe Polastre jpolastre at users.sourceforge.net
Mon Sep 19 14:56:23 PDT 2005


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

Modified Files:
	HPLUSART0M.nc 
Log Message:
more reliable switching between SPI and I2C by reseting registers to the
PUC conditions.


Index: HPLUSART0M.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/Deluge/TOSBoot/msp430/HPLUSART0M.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** HPLUSART0M.nc	16 Sep 2005 23:13:47 -0000	1.2
--- HPLUSART0M.nc	19 Sep 2005 21:56:20 -0000	1.3
***************
*** 35,55 ****
  
    command void HPLUSARTControl.disableSPI() {
!     // USART0 SPI module disable
!     ME1 &= ~USPIE0;
    }
    
    command void HPLUSARTControl.setModeSPI() {
- 
      // 8-bit char, SPI-mode, USART as master
      U0CTL = SWRST | CHAR | SYNC | MM;
  
      // 3-pin + half-cycle delayed UCLK
!     U0TCTL = STC + CKPH + SSEL_SMCLK; 
  
      // as fast as possible
      U0BR0 = 0x02;
  
      // enable SPI
!     ME1 = USPIE0;
      U0CTL &= ~SWRST;  
      
--- 35,60 ----
  
    command void HPLUSARTControl.disableSPI() {
!     // set to PUC values
!     ME1 = 0;
!     U0CTL = 1;
!     U0TCTL = 1;
!     U0RCTL = 0;
    }
    
    command void HPLUSARTControl.setModeSPI() {
      // 8-bit char, SPI-mode, USART as master
      U0CTL = SWRST | CHAR | SYNC | MM;
  
      // 3-pin + half-cycle delayed UCLK
!     U0TCTL |= STC + CKPH + SSEL_SMCLK; 
  
      // as fast as possible
      U0BR0 = 0x02;
+     U0BR1 = 0;
+     U0MCTL = 0;
  
      // enable SPI
!     ME1 |= USPIE0;
! 
      U0CTL &= ~SWRST;  
      
***************
*** 60,64 ****
  
    command void HPLUSARTControl.disableI2C() {
!     U0CTL = 0;
      I2CTCTL = 0;
      call HPLUSARTControl.disableSPI();
--- 65,70 ----
  
    command void HPLUSARTControl.disableI2C() {
!     U0CTL &= ~I2CEN;
!     U0CTL &= ~I2C;
      I2CTCTL = 0;
      call HPLUSARTControl.disableSPI();
***************
*** 66,75 ****
  
    command void HPLUSARTControl.setModeI2C() {
-    
      // Recommended init procedure
      U0CTL = I2C + SYNC + MST;
  
      // use 1MHz SMCLK as the I2C reference
!     I2CTCTL = I2CSSEL_2 | I2CTRX;
  
      // Enable I2C
--- 72,80 ----
  
    command void HPLUSARTControl.setModeI2C() {
      // Recommended init procedure
      U0CTL = I2C + SYNC + MST;
  
      // use 1MHz SMCLK as the I2C reference
!     I2CTCTL |= I2CSSEL_2 | I2CTRX;
  
      // Enable I2C



More information about the Tinyos-commits mailing list