Feature: individual STM32 timer oc mode calls #1500
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When implementing a new feature in Black Magic Debug to soft-start the target power output, we wound up having too interact with the timers and set up the output compare block mode for a channel. This pulls in an extra ~400 bytes of code due to the complex unoptimisable nature of the switch-case-in-switch-case setup of the STM32
timer_set_oc_mode()
function.This PR addresses some of this by splitting out the case logic of the outer switch-case into per-channel functions (still exposed by this unified mode set function), saving around 332 bytes when only a single channel is used. It otherwise maintains the exact same logic and call structure for existing code.