Made the timerioTagGetByUsage zero based, as it is not used by users.
This commit is contained in:
parent
aad6efdf03
commit
88ed243d32
|
@ -60,10 +60,10 @@ const timerHardware_t *timerGetByTag(ioTag_t ioTag)
|
||||||
|
|
||||||
ioTag_t timerioTagGetByUsage(timerUsageFlag_e usageFlag, uint8_t index)
|
ioTag_t timerioTagGetByUsage(timerUsageFlag_e usageFlag, uint8_t index)
|
||||||
{
|
{
|
||||||
uint8_t currentIndex = 1;
|
uint8_t currentIndex = 0;
|
||||||
for (int i = 0; i < (int)USABLE_TIMER_CHANNEL_COUNT; i++) {
|
for (int i = 0; i < (int)USABLE_TIMER_CHANNEL_COUNT; i++) {
|
||||||
if ((timerHardware[i].usageFlags & usageFlag) == usageFlag) {
|
if ((timerHardware[i].usageFlags & usageFlag) == usageFlag) {
|
||||||
if (currentIndex == index || index == 0) {
|
if (currentIndex == index) {
|
||||||
return timerHardware[i].tag;
|
return timerHardware[i].tag;
|
||||||
}
|
}
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
|
|
|
@ -105,7 +105,7 @@ void pgResetFn_motorConfig(motorConfig_t *motorConfig)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int motorIndex = 0; motorIndex < MAX_SUPPORTED_MOTORS; motorIndex++) {
|
for (int motorIndex = 0; motorIndex < MAX_SUPPORTED_MOTORS; motorIndex++) {
|
||||||
motorConfig->dev.ioTags[motorIndex] = timerioTagGetByUsage(TIM_USE_MOTOR, motorIndex + 1);
|
motorConfig->dev.ioTags[motorIndex] = timerioTagGetByUsage(TIM_USE_MOTOR, motorIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
motorConfig->motorPoleCount = 14; // Most brushes motors that we use are 14 poles
|
motorConfig->motorPoleCount = 14; // Most brushes motors that we use are 14 poles
|
||||||
|
|
|
@ -67,7 +67,7 @@ void pgResetFn_servoConfig(servoConfig_t *servoConfig)
|
||||||
servoConfig->channelForwardingStartChannel = AUX1;
|
servoConfig->channelForwardingStartChannel = AUX1;
|
||||||
|
|
||||||
for (unsigned servoIndex = 0; servoIndex < MAX_SUPPORTED_SERVOS; servoIndex++) {
|
for (unsigned servoIndex = 0; servoIndex < MAX_SUPPORTED_SERVOS; servoIndex++) {
|
||||||
servoConfig->dev.ioTags[servoIndex] = timerioTagGetByUsage(TIM_USE_SERVO, servoIndex + 1);
|
servoConfig->dev.ioTags[servoIndex] = timerioTagGetByUsage(TIM_USE_SERVO, servoIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ void pgResetFn_pwmConfig(pwmConfig_t *pwmConfig)
|
||||||
{
|
{
|
||||||
pwmConfig->inputFilteringMode = INPUT_FILTERING_DISABLED;
|
pwmConfig->inputFilteringMode = INPUT_FILTERING_DISABLED;
|
||||||
for (unsigned inputIndex = 0; inputIndex < PWM_INPUT_PORT_COUNT; inputIndex++) {
|
for (unsigned inputIndex = 0; inputIndex < PWM_INPUT_PORT_COUNT; inputIndex++) {
|
||||||
pwmConfig->ioTags[inputIndex] = timerioTagGetByUsage(TIM_USE_PWM, inputIndex + 1);
|
pwmConfig->ioTags[inputIndex] = timerioTagGetByUsage(TIM_USE_PWM, inputIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue