dshot: remove BOARD_DSHOT_MOTOR_ASSIGNMENT & handle timer channel gaps

This commit is contained in:
Beat Küng
2022-01-21 20:41:15 -05:00
committed by Daniel Agar
parent 4de9c598fa
commit 92769bd2b2
26 changed files with 33 additions and 33 deletions
@@ -58,6 +58,8 @@ static inline constexpr io_timers_channel_mapping_t initIOTimerChannelMapping(co
}
uint32_t first_channel = UINT32_MAX;
uint32_t min_timer_channel = UINT32_MAX;
uint32_t max_timer_channel = 0;
uint32_t channel_count = 0;
for (uint32_t channel = 0; channel < MAX_TIMER_IO_CHANNELS; ++channel) {
@@ -74,11 +76,23 @@ static inline constexpr io_timers_channel_mapping_t initIOTimerChannelMapping(co
}
++channel_count;
if (timer_io_channels_conf[channel].timer_channel < min_timer_channel) {
min_timer_channel = timer_io_channels_conf[channel].timer_channel;
}
if (timer_io_channels_conf[channel].timer_channel > max_timer_channel) {
max_timer_channel = timer_io_channels_conf[channel].timer_channel;
}
}
}
if (first_channel == UINT32_MAX) { //unused timer, channel_count is 0
first_channel = 0;
} else {
ret.element[i].lowest_timer_channel = min_timer_channel;
ret.element[i].channel_count_including_gaps = max_timer_channel - min_timer_channel + 1;
}
ret.element[i].first_channel_index = first_channel;