Added support for bcm overlay numbers added dots
This commit is contained in:
parent
bf653c62e4
commit
a6e4d521e3
|
@ -29,8 +29,9 @@ overlays = [
|
|||
'skywriter-hat',
|
||||
'explorer-hat-pro',
|
||||
'explorer-hat',
|
||||
'display-o-tron'
|
||||
]
|
||||
'display-o-tron',
|
||||
'dots'
|
||||
]
|
||||
|
||||
template = open('template/layout.html').read()
|
||||
|
||||
|
@ -90,6 +91,18 @@ def load_overlay(overlay):
|
|||
uses_3v = False
|
||||
uses = 0
|
||||
for pin in loaded['pin']:
|
||||
if pin.startswith('bcm'):
|
||||
pin = pin[3:]
|
||||
for idx in pins:
|
||||
compare_pin = pins[idx]
|
||||
#print(compare_pin)
|
||||
if 'scheme' in compare_pin:
|
||||
if 'bcm' in compare_pin['scheme']:
|
||||
if compare_pin['scheme']['bcm'] == int(pin):
|
||||
print("Mapping BCM{} to {}".format(pin, str(idx)))
|
||||
pin = str(idx)
|
||||
break
|
||||
|
||||
if pin in pins:
|
||||
actual_pin = pins[pin]
|
||||
if actual_pin['type'] in ['+3v3','+5v','GND']:
|
||||
|
@ -201,10 +214,18 @@ def render_pin(pin_num, selected_url, overlay=None):
|
|||
pin_name = pin['name']
|
||||
pin_used = False
|
||||
pin_link_title = []
|
||||
bcm_pin = None
|
||||
if 'scheme' in pin:
|
||||
if 'bcm' in pin['scheme']:
|
||||
bcm_pin = 'bcm' + str(pin['scheme']['bcm'])
|
||||
|
||||
if overlay != None and ( str(pin_num) in overlay['pin'] or bcm_pin in overlay['pin']):
|
||||
|
||||
if str(pin_num) in overlay['pin']:
|
||||
overlay_pin = overlay['pin'][str(pin_num)]
|
||||
else:
|
||||
overlay_pin = overlay['pin'][bcm_pin]
|
||||
|
||||
if overlay != None and str(pin_num) in overlay['pin']:
|
||||
overlay_pin = overlay['pin'][str(pin_num)]
|
||||
pin_used = True
|
||||
#print(overlay)
|
||||
if 'name' in overlay_pin:
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "Raspberry Pi Dots",
|
||||
"description": "Join the dots to make a circuit",
|
||||
"pin": {
|
||||
"bcm0": {"name":"Color: Blue", "direction":"input"},
|
||||
"bcm1": {"name":"Dot 7", "direction":"input"},
|
||||
"bcm2": {"name":"Dot 22", "direction":"input"},
|
||||
"bcm3": {"name":"Dot 21", "direction":"input"},
|
||||
"bcm4": {"name":"Dot 2", "direction":"input"},
|
||||
"bcm5": {"name":"Dot 9", "direction":"input"},
|
||||
"bcm6": {"name":"Dot 14", "direction":"input"},
|
||||
"bcm7": {"name":"Dot 6", "direction":"input"},
|
||||
"bcm8": {"name":"Dot 18", "direction":"input"},
|
||||
"bcm9": {"name":"Dot 17", "direction":"input"},
|
||||
"bcm10": {"name":"Color: Green", "direction":"input"},
|
||||
"bcm11": {"name":"Dot 8", "direction":"input"},
|
||||
"bcm12": {"name":"Dot 10", "direction":"input"},
|
||||
"bcm13": {"name":"Cloud", "direction":"input"},
|
||||
"bcm14": {"name":"Dot 1", "direction":"input"},
|
||||
"bcm15": {"name":"Dot 3", "direction":"input"},
|
||||
"bcm16": {"name":"Dot 13", "direction":"input"},
|
||||
"bcm17": {"name":"Dot 4", "direction":"input"},
|
||||
"bcm18": {"name":"Dot 20", "direction":"input"},
|
||||
"bcm19": {"name":"Color: Orange", "direction":"input"},
|
||||
"bcm20": {"name":"Bear", "direction":"input"},
|
||||
"bcm21": {"name":"Dot 12", "direction":"input"},
|
||||
"bcm22": {"name":"Dot 15", "direction":"input"},
|
||||
"bcm23": {"name":"Dot 16", "direction":"input"},
|
||||
"bcm24": {"name":"Dot 19", "direction":"input"},
|
||||
"bcm25": {"name":"Dot 5", "direction":"input"},
|
||||
"bcm26": {"name":"Dot 11", "direction":"input"},
|
||||
"bcm27": {"name":"Color: Red", "direction":"input"}
|
||||
}
|
||||
}
|
|
@ -97,7 +97,11 @@
|
|||
"27":{
|
||||
"name": "ID_SD",
|
||||
"description": "HAT EEPROM i2c Data",
|
||||
"type": "GPIO/I2C"
|
||||
"type": "GPIO/I2C",
|
||||
"scheme": {
|
||||
"wiringpi": 30,
|
||||
"bcm": 0
|
||||
}
|
||||
},
|
||||
"29":{
|
||||
"name": "",
|
||||
|
@ -236,7 +240,11 @@
|
|||
"28":{
|
||||
"name": "ID_SC",
|
||||
"description": "HAT EEPROM i2c Clock",
|
||||
"type": "GPIO"
|
||||
"type": "GPIO/I2C",
|
||||
"scheme": {
|
||||
"wiringpi": 31,
|
||||
"bcm": 1
|
||||
}
|
||||
},
|
||||
"30":{
|
||||
"name": "Ground",
|
||||
|
|
Loading…
Reference in New Issue