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

Timer clean up in preparation for configurable timers

This commit is contained in:
blckmn 2018-05-06 06:54:39 +10:00
parent 5e1b5df5d4
commit aad6efdf03
19 changed files with 125 additions and 87 deletions

View file

@ -39,6 +39,7 @@
#include "drivers/pwm_output.h"
#include "drivers/pwm_esc_detect.h"
#include "drivers/time.h"
#include "drivers/io.h"
#include "io/motors.h"
@ -103,12 +104,8 @@ void pgResetFn_motorConfig(motorConfig_t *motorConfig)
motorConfig->dev.useBurstDshot = ENABLE_DSHOT_DMAR;
#endif
int motorIndex = 0;
for (int i = 0; i < USABLE_TIMER_CHANNEL_COUNT && motorIndex < MAX_SUPPORTED_MOTORS; i++) {
if (timerHardware[i].usageFlags & TIM_USE_MOTOR) {
motorConfig->dev.ioTags[motorIndex] = timerHardware[i].tag;
motorIndex++;
}
for (int motorIndex = 0; motorIndex < MAX_SUPPORTED_MOTORS; motorIndex++) {
motorConfig->dev.ioTags[motorIndex] = timerioTagGetByUsage(TIM_USE_MOTOR, motorIndex + 1);
}
motorConfig->motorPoleCount = 14; // Most brushes motors that we use are 14 poles