From 56ef4a7cec43b0cca7a98ed616aadb4796e54625 Mon Sep 17 00:00:00 2001 From: smckown Date: Fri, 8 May 2009 22:27:16 +0000 Subject: [PATCH] Return a real error code and actual bytes written in SpiPacket.sendDone. 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tos/chips/msp430/usci/Msp430SpiP.nc b/tos/chips/msp430/usci/Msp430SpiP.nc index 0aaf9bd3..b040053a 100644 --- a/tos/chips/msp430/usci/Msp430SpiP.nc +++ b/tos/chips/msp430/usci/Msp430SpiP.nc @@ -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); } } -- 2.39.2