From 572cb41b54acec6c13644bdadb0d9f56d8a684b2 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 24 Feb 2015 17:28:00 +0000 Subject: [PATCH] WIP --- Makefile | 5 + description/overlay/explorer-hat-pro.md | 3 + description/overlay/pibrella.md | 17 ++ description/pins/pin-1.md | 5 + description/pins/pin-2.md | 7 + description/pins/pin-4.md | 1 + description/type/3v3.md | 0 description/type/5v.md | 0 description/type/gpio.md | 0 description/type/i2c.md | 0 description/type/pwm.md | 0 description/type/spi.md | 0 description/type/uart.md | 0 generate-html.py | 31 ++- output/pinout-logo.png | Bin 0 -> 280 bytes output/pinout.css | 249 ++++++++++++++++++++++++ output/pinout.js | 83 ++++++++ output/test.html | 162 +++++++++++++++ overlay/explorer-hat-pro.json | 3 +- overlay/pibrella.json | 8 +- template/layout.html | 55 ++++++ 21 files changed, 620 insertions(+), 9 deletions(-) create mode 100644 Makefile create mode 100644 description/overlay/explorer-hat-pro.md create mode 100644 description/overlay/pibrella.md create mode 100644 description/pins/pin-1.md create mode 100644 description/pins/pin-2.md create mode 100644 description/pins/pin-4.md create mode 100644 description/type/3v3.md create mode 100644 description/type/5v.md create mode 100644 description/type/gpio.md create mode 100644 description/type/i2c.md create mode 100644 description/type/pwm.md create mode 100644 description/type/spi.md create mode 100644 description/type/uart.md create mode 100644 output/pinout-logo.png create mode 100644 output/pinout.css create mode 100644 output/pinout.js create mode 100644 output/test.html create mode 100644 template/layout.html diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e01f266 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +all: + ./generate-html.py > output/test.html + +serve: + cd output && python -m SimpleHTTPServer diff --git a/description/overlay/explorer-hat-pro.md b/description/overlay/explorer-hat-pro.md new file mode 100644 index 0000000..9f4e110 --- /dev/null +++ b/description/overlay/explorer-hat-pro.md @@ -0,0 +1,3 @@ +#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/pibrella.md b/description/overlay/pibrella.md new file mode 100644 index 0000000..cec800a --- /dev/null +++ b/description/overlay/pibrella.md @@ -0,0 +1,17 @@ +#Pibrella + +The all-in-one light, sound, input and output add-on board from Pimoroni vs Cyntech uses lots of IO on the Pi but leaves both Serial and I2C free leaving plenty of room for expansion if you get creative. + +Pibrella is easy to use, first you should install the module using LXTerminal/Command Line: + +```bash +sudo apt-get install python-pip +sudo pip install pibrella +``` + +Then import it into your Python script and start tinkering: + +```bash +import pibrella +pibrella.light.red.on() +``` diff --git a/description/pins/pin-1.md b/description/pins/pin-1.md new file mode 100644 index 0000000..8f9af8b --- /dev/null +++ b/description/pins/pin-1.md @@ -0,0 +1,5 @@ +#3v3 Power + +###The 3v3, 3.3 volt, supply pin on the Pi has a max available current of about 50 mA. Enough to power a couple of LEDs or a microprocessor, but not much more. + +You should generally use the 5v supply, coupled with a 3v3 regulator for 3.3v projects. diff --git a/description/pins/pin-2.md b/description/pins/pin-2.md new file mode 100644 index 0000000..e6ecaf3 --- /dev/null +++ b/description/pins/pin-2.md @@ -0,0 +1,7 @@ +#5v Power + +###The 5v power pins are connected directly to the Pi's power input and will capably provide the full current of your mains adaptor, less that used by the Pi itself. + +With a decent power supply, such as the official Pi adaptor, you can expect to pull about 1.5A. + +Don't be disuaded by what sounds like a measly low voltage. You can do a lot with 5v. Power Arduinos, and even run a small Electroluminescent wire inverter right off the 5v pin! diff --git a/description/pins/pin-4.md b/description/pins/pin-4.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/description/pins/pin-4.md @@ -0,0 +1 @@ + diff --git a/description/type/3v3.md b/description/type/3v3.md new file mode 100644 index 0000000..e69de29 diff --git a/description/type/5v.md b/description/type/5v.md new file mode 100644 index 0000000..e69de29 diff --git a/description/type/gpio.md b/description/type/gpio.md new file mode 100644 index 0000000..e69de29 diff --git a/description/type/i2c.md b/description/type/i2c.md new file mode 100644 index 0000000..e69de29 diff --git a/description/type/pwm.md b/description/type/pwm.md new file mode 100644 index 0000000..e69de29 diff --git a/description/type/spi.md b/description/type/spi.md new file mode 100644 index 0000000..e69de29 diff --git a/description/type/uart.md b/description/type/uart.md new file mode 100644 index 0000000..e69de29 diff --git a/generate-html.py b/generate-html.py index d8f28dd..360fa2b 100755 --- a/generate-html.py +++ b/generate-html.py @@ -1,9 +1,12 @@ #!/usr/bin/env python import json +import markdown, gfm import unicodedata import re -overlays = ['pibrella','break'] +overlays = ['pibrella','explorerhat'] + +template = open('template/layout.html').read() def slugify(value): """ @@ -17,10 +20,24 @@ def slugify(value): def load_overlay(overlay): try: - return json.load(open('overlay/{}.json'.format(overlay))) + loaded = json.load(open('overlay/{}.json'.format(overlay))) except IOError: return None + loaded['long_description'] = load_text(overlay) + return loaded + +def load_text(overlay): + try: + return markdown.markdown(open('description/overlay/{}.md'.format(overlay)).read(), extensions=[gfm.HiddenHiliteExtension([]),'fenced_code']) + except IOError: + return None + +def render_overlay_page(overlay): + if overlay == None: + return '' + return '
{}
'.format(slugify(overlay['name']),overlay['long_description']) + db = json.load(open('pi-pinout.json')) pins = db['pins'] @@ -28,6 +45,7 @@ pins = db['pins'] html_odd = '' html_even = '' +overlay_text = map(load_text,overlays) overlays = map(load_overlay,overlays) def render_alternate(handle, name): @@ -75,6 +93,13 @@ for odd in range(1,len(pins),2): html_odd += render_pin(odd) html_even += render_pin(odd+1) -html = ''.format(html_odd, html_even) +pages = map(render_overlay_page,overlays) + +html = ''' +'''.format(html_odd, html_even) + +html = template.replace('{{nav}}',html).replace('{{content}}','\n'.join(pages)) print(html) diff --git a/output/pinout-logo.png b/output/pinout-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..3aff8ec3bd4841cd3738bcdf8578b46749b5fc39 GIT binary patch literal 280 zcmeAS@N?(olHy`uVBq!ia0vp^x**KL3?xsO{9g&An2Vh}LpV4%Za?&Y0OU#p_=LCu z={3w+R?R%d#>PqaM9#9A1ndxe#$xeqnV1q#jxl~GMq zA;5#V@u7Af_lBkrwuY + + + Raspberry Pi Pinout - Rev 2 Board + + + + + + + +
+ +

Pinout

+ + +
+

Pibrella

+

The all-in-one light, sound, input and output add-on board from Pimoroni vs Cyntech uses lots of IO on the Pi but leaves both Serial and I2C free leaving plenty of room for expansion if you get creative.

+

Pibrella is easy to use, first you should install the module using LXTerminal/Command Line:

+
sudo apt-get install python-pip
+sudo pip install pibrella
+ + +

Then import it into your Python script and start tinkering:

+
import pibrella
+pibrella.light.red.on()
+ +
+ + + + + + + + + + + diff --git a/overlay/explorer-hat-pro.json b/overlay/explorer-hat-pro.json index c4f3d87..3dcde46 100644 --- a/overlay/explorer-hat-pro.json +++ b/overlay/explorer-hat-pro.json @@ -6,6 +6,7 @@ "short": "An all-in-one light, input, motor, touch and output add-on board.", "long": "pibrella.md" }, + "pincount": 40, "pin": { "7": { "name": "LED 1", @@ -24,4 +25,4 @@ "exclusive": "true" }, } -} \ No newline at end of file +} diff --git a/overlay/pibrella.json b/overlay/pibrella.json index 0f784cc..e2bd160 100644 --- a/overlay/pibrella.json +++ b/overlay/pibrella.json @@ -2,10 +2,8 @@ "name": "Pibrella", "manufacturer": "Pimoroni", "url": "https://github.com/pimoroni/pibrella", - "description": { - "short": "An all-in-one light, sound, input and output add-on board.", - "long": "pibrella.md" - }, + "description": "An all-in-one light, sound, input and output add-on board.", + "pincount": 26, "pin": { "7": { "name": "Green LED", @@ -60,4 +58,4 @@ "exclusive": "true" } } -} \ No newline at end of file +} diff --git a/template/layout.html b/template/layout.html new file mode 100644 index 0000000..73ef581 --- /dev/null +++ b/template/layout.html @@ -0,0 +1,55 @@ + + + + Raspberry Pi Pinout - Rev 2 Board + + + + + + + +
+ +

Pinout

+ + +
+{{content}} +
+ + + + + + + + + +