stm32/boards/make-pins.py: Generate empty ADC table if needed.
If ADCx pins are hidden, print an empty table to prevent linker errors.
This commit is contained in:
parent
1dc532019b
commit
bedd9c5463
@ -426,16 +426,19 @@ class Pins(object):
|
|||||||
adc_pins[pin.adc_channel] = pin
|
adc_pins[pin.adc_channel] = pin
|
||||||
if adc_pins:
|
if adc_pins:
|
||||||
table_size = max(adc_pins) + 1
|
table_size = max(adc_pins) + 1
|
||||||
self.adc_table_size[adc_num] = table_size
|
else:
|
||||||
print("")
|
# If ADCx pins are hidden, print an empty table to prevent linker errors.
|
||||||
print("const pin_obj_t * const pin_adc{:d}[{:d}] = {{".format(adc_num, table_size))
|
table_size = 0
|
||||||
for channel in range(table_size):
|
self.adc_table_size[adc_num] = table_size
|
||||||
if channel in adc_pins:
|
print("")
|
||||||
obj = "&pin_{:s}_obj".format(adc_pins[channel].cpu_pin_name())
|
print("const pin_obj_t * const pin_adc{:d}[{:d}] = {{".format(adc_num, table_size))
|
||||||
else:
|
for channel in range(table_size):
|
||||||
obj = "NULL"
|
if channel in adc_pins:
|
||||||
print(" [{:d}] = {},".format(channel, obj))
|
obj = "&pin_{:s}_obj".format(adc_pins[channel].cpu_pin_name())
|
||||||
print("};")
|
else:
|
||||||
|
obj = "NULL"
|
||||||
|
print(" [{:d}] = {},".format(channel, obj))
|
||||||
|
print("};")
|
||||||
|
|
||||||
def print_header(self, hdr_filename, obj_decls):
|
def print_header(self, hdr_filename, obj_decls):
|
||||||
with open(hdr_filename, "wt") as hdr_file:
|
with open(hdr_filename, "wt") as hdr_file:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user