spi.c: introduced a _replace hook for spi_lsbmode()
This could be generally useful and more specifically is a prerequisite for issue #178. Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
44047e746f
commit
5adc951f57
@@ -61,6 +61,7 @@ typedef struct {
|
||||
|
||||
mraa_result_t (*spi_init_pre) (int bus);
|
||||
mraa_result_t (*spi_init_post) (mraa_spi_context spi);
|
||||
mraa_result_t (*spi_lsbmode_replace) (mraa_spi_context dev, mraa_boolean_t lsb);
|
||||
|
||||
mraa_result_t (*uart_init_pre) (int index);
|
||||
mraa_result_t (*uart_init_post) (mraa_uart_context uart);
|
||||
|
||||
@@ -196,6 +196,10 @@ mraa_spi_frequency(mraa_spi_context dev, int hz)
|
||||
mraa_result_t
|
||||
mraa_spi_lsbmode(mraa_spi_context dev, mraa_boolean_t lsb)
|
||||
{
|
||||
if (advance_func->spi_lsbmode_replace != NULL) {
|
||||
return advance_func->spi_lsbmode_replace(dev, lsb);
|
||||
}
|
||||
|
||||
uint8_t lsb_mode = (uint8_t) lsb;
|
||||
if (ioctl(dev->devfd, SPI_IOC_WR_LSB_FIRST, &lsb_mode) < 0) {
|
||||
syslog(LOG_ERR, "spi: Failed to set bit order");
|
||||
|
||||
Reference in New Issue
Block a user