mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-26 01:17:51 +08:00
imxrt: dshot add 1060 support and use channels instead of timers
This commit is contained in:
committed by
David Sidrane
parent
e2969952d3
commit
b0cb697f71
@@ -54,12 +54,21 @@ def extract_timer_from_channel(line, timer_names):
|
||||
|
||||
return None
|
||||
|
||||
def imxrt_is_dshot(line):
|
||||
|
||||
# NXP FlexPWM format format: initIOPWM(PWM::FlexPWM2),
|
||||
search = re.search('(initIOPWMDshot)', line, re.IGNORECASE)
|
||||
if search:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def get_timer_groups(timer_config_file, verbose=False):
|
||||
with open(timer_config_file, 'r') as f:
|
||||
timer_config = f.read()
|
||||
|
||||
# timers
|
||||
dshot_support = {} # key: timer
|
||||
dshot_support = {str(i): False for i in range(16)}
|
||||
timers_start_marker = 'io_timers_t io_timers'
|
||||
timers_start = timer_config.find(timers_start_marker)
|
||||
if timers_start == -1:
|
||||
@@ -78,10 +87,9 @@ def get_timer_groups(timer_config_file, verbose=False):
|
||||
if timer_type == 'imxrt':
|
||||
if verbose: print('imxrt timer found')
|
||||
timer_names.append(timer)
|
||||
if imxrt_is_dshot(line):
|
||||
dshot_support[str(len(timers))] = True
|
||||
timers.append(str(len(timers)))
|
||||
dshot_support = {str(i): False for i in range(16)}
|
||||
for i in range(8): # First 8 channels support dshot
|
||||
dshot_support[str(i)] = True
|
||||
elif timer:
|
||||
if verbose: print('found timer def: {:}'.format(timer))
|
||||
dshot_support[timer] = 'DMA' in line
|
||||
|
||||
Reference in New Issue
Block a user