]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Return a real error code and actual bytes written in SpiPacket.sendDone.
authorsmckown <smckown@4bc1554a-c7f2-4f65-a403-e0be01f0239c>
Fri, 8 May 2009 22:27:16 +0000 (22:27 +0000)
committerR. Steve McKown <rsmckown@gmail.com>
Tue, 1 Dec 2009 03:01:32 +0000 (20:01 -0700)
Be careful with this one.  The usart SPI peripheral always returned the length
it was given and an error of SUCCESS, so this could create some regressions.

tos/chips/msp430/usci/Msp430SpiP.nc

index 0aaf9bd34c06c17784a526fa9c4d1aa7675d8537..b040053a252738a6eead2df2af4a9aaace7a1bbe 100644 (file)
@@ -164,9 +164,10 @@ implementation {
   task void signalSendDone()
   {
     atomic {
-      uint16_t len = m_len;
+      error_t error = (m_pos == m_len) ? SUCCESS : FAIL;
+
       m_len = 0;
-      signal SpiPacket.sendDone(m_txBuf, m_rxBuf, len, SUCCESS);
+      signal SpiPacket.sendDone(m_txBuf, m_rxBuf, m_pos, error);
     }
   }