chore: centralize board manufacturer/model/USB identity in hw_defs JSON (#7786)
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
598255e1d1
commit
425944bff2
@@ -58,6 +58,8 @@ def generate_from_template(json_filename, template_filename, target):
|
||||
trims = root_obj.get("trims")
|
||||
trim_gpios = json_index.build_trim_gpio_port_index(trims)
|
||||
|
||||
identity = root_obj.get("identity")
|
||||
|
||||
legacy_inputs = legacy_names.inputs_by_target(target)
|
||||
|
||||
template_dir = os.path.dirname(os.path.abspath(template_filename))
|
||||
@@ -80,6 +82,7 @@ def generate_from_template(json_filename, template_filename, target):
|
||||
switches=hw_def.switches,
|
||||
keys=hw_def.keys,
|
||||
trims=trims,
|
||||
identity=identity,
|
||||
adc_index=adc_index,
|
||||
adc_gpios=adc_gpios,
|
||||
switch_gpios=switch_gpios,
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
//
|
||||
|
||||
#pragma once
|
||||
{% if identity %}
|
||||
|
||||
// Identity
|
||||
#define MANUFACTURER_{{ identity.manufacturer.upper() }}
|
||||
{% endif -%}
|
||||
|
||||
{% if timers %}
|
||||
|
||||
// Timers
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// WARNING: DO NOT EDIT THIS FILE
|
||||
// This file has been generated from the target's JSON hardware description
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#define USB_NAME "{{ identity.manufacturer }} {{ identity.model }}"
|
||||
#define USB_MANUFACTURER {% for c in identity.usb_manufacturer.ljust(8) %}'{{ c }}'{% if not loop.last %}, {% endif %}{% endfor %} /* 8 bytes */
|
||||
#define USB_PRODUCT {% for c in identity.usb_product.ljust(8) %}'{{ c }}'{% if not loop.last %}, {% endif %}{% endfor %} /* 8 Bytes */
|
||||
Reference in New Issue
Block a user