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:
@@ -224,8 +224,13 @@ class ADCInputParser:
|
||||
|
||||
def _add_input(self, adc_input):
|
||||
if adc_input is not None:
|
||||
idx = len(self.inputs)
|
||||
if adc_input.type == 'STICK':
|
||||
if 'PWM_STICKS' in self.hw_defs:
|
||||
ch = self.hw_defs.get(f'STICK_PWM_CHANNEL_{adc_input.name}')
|
||||
adc_input.pwm_channel = idx if ch is None else ch
|
||||
if adc_input.type != 'VBAT' and adc_input.type != 'RTC_BAT':
|
||||
d = self.dirs[len(self.inputs)]
|
||||
d = self.dirs[idx]
|
||||
if d < 0:
|
||||
adc_input.inverted = True
|
||||
if adc_input.type == 'POT':
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
static const stm32_adc_input_t _ADC_inputs[] = {
|
||||
{% for input in adc_inputs.inputs %}
|
||||
{
|
||||
"{{ input.name }}",
|
||||
// ADC_INPUT_{{ input.type }},
|
||||
{{ input.gpio if input.gpio else 'nullptr' }},
|
||||
{{ input.pin if input.gpio else '0' }},
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// WARNING: DO NOT EDIT THIS FILE
|
||||
// This file has been generated from the target's JSON hardware description
|
||||
//
|
||||
|
||||
{% set pwm_inputs = adc_inputs.inputs | selectattr('pwm_channel', 'defined') | list %}
|
||||
static const stick_pwm_input_t _PWM_inputs[] = {
|
||||
{% for input in pwm_inputs %}
|
||||
{
|
||||
// ADC_INPUT_{{ input.type }}, {{ input.name }}
|
||||
{{ input.pwm_channel }}, // channel
|
||||
{{ '1 // inverted' if input.inverted else '0 // normal' }}
|
||||
},
|
||||
{% endfor %}
|
||||
};
|
||||
Reference in New Issue
Block a user