1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 08:15:30 +03:00

Support dual gyros sharing a common SPI bus

This commit is contained in:
Steve Evans 2021-10-03 01:14:58 +01:00
parent a1c6cda572
commit 7ef7795944
10 changed files with 114 additions and 45 deletions

View file

@ -270,7 +270,7 @@ void spiInternalStopDMA (const extDevice_t *dev)
}
// DMA transfer setup and start
void spiSequence(const extDevice_t *dev, busSegment_t *segments)
void spiSequenceStart(const extDevice_t *dev, busSegment_t *segments)
{
busDevice_t *bus = dev->bus;
SPI_TypeDef *instance = bus->busType_u.spi.instance;
@ -360,7 +360,16 @@ void spiSequence(const extDevice_t *dev, busSegment_t *segments)
bus->curSegment++;
}
bus->curSegment = (busSegment_t *)NULL;
// If a following transaction has been linked, start it
if (bus->curSegment->txData) {
const extDevice_t *nextDev = (const extDevice_t *)bus->curSegment->txData;
busSegment_t *nextSegments = (busSegment_t *)bus->curSegment->rxData;
bus->curSegment->txData = NULL;
spiSequenceStart(nextDev, nextSegments);
} else {
// The end of the segment list has been reached, so mark transactions as complete
bus->curSegment = (busSegment_t *)NULL;
}
}
}
#endif