linux: Set the SPI mode in spidev.c

Fix omission causing the SPI mode to not be set on the linux mcu.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-07-30 17:43:12 -04:00
parent 1f7c3fc8ec
commit 0f3b1bce66
1 changed files with 5 additions and 0 deletions

View File

@ -70,6 +70,11 @@ spi_setup(uint32_t bus, uint8_t mode, uint32_t rate)
report_errno("ioctl set max spi speed", ret); report_errno("ioctl set max spi speed", ret);
shutdown("Unable to set SPI speed"); shutdown("Unable to set SPI speed");
} }
ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
if (ret < 0) {
report_errno("ioctl set spi mode", ret);
shutdown("Unable to set SPI mode");
}
return (struct spi_config) { fd , rate}; return (struct spi_config) { fd , rate};
} }