Skip to content
Snippets Groups Projects
Commit 21859af6 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

Add check of return value in drivers affected by last change: Report the...

Add check of return value in drivers affected by last change:  Report the error on a failure to set the bit order.
parent 7d4cb73b
No related branches found
No related tags found
No related merge requests found
......@@ -272,6 +272,8 @@ static inline int __test_bit(int nr, const volatile uint8_t * addr)
static void memlcd_select(FAR struct spi_dev_s *spi)
{
int ret;
/* Select memlcd (locking the SPI bus in case there are multiple
* devices competing for the SPI bus
*/
......@@ -285,7 +287,13 @@ static void memlcd_select(FAR struct spi_dev_s *spi)
SPI_SETMODE(spi, MEMLCD_SPI_MODE);
SPI_SETBITS(spi, MEMLCD_SPI_BITS);
(void)SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
ret = SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
if (ret < 0)
{
lcderr("ERROR: SPI_HWFEATURES failed to set bit order: %d\n", ret);
}
#ifdef CONFIG_MEMLCD_SPI_FREQUENCY
(void)SPI_SETFREQUENCY(spi, CONFIG_MEMLCD_SPI_FREQUENCY);
#else
......
......@@ -149,11 +149,19 @@ static const uint8_t pn532ack[] =
static void pn532_lock(FAR struct spi_dev_s *spi)
{
int ret;
(void)SPI_LOCK(spi, true);
SPI_SETMODE(spi, SPIDEV_MODE0);
SPI_SETBITS(spi, 8);
(void)SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
ret = SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
if (ret < 0)
{
pn532err("ERROR: SPI_HWFEATURES failed to set bit order: %d\n", ret);
}
(void)SPI_SETFREQUENCY(spi, CONFIG_PN532_SPI_FREQ);
}
......@@ -164,11 +172,19 @@ static void pn532_unlock(FAR struct spi_dev_s *spi)
static inline void pn532_configspi(FAR struct spi_dev_s *spi)
{
int ret;
/* Configure SPI for the PN532 module. */
SPI_SETMODE(spi, SPIDEV_MODE0);
SPI_SETBITS(spi, 8);
(void)SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
ret = SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
if (ret < 0)
{
pn532err("ERROR: SPI_HWFEATURES failed to set bit order: %d\n", ret);
}
(void)SPI_SETFREQUENCY(spi, CONFIG_PN532_SPI_FREQ);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment