Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

st,stm32-adc: Add peripheral map to Analog.STM32x0_ADC #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion dts2repl/dts2repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def get_node_prop(node, prop, default=None, inherit=False):
elif prop in ('interrupts', 'reg', 'ranges'):
val = val.to_nums()
elif prop in ('#address-cells', '#size-cells', '#interrupt-cells', 'cc-num', 'clock-frequency',
'riscv,ndev'):
'riscv,ndev', 'vref-mv'):
val = val.to_num()
elif prop in ('interrupt-parent',):
val = val.to_node()
Expand Down Expand Up @@ -296,6 +296,16 @@ def renode_model_overlay(compat, mcu, overlays):
else:
model = 'Miscellaneous.STM32F4_RCC'

if compat == 'st,stm32-adc':
if 'st,stm32c0' in overlays:
model = 'Analog.STM32C0_ADC'
if 'st,stm32f0' in overlays:
model = 'Analog.STM32F0_ADC'
if 'st,stm32g0' in overlays:
model = 'Analog.STM32G0_ADC'
if 'st,stm32l0' in overlays:
model = 'Analog.STM32L0_ADC'

if compat == 'st,stm32-gpio' and 'st,stm32f1' in overlays:
model = 'GPIOPort.STM32F1GPIOPort'

Expand Down Expand Up @@ -772,6 +782,10 @@ def generate(args):
indent.append("%s: %s" % (attr, str(attribs[attr])))

# additional parameters for peripherals
if model in ['Analog.STM32C0_ADC', 'Analog.STM32F0_ADC', 'Analog.STM32G0_ADC', 'Analog.STM32L0_ADC']:
vref = get_node_prop(node, 'vref-mv', 3300) / 1000
indent.append(f'referenceVoltage: {vref}')
indent.append('externalEventFrequency: 1000')
if compat == "st,stm32-lpuart":
indent.append('frequency: 200000000')
if model == 'IRQControllers.PlatformLevelInterruptController':
Expand Down