fix: PWM gimbals initialisation and inversion (#3745)

* fix: PWM gimbals initialisation and inversion

* feat: add periph clock support in PWM stick driver
This commit is contained in:
Raphael Coeffic
2023-07-14 14:54:32 +10:00
committed by GitHub
parent c5aa250dd9
commit 1bb27e7011
17 changed files with 282 additions and 144 deletions
@@ -21,5 +21,29 @@
#pragma once
#include <stdint.h>
#include "stm32_hal_ll.h"
struct stick_pwm_input_t {
uint8_t channel;
uint8_t inverted;
};
struct stick_pwm_timer_t {
GPIO_TypeDef* GPIOx;
uint32_t GPIO_Pin;
uint32_t GPIO_Alternate;
TIM_TypeDef* TIMx;
IRQn_Type TIM_IRQn;
};
// returns 'true' if PWM sticks have been detected
bool sticksPwmDetect();
bool sticks_pwm_detect(const stick_pwm_timer_t* timer,
const stick_pwm_input_t* inputs,
uint8_t n_inputs);
void sticks_pwm_isr(const stick_pwm_timer_t* tim,
const stick_pwm_input_t* inputs,
uint8_t n_inputs);