HAL_ChibiOS: auto-set HAL_LOGGING_ENABLED for AP_Periph builds

This commit is contained in:
Andrew Tridgell 2021-05-18 11:07:12 +10:00
parent dbf5357592
commit ebe858f762
1 changed files with 13 additions and 0 deletions

View File

@ -1794,6 +1794,7 @@ def write_hwdef_header(outfilename):
write_MAG_config(f)
write_BARO_config(f)
write_board_validate_macro(f)
add_apperiph_defaults(f)
write_peripheral_enable(f)
@ -2150,6 +2151,18 @@ def process_file(filename):
else:
process_line(line)
def add_apperiph_defaults(f):
'''add default defines for peripherals'''
if env_vars.get('AP_PERIPH',0) == 0:
# not AP_Periph
return
print("Setting up as AP_Periph")
f.write('''
#ifndef HAL_LOGGING_ENABLED
#define HAL_LOGGING_ENABLED 0
#endif
''')
# process input file
process_file(args.hwdef)