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:
parent
a1c6cda572
commit
7ef7795944
10 changed files with 114 additions and 45 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue