Skip to content

Commit f081e5a

Browse files
committed
Changed lis2mdl driver from SPI_SEND to SPI_EXHANGE
1 parent 3a5df83 commit f081e5a

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

drivers/sensors/lis2mdl_uorb.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,7 @@ static int lis2mdl_read_reg(FAR struct lis2mdl_dev_s *dev, uint8_t addr,
259259
SPI_SETFREQUENCY(spi, CONFIG_SENSORS_LIS2MDL_SPI_FREQUENCY);
260260
SPI_SELECT(spi, id, true);
261261
SPI_SEND(spi, addr | 0x80); /* bit 7 = read */
262-
for (uint8_t i = 0; i < nbytes; i++)
263-
{
264-
((uint8_t *)buf)[i] = (uint8_t)SPI_SEND(spi, 0xff);
265-
}
266-
262+
SPI_EXCHANGE(spi, NULL, buf, nbytes);
267263
SPI_SELECT(spi, id, false);
268264
SPI_LOCK(spi, false);
269265
return nbytes;

0 commit comments

Comments
 (0)