spi: mraa_spi_write_word can now return -1 in error cases
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -117,7 +117,7 @@ int mraa_spi_write(mraa_spi_context dev, uint8_t data);
|
|||||||
* @param data Data to send
|
* @param data Data to send
|
||||||
* @return Data received on the miso line
|
* @return Data received on the miso line
|
||||||
*/
|
*/
|
||||||
uint16_t mraa_spi_write_word(mraa_spi_context dev, uint16_t data);
|
int mraa_spi_write_word(mraa_spi_context dev, uint16_t data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write Buffer of bytes to the SPI device. The pointer return has to be
|
* Write Buffer of bytes to the SPI device. The pointer return has to be
|
||||||
|
|||||||
@@ -127,9 +127,9 @@ class Spi
|
|||||||
* Write single byte to the SPI device
|
* Write single byte to the SPI device
|
||||||
*
|
*
|
||||||
* @param data the byte to send
|
* @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
|
||||||
*/
|
*/
|
||||||
uint16_t
|
int
|
||||||
write_word(uint16_t data)
|
write_word(uint16_t data)
|
||||||
{
|
{
|
||||||
return mraa_spi_write_word(m_spi, (uint16_t) data);
|
return mraa_spi_write_word(m_spi, (uint16_t) data);
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ mraa_spi_write(mraa_spi_context dev, uint8_t data)
|
|||||||
return (int) recv;
|
return (int) recv;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t
|
int
|
||||||
mraa_spi_write_word(mraa_spi_context dev, uint16_t data)
|
mraa_spi_write_word(mraa_spi_context dev, uint16_t data)
|
||||||
{
|
{
|
||||||
struct spi_ioc_transfer msg;
|
struct spi_ioc_transfer msg;
|
||||||
@@ -286,7 +286,7 @@ mraa_spi_write_word(mraa_spi_context dev, uint16_t data)
|
|||||||
syslog(LOG_ERR, "spi: Failed to perform dev transfer");
|
syslog(LOG_ERR, "spi: Failed to perform dev transfer");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return recv;
|
return (int) recv;
|
||||||
}
|
}
|
||||||
|
|
||||||
mraa_result_t
|
mraa_result_t
|
||||||
|
|||||||
Reference in New Issue
Block a user