Private
Public Access
2
0

spi: return int instead of uint8_t in mraa_spi_write

This stops the error code getting lost since -1 wraps around to 0xFF when cast
to a uint8_t. This fixes #146

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2015-03-03 16:20:29 +00:00
parent 7375146295
commit f854a2b410
3 changed files with 7 additions and 7 deletions

View File

@@ -102,9 +102,9 @@ mraa_result_t mraa_spi_frequency(mraa_spi_context dev, int hz);
*
* @param dev The Spi context
* @param data Data to send
* @return Data received on the miso line
* @return Data received on the miso line or -1 in case of error
*/
uint8_t mraa_spi_write(mraa_spi_context dev, uint8_t data);
int mraa_spi_write(mraa_spi_context dev, uint8_t data);
/**
*Write Two Bytes to the SPI device.

View File

@@ -93,9 +93,9 @@ class Spi {
* Write single byte to the SPI device
*
* @param data the byte to send
* @return data received on the miso line
* @return data received on the miso line or -1 in case of error
*/
uint8_t writeByte(uint8_t data) {
int writeByte(uint8_t data) {
return mraa_spi_write(m_spi, (uint8_t) data);
}