diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..a50604b --- /dev/null +++ b/TODO.md @@ -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 \ No newline at end of file diff --git a/description/overlay/explorer-hat-pro.md b/description/overlay/explorer-hat-pro.md index 8f040ba..79aec78 100644 --- a/description/overlay/explorer-hat-pro.md +++ b/description/overlay/explorer-hat-pro.md @@ -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. diff --git a/description/overlay/explorer-hat.md b/description/overlay/explorer-hat.md new file mode 120000 index 0000000..b960cc9 --- /dev/null +++ b/description/overlay/explorer-hat.md @@ -0,0 +1 @@ +explorer-hat-pro.md \ No newline at end of file diff --git a/generate-html.py b/generate-html.py index 18ff937..502937e 100755 --- a/generate-html.py +++ b/generate-html.py @@ -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 += ''.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) diff --git a/overlay/explorer-hat-pro.json b/overlay/explorer-hat-pro.json index da81dac..e3bbe46 100644 --- a/overlay/explorer-hat-pro.json +++ b/overlay/explorer-hat-pro.json @@ -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" } } } diff --git a/overlay/explorer-hat.json b/overlay/explorer-hat.json new file mode 100644 index 0000000..968f0f8 --- /dev/null +++ b/overlay/explorer-hat.json @@ -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" + } + } +} diff --git a/overlay/pibrella.json b/overlay/pibrella.json index e2bd160..a8120e9 100644 --- a/overlay/pibrella.json +++ b/overlay/pibrella.json @@ -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" } } } diff --git a/resources/pinout.js b/resources/pinout.js index 3a5a84b..519a1c1 100644 --- a/resources/pinout.js +++ b/resources/pinout.js @@ -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', diff --git a/template/layout.html b/template/layout.html index 6b196f8..11fd412 100644 --- a/template/layout.html +++ b/template/layout.html @@ -22,8 +22,14 @@
Latest at Gadgetoid: Propeller ASC+, the Arduino-compatible multi-core micro: read my first impressions
-

Pinout

- +

Pinout

+
+ Learn more about: + +