sys/arduino: update SPI class to new API
This commit is contained in:
parent
198046e167
commit
2efc50be97
@ -78,13 +78,7 @@ void SPIClass::beginTransaction(SPISettings settings)
|
|||||||
{
|
{
|
||||||
rmutex_lock(&mut);
|
rmutex_lock(&mut);
|
||||||
/* Call spi_acquire first to prevent data races */
|
/* Call spi_acquire first to prevent data races */
|
||||||
int retval = spi_acquire(spi_dev, SPI_CS_UNDEF,
|
spi_acquire(spi_dev, SPI_CS_UNDEF, settings.mode, settings.clock);
|
||||||
settings.mode, settings.clock);
|
|
||||||
/* No support for exceptions (at least on AVR), resort to assert() */
|
|
||||||
assert(retval == SPI_OK);
|
|
||||||
if (retval != SPI_OK) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
is_transaction = true;
|
is_transaction = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,13 +94,7 @@ void SPIClass::transfer(void *buf, size_t count)
|
|||||||
rmutex_lock(&mut);
|
rmutex_lock(&mut);
|
||||||
|
|
||||||
if (!is_transaction) {
|
if (!is_transaction) {
|
||||||
int retval = spi_acquire(spi_dev, SPI_CS_UNDEF,
|
spi_acquire(spi_dev, SPI_CS_UNDEF, settings.mode, settings.clock);
|
||||||
settings.mode, settings.clock);
|
|
||||||
/* No support for exceptions (at least on AVR), resort to assert() */
|
|
||||||
assert(retval == SPI_OK);
|
|
||||||
if (retval != SPI_OK) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
spi_transfer_bytes(spi_dev, SPI_CS_UNDEF, false, buf, buf, count);
|
spi_transfer_bytes(spi_dev, SPI_CS_UNDEF, false, buf, buf, count);
|
||||||
if (!is_transaction) {
|
if (!is_transaction) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user