]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Add getOut() and getOutRaw() methods. get() and getRaw() work off PORTxIN.
authorsmckown <smckown@4bc1554a-c7f2-4f65-a403-e0be01f0239c>
Sun, 7 Sep 2008 18:21:30 +0000 (18:21 +0000)
committerR. Steve McKown <rsmckown@gmail.com>
Tue, 1 Dec 2009 03:00:48 +0000 (20:00 -0700)
But there are times when PORTxIN and PORTx (PxOUT) may be different, such as
is the case when using pull-up or pull-down resistors via PORTxREN (PxREN)
available on newer msp430's.

tos/chips/msp430/pins/HplMsp430GeneralIO.nc
tos/chips/msp430/pins/HplMsp430GeneralIOP.nc
tos/chips/msp430/pins/HplMsp430GeneralIORenP.nc

index 3615b3abe5da3396822e625f1a2387daf5274364..f9e42e43343627d20b81ffeb1375d4872507363b 100644 (file)
@@ -43,6 +43,20 @@ interface HplMsp430GeneralIO
    */
   async command void toggle();
 
+  /**
+   * Get the port OUT status that contains the pin.
+   *
+   * @return Status of the port that contains the given pin. The x'th
+   * pin on the port will be represented in the x'th bit.
+   */
+  async command uint8_t getOutRaw();
+
+  /**
+   * Read pin OUT value.
+   *
+   * @return TRUE if pin is high, FALSE otherwise.
+   */
+  async command bool getOut();
   /**
    * Get the port status that contains the pin.
    *
@@ -97,5 +111,10 @@ interface HplMsp430GeneralIO
    * Disable pullup/pulldown resistor.
    */
   async command void disableRen();
+
+  /**
+   * Return true if pullup/pulldown resistor is enabled
+   */
+  async command bool isRen();
 }
 
index 976eb5192c77ce3fbb6390f6a08f4e5c095aa7bd..78104ac31d9f8fd03a797449263f27a845109502 100644 (file)
@@ -45,6 +45,8 @@ implementation
   async command void IO.set() { atomic PORTx |= (0x01 << pin); }
   async command void IO.clr() { atomic PORTx &= ~(0x01 << pin); }
   async command void IO.toggle() { atomic PORTx ^= (0x01 << pin); }
+  async command uint8_t IO.getOutRaw() { return PORTx & (0x01 << pin); }
+  async command bool IO.getOut() { return IO.getOutRaw() != 0; }
   async command uint8_t IO.getRaw() { return PORTxIN & (0x01 << pin); }
   async command bool IO.get() { return (call IO.getRaw() != 0); }
   async command void IO.makeInput() { atomic PORTxDIR &= ~(0x01 << pin); }
@@ -57,4 +59,5 @@ implementation
   async command bool IO.isIOFunc() { return (PORTxSEL & (0x01<<pin)) == 0; }
   async command void IO.enableRen() {}
   async command void IO.disableRen() {}
+  async command bool IO.isRen() { return false; }
 }
index 82cb01486c488326d9695e69f8b6aeca9f1ce83e..e799bcd627af8cab408d34c3543ee9ec5dcffc39 100644 (file)
@@ -55,6 +55,8 @@ implementation
   async command void IO.set() { atomic PORTx |= (0x01 << pin); }
   async command void IO.clr() { atomic PORTx &= ~(0x01 << pin); }
   async command void IO.toggle() { atomic PORTx ^= (0x01 << pin); }
+  async command uint8_t IO.getOutRaw() { return PORTx & (0x01 << pin); }
+  async command bool IO.getOut() { return (call IO.getOutRaw() != 0); }
   async command uint8_t IO.getRaw() { return PORTxIN & (0x01 << pin); }
   async command bool IO.get() { return (call IO.getRaw() != 0); }
   async command void IO.makeInput() { atomic PORTxDIR &= ~(0x01 << pin); }
@@ -67,4 +69,5 @@ implementation
   async command bool IO.isIOFunc() { return (PORTxSEL & (0x01<<pin)) == 0; }
   async command void IO.enableRen() { atomic PORTxREN |= (0x01 << pin); }
   async command void IO.disableRen() { atomic PORTxREN &= ~(0x01 << pin); }
+  async command void IO.isRen() { return PORTxREN = (0x01 << pin) != 0; }
 }