diff options
Diffstat (limited to 'watch-library/hardware/watch')
-rw-r--r-- | watch-library/hardware/watch/watch_spi.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/watch-library/hardware/watch/watch_spi.c b/watch-library/hardware/watch/watch_spi.c index df68bbaa..8cdebb08 100644 --- a/watch-library/hardware/watch/watch_spi.c +++ b/watch-library/hardware/watch/watch_spi.c @@ -37,10 +37,18 @@ void watch_disable_spi(void) { spi_io = NULL; } -void watch_spi_send(uint8_t *buf, uint16_t length) { - io_write(spi_io, buf, length); +bool watch_spi_write(const uint8_t *buf, uint16_t length) { + return !!io_write(spi_io, buf, length); } -void watch_spi_receive(uint8_t *buf, uint16_t length) { - io_read(spi_io, buf, length); +bool watch_spi_read(uint8_t *buf, uint16_t length) { + return !!io_read(spi_io, buf, length); +} + +bool watch_spi_transfer(const uint8_t *data_out, uint8_t *data_in, uint16_t length) { + struct spi_xfer xfer; + xfer.txbuf = (uint8_t *)data_out; + xfer.rxbuf = data_in; + xfer.size = length; + return !!spi_m_sync_transfer(&SPI_0, &xfer); } |