usb_cables: also generate optional pin pairs definittions
This commit is contained in:
parent
3bdad80428
commit
cbd67810f4
|
@ -34,7 +34,7 @@ class String
|
|||
end
|
||||
|
||||
# variable to process regexp
|
||||
cable_regex = /static const uint8_t (?<variable>usb__(?<connector1>\w+)__(?<connector2>\w+)__(?<name>\w+)_pins)\[\]\[2\] = (?<array>\{[^;]+\});/m
|
||||
cable_regex = /static const uint8_t (?<variable>usb__(?<connector1>\w+)__(?<connector2>\w+)__(?<name>\w+)_(?<type>pins|opts))\[\]\[2\] = (?<array>\{[^;]+\});/m
|
||||
# read C definitions file
|
||||
usb_cables_text = IO.read("usb_cables.c")
|
||||
output_text = usb_cables_text.dup
|
||||
|
@ -45,7 +45,7 @@ cables.each_index do |i|
|
|||
next if 0 == i
|
||||
cable = cables[i]
|
||||
# find if there was a previously matching definition
|
||||
template = cables[0, i].filter {|c| c[:name] == cable[:name]}.first
|
||||
template = cables[0, i].filter {|c| c[:name] == cable[:name] and c[:type] == cable[:type]}.first
|
||||
next unless template
|
||||
puts "generate #{cable[:variable]} usng #{template[:variable]}"
|
||||
array = template[:array]
|
||||
|
|
Loading…
Reference in New Issue