io_timer: reserve pins & timers on first use

This allows modules to do a first-come-first-serve pin/timer reservation
on bootup.
E.g. camera trigger reserves any of the pins, and then PWM/DShot output
will just use the rest of the available pins.
This commit is contained in:
Beat Küng
2021-09-08 16:10:24 -04:00
committed by Daniel Agar
parent 0d7176b766
commit 847bd120fa
18 changed files with 260 additions and 203 deletions
+4 -3
View File
@@ -49,8 +49,9 @@ __BEGIN_DECLS
*
* @param channel_mask Bitmask of channels (LSB = channel 0) to enable.
* This allows some of the channels to remain configured
* as GPIOs or as another function.
* @return OK on success.
* as GPIOs or as another function. Already used channels/timers
* will not be configured as PWM.
* @return <0 on error, the initialized channels mask.
*/
__EXPORT extern int up_pwm_trigger_init(uint32_t channel_mask);
@@ -78,4 +79,4 @@ __EXPORT extern void up_pwm_trigger_arm(bool armed);
*/
__EXPORT extern int up_pwm_trigger_set(unsigned channel, uint16_t value);
__END_DECLS
__END_DECLS