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

Call spiCalculateDivider() to allow validation as per ledvinap comment

This commit is contained in:
Steve Evans 2022-01-05 19:00:26 +00:00
parent 4aab87539f
commit 70e22b61c4
2 changed files with 6 additions and 7 deletions

View file

@ -395,21 +395,20 @@ max7456InitStatus_e max7456Init(const max7456Config_t *max7456Config, const vcdP
} }
#if defined(USE_OVERCLOCK) #if defined(USE_OVERCLOCK)
max7456SpiClockDiv = spiCalculateDivider(MAX7456_MAX_SPI_CLK_HZ);
// Determine SPI clock divisor based on config and the device type. // Determine SPI clock divisor based on config and the device type.
switch (max7456Config->clockConfig) { switch (max7456Config->clockConfig) {
case MAX7456_CLOCK_CONFIG_HALF: case MAX7456_CLOCK_CONFIG_HALF:
max7456SpiClockDiv <<= 1; max7456SpiClockDiv = spiCalculateDivider(MAX7456_MAX_SPI_CLK_HZ / 2);
break; break;
case MAX7456_CLOCK_CONFIG_NOMINAL: case MAX7456_CLOCK_CONFIG_NOMINAL:
default: default:
max7456SpiClockDiv = spiCalculateDivider(MAX7456_MAX_SPI_CLK_HZ);
break; break;
case MAX7456_CLOCK_CONFIG_DOUBLE: case MAX7456_CLOCK_CONFIG_DOUBLE:
max7456SpiClockDiv >>= 1; max7456SpiClockDiv = spiCalculateDivider(MAX7456_MAX_SPI_CLK_HZ * 2);
break; break;
} }

View file

@ -840,15 +840,15 @@ bool expressLrsSpiInit(const struct rxSpiConfig_s *rxConfig, struct rxRuntimeSta
} }
rxSpiCommonIOInit(rxConfig); rxSpiCommonIOInit(rxConfig);
rxRuntimeState->channelCount = ELRS_MAX_CHANNELS; rxRuntimeState->channelCount = ELRS_MAX_CHANNELS;
extiConfig->ioConfig = IOCFG_IPD; extiConfig->ioConfig = IOCFG_IPD;
extiConfig->trigger = BETAFLIGHT_EXTI_TRIGGER_RISING; extiConfig->trigger = BETAFLIGHT_EXTI_TRIGGER_RISING;
if (rxExpressLrsSpiConfig()->resetIoTag) { if (rxExpressLrsSpiConfig()->resetIoTag) {
receiver.resetPin = IOGetByTag(rxExpressLrsSpiConfig()->resetIoTag); receiver.resetPin = IOGetByTag(rxExpressLrsSpiConfig()->resetIoTag);
} else { } else {
receiver.resetPin = IO_NONE; receiver.resetPin = IO_NONE;
} }