Updates, overlay drop down menu

This commit is contained in:
Phil Howard 2015-03-21 18:35:46 +00:00
parent 28f1dced6a
commit 3f57de7ffd
9 changed files with 165 additions and 38 deletions

9
TODO.md Normal file
View File

@ -0,0 +1,9 @@
#TODO
Add pin setup to overlays- IN/OUT, plus polarity Active HIGH/LOW
Add PNG renderer to turn JSON overlays into usable pinout images
Change pincount to useful figure that details compatibility - HAT, 26 pin, etc
Remove "exclusive" from JSON since all defined, non-i2c or SPI pins will be exclusive anyway

View File

@ -1,4 +1,4 @@
#Explorer HAT Pro
#Explorer HAT and Explorer HAT Pro
5V inputs and outputs, touch pads, LEDs, analog inputs and an H-Bridge motor driver make up the Explorer HAT Pro- a jack of all trades prototyping side-kick for your Raspberry Pi.

View File

@ -0,0 +1 @@
explorer-hat-pro.md

View File

@ -6,14 +6,17 @@ import re
import os
resource_url = '/pinout2/resources/'
#resource_url = '/resources/'
resource_url = '/resources/'
overlays = ['pibrella','explorer-hat-pro']
overlays = ['pibrella','explorer-hat-pro','explorer-hat']
template = open('template/layout.html').read()
pages = {}
navs = {}
select_overlays = {}
overlays_html = ''
def slugify(value):
"""
@ -31,7 +34,6 @@ def load_overlay(overlay):
except IOError:
return None
loaded['long_description'] = load_md('description/overlay/{}.md'.format(overlay))
details = []
@ -60,6 +62,7 @@ def load_overlay(overlay):
loaded['page_url'] = slugify(loaded['name'])
pages[loaded['page_url']] = render_overlay_page(loaded)
navs[loaded['page_url']] = render_nav(loaded['page_url'], overlay=loaded)
select_overlays[loaded['page_url']] = loaded['name']
return loaded
def load_md(filename):
@ -132,7 +135,7 @@ def render_pin(pin_num, selected_url, overlay=None):
if overlay != None and str(pin_num) in overlay['pin']:
pin_text_name = ''
print(overlay)
#print(overlay)
pin_name = overlay['pin'][str(pin_num)]['name']
pin_used = True
#alternates = []
@ -199,6 +202,9 @@ pins = db['pins']
overlays = map(load_overlay,overlays)
for url in select_overlays:
overlays_html += '<option value="{}">{}</option>'.format(url, select_overlays[url])
pages['index'] = render_overlay_page({'name':'Index','long_description':load_md('description/index.md')})
navs['index'] = render_nav('index')
@ -208,7 +214,7 @@ print('Rendering pin pages...')
for pin in range(1,len(pins)+1):
(pin_url, pin_html) = render_pin_page(pin)
pin_nav = render_nav(pin_url)
pin_html = template.replace('{{nav}}',pin_nav).replace('{{content}}',pin_html).replace('{{resource_url}}',resource_url)
pin_html = template.replace('{{nav}}',pin_nav).replace('{{content}}',pin_html).replace('{{resource_url}}',resource_url).replace('{{overlays}}',overlays_html)
print('Outputting page {}'.format(pin_url))
@ -223,7 +229,7 @@ for url in pages:
content = pages[url]
nav = navs[url]
print('Outputting page {}'.format(url))
html = template.replace('{{nav}}',nav).replace('{{content}}',content).replace('{{resource_url}}',resource_url)
html = template.replace('{{nav}}',nav).replace('{{content}}',content).replace('{{resource_url}}',resource_url).replace('{{overlays}}',overlays_html)
with open(os.path.join('output','{}.html'.format(url)),'w') as f:
f.write(html)

View File

@ -10,67 +10,83 @@
"pin": {
"7": {
"name": "LED 1",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"11": {
"name": "LED 2",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"13": {
"name": "LED 3",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"29": {
"name": "LED 4",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"31": {
"name": "Output 1",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"32": {
"name": "Output 2",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"33": {
"name": "Output 3",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"36": {
"name": "Output 4",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"16": {
"name": "Input 1",
"exclusive": "true"
"direction": "input",
"active": "high"
},
"15": {
"name": "Input 2",
"exclusive": "true"
"direction": "input",
"active": "high"
},
"18": {
"name": "Input 3",
"exclusive": "true"
"direction": "input",
"active": "high"
},
"22": {
"name": "Input 4",
"exclusive": "true"
"direction": "input",
"active": "high"
},
"40": {
"name": "Motor 2 +",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"37": {
"name": "Motor 2 -",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"35": {
"name": "Motor 1 +",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"38": {
"name": "Motor 1 -",
"exclusive": "true"
"direction": "output",
"active": "high"
}
}
}

69
overlay/explorer-hat.json Normal file
View File

@ -0,0 +1,69 @@
{
"name": "Explorer HAT",
"manufacturer": "Pimoroni",
"url": "https://github.com/pimoroni/explorer-hat",
"description": "An all-in-one light, input, touch and output add-on board.",
"pincount": 40,
"pin": {
"7": {
"name": "LED 1",
"direction": "output",
"active": "high"
},
"11": {
"name": "LED 2",
"direction": "output",
"active": "high"
},
"13": {
"name": "LED 3",
"direction": "output",
"active": "high"
},
"29": {
"name": "LED 4",
"direction": "output",
"active": "high"
},
"31": {
"name": "Output 1",
"direction": "output",
"active": "high"
},
"32": {
"name": "Output 2",
"direction": "output",
"active": "high"
},
"33": {
"name": "Output 3",
"direction": "output",
"active": "high"
},
"36": {
"name": "Output 4",
"direction": "output",
"active": "high"
},
"16": {
"name": "Input 1",
"direction": "input",
"active": "high"
},
"15": {
"name": "Input 2",
"direction": "input",
"active": "high"
},
"18": {
"name": "Input 3",
"direction": "input",
"active": "high"
},
"22": {
"name": "Input 4",
"direction": "input",
"active": "high"
}
}
}

View File

@ -7,55 +7,68 @@
"pin": {
"7": {
"name": "Green LED",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"11": {
"name": "Yellow LED",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"13": {
"name": "Red LED",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"15": {
"name": "Output A",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"19": {
"name": "Input D",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"21": {
"name": "Input A",
"exclusive": "true"
"direction": "input",
"active": "high"
},
"23": {
"name": "Button",
"exclusive": "true"
"direction": "input",
"active": "high"
},
"12": {
"name": "Buzzer",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"16": {
"name": "Output B",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"18": {
"name": "Output C",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"22": {
"name": "Output D",
"exclusive": "true"
"direction": "output",
"active": "high"
},
"24": {
"name": "Input C",
"exclusive": "true"
"direction": "input",
"active": "high"
},
"26": {
"name": "Input B",
"exclusive": "true"
"direction": "input",
"active": "high"
}
}
}

View File

@ -23,6 +23,13 @@ jQuery(document).ready(function(){
window.prettyPrint&&prettyPrint();
$('.overlay').on('change',function(){
var url = $(this).val();
if( url != '' ){
window.location.href = url + '.html'
}
})
/*jQuery('#pages').cycle({
timeout:0,
slideExpr:'article',

View File

@ -22,8 +22,14 @@
<div class="latest" style="padding:10px;font-size:14px;margin-bottom:10px;text-align:right;">
Latest at Gadgetoid: <a href="http://pi.gadgetoid.com/article/parallax-propeller-p8x32a-first-impressions">Propeller ASC+, the Arduino-compatible multi-core micro: read my first impressions</a>
</div>
<h1 class="logo"><img src="{{resource_url}}pinout-logo.png" style="top:8px;" /><span>Pi</span>n<span class="out">out</span></h1>
<h1 class="logo"><a href="index.html"><img src="{{resource_url}}pinout-logo.png" style="top:8px;" /></a><span>Pi</span>n<span class="out">out</span></h1>
<div class="overlay">
<span>Learn more about:</span>
<select class="overlay">
<option value="">&hellip;</option>
{{overlays}}
</select>
</div>
<nav id="gpio">
<div id="pinbase"></div>
<div id="pinbasebplus"></div>