Skip to content

Allow USE_HAL_PPP_REGISTER_CALLBACKS redefinition #2079

Closed
@fpistm

Description

@fpistm

Issue raised here:
https://www.stm32duino.com/viewtopic.php?t=2060

Script used to update all hal_conf_default files:

import fileinput
import re
from pathlib import Path

script_path = Path(__file__).parent.resolve()
stm32_list = []  # series
dir_pattern = re.compile(r"^STM32(.*)xx$", re.IGNORECASE)
for file in script_path.iterdir():
    res = dir_pattern.match(file.name)
    if res:
        stm32_list.append(res.group(1))
stm32_list.sort()
conf_defaults = []
for serie in stm32_list:
    serie_path = script_path / f"STM32{serie}xx"
    conf_defaults.append(serie_path / f"stm32{serie.lower()}xx_hal_conf_default.h")
regex_module = re.compile(r"#define\s+(USE_HAL_\w+_REGISTER_CALLBACKS)")

for conf_default in conf_defaults:
    for line in fileinput.input(conf_default, inplace=True):
        m = regex_module.search(line)
        if m:
            print(f"#if !defined({m.group(1)})")
        print(line, end="")
        if m:
            print("#endif")

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions