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

Allow USE_HAL_PPP_REGISTER_CALLBACKS redefinition #2079

Closed
fpistm opened this issue Jul 21, 2023 · 0 comments · Fixed by #2080
Closed

Allow USE_HAL_PPP_REGISTER_CALLBACKS redefinition #2079

fpistm opened this issue Jul 21, 2023 · 0 comments · Fixed by #2080

Comments

@fpistm
Copy link
Member

fpistm commented Jul 21, 2023

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")
@fpistm fpistm added this to the 2.7.0 milestone Jul 21, 2023
@fpistm fpistm added this to To do in STM32 core based on ST HAL via automation Jul 21, 2023
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this issue Jul 21, 2023
Fixes stm32duino#2079

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
STM32 core based on ST HAL automation moved this from To do to Done Jul 21, 2023
fpistm added a commit that referenced this issue Jul 21, 2023
Fixes #2079

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

1 participant