1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-25 17:25:18 +03:00

Implement busTransferMultiple abstraction layer

This commit is contained in:
Konstantin Sharlaimov (DigitalEntity) 2017-12-04 01:44:40 +10:00
parent 15455c253d
commit 0ae6cb02d9
3 changed files with 44 additions and 16 deletions

View file

@ -37,12 +37,16 @@ void spiBusSetSpeed(const busDevice_t * dev, busSpeed_e speed)
}
bool spiBusTransfer(const busDevice_t * dev, uint8_t * rxBuf, const uint8_t * txBuf, int length)
bool spiBusTransferMultiple(const busDevice_t * dev, busTransferDescriptor_t * dsc, int count)
{
SPI_TypeDef * instance = spiInstanceByDevice(dev->busdev.spi.spiBus);
IOLo(dev->busdev.spi.csnPin);
spiTransfer(instance, rxBuf, txBuf, length);
for (int n = 0; n < count; n++) {
spiTransfer(instance, dsc[n].rxBuf, dsc[n].txBuf, dsc[n].length);
}
IOHi(dev->busdev.spi.csnPin);
return true;