mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 17:25:18 +03:00
Add definition for MAX_SPI_SPEED to limit spi seed if defined for target
This commit is contained in:
parent
2337752e81
commit
ea685fe2f5
2 changed files with 8 additions and 0 deletions
|
@ -33,6 +33,12 @@ void spiBusSetSpeed(const busDevice_t * dev, busSpeed_e speed)
|
|||
{
|
||||
const SPIClockSpeed_e spiClock[] = { SPI_CLOCK_INITIALIZATON, SPI_CLOCK_SLOW, SPI_CLOCK_STANDARD, SPI_CLOCK_FAST, SPI_CLOCK_ULTRAFAST };
|
||||
SPI_TypeDef * instance = spiInstanceByDevice(dev->busdev.spi.spiBus);
|
||||
|
||||
#ifdef MAX_SPI_SPEED
|
||||
if (speed > MAX_SPI_SPEED)
|
||||
speed = MAX_SPI_SPEED;
|
||||
#endif
|
||||
|
||||
spiSetSpeed(instance, spiClock[speed]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue