Merge remote-tracking branch 'upstream/master'
syncing upstream
This commit is contained in:
commit
10d892d5a6
124
generate-json.py
Executable file
124
generate-json.py
Executable file
@ -0,0 +1,124 @@
|
||||
#!/usr/bin/env python
|
||||
import json
|
||||
import markdown
|
||||
import unicodedata
|
||||
import re
|
||||
import os
|
||||
import time
|
||||
import sys
|
||||
import pinout
|
||||
import yaml
|
||||
import markjaml
|
||||
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf8')
|
||||
|
||||
lang = "en-GB"
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
lang = sys.argv[1]
|
||||
|
||||
pinout.load(lang)
|
||||
|
||||
overlays = pinout.settings['overlays']
|
||||
|
||||
pages = {}
|
||||
|
||||
def cssify(value):
|
||||
value = slugify(value);
|
||||
if value[0] == '3' or value[0] == '5':
|
||||
value = 'pow' + value
|
||||
|
||||
return value
|
||||
|
||||
def slugify(value):
|
||||
"""
|
||||
Normalizes string, converts to lowercase, removes non-alpha characters,
|
||||
and converts spaces to hyphens.
|
||||
"""
|
||||
value = unicode(value)
|
||||
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
|
||||
value = re.sub('[^\w\s-]', '', value).strip().lower()
|
||||
return re.sub('[-\s]+', '_', value)
|
||||
|
||||
def load_overlay(overlay):
|
||||
try:
|
||||
data = markjaml.load('src/{}/overlay/{}.md'.format(lang,overlay))
|
||||
|
||||
loaded = data['data']
|
||||
except IOError:
|
||||
return None
|
||||
|
||||
|
||||
details = []
|
||||
|
||||
if 'manufacturer' in loaded:
|
||||
details.append('* Made by ' + loaded['manufacturer'])
|
||||
|
||||
if 'pincount' in loaded:
|
||||
pincount = int(loaded['pincount'])
|
||||
if pincount == 40:
|
||||
details.append('* HAT form-factor')
|
||||
elif pincount == 26:
|
||||
details.append('* Classic 26-pin')
|
||||
else:
|
||||
details.append('* {} pin header'.format(pincount))
|
||||
|
||||
if 'pin' in loaded:
|
||||
uses_5v = False
|
||||
uses_3v = False
|
||||
uses = 0
|
||||
for pin in loaded['pin']:
|
||||
pin = str(pin)
|
||||
if pin.startswith('bcm'):
|
||||
pin = pinout.bcm_to_physical(pin[3:])
|
||||
|
||||
if pin in pinout.pins:
|
||||
actual_pin = pinout.pins[pin]
|
||||
|
||||
if actual_pin['type'] in ['+3v3','+5v','GND']:
|
||||
if actual_pin['type'] == '+3v3':
|
||||
uses_3v = True
|
||||
if actual_pin['type'] == '+5v':
|
||||
uses_5v = True
|
||||
else:
|
||||
uses += 1
|
||||
|
||||
if uses > 0:
|
||||
details.append('* Uses {} GPIO pins'.format(uses))
|
||||
|
||||
if '3' in loaded['pin'] and '5' in loaded['pin']:
|
||||
pin_3 = loaded['pin']['3']
|
||||
pin_5 = loaded['pin']['5']
|
||||
if 'mode' in pin_3 and 'mode' in pin_5:
|
||||
if pin_3['mode'] == 'i2c' and pin_5['mode'] == 'i2c':
|
||||
details.append('* Uses I2C')
|
||||
|
||||
if 'url' in loaded:
|
||||
details.append('* [More Information]({url})'.format(url=loaded['url']))
|
||||
|
||||
if 'github' in loaded:
|
||||
details.append('* [GitHub Repository]({url})'.format(url=loaded['github']))
|
||||
|
||||
if 'buy' in loaded:
|
||||
details.append('* [Buy Now]({url})'.format(url=loaded['buy']))
|
||||
|
||||
if not 'page_url' in loaded:
|
||||
loaded['page_url'] = slugify(loaded['name'])
|
||||
|
||||
pages[loaded['page_url']] = loaded
|
||||
return loaded
|
||||
|
||||
def load_md(filename):
|
||||
filename = 'src/{}/{}'.format(lang, filename)
|
||||
try:
|
||||
html = markdown.markdown(open(filename).read(), extensions=['fenced_code'])
|
||||
|
||||
return html
|
||||
except IOError:
|
||||
print('Unable to load markdown from {}'.format(filename))
|
||||
return ''
|
||||
|
||||
overlays = map(load_overlay,overlays)
|
||||
|
||||
print(json.dumps(overlays))
|
@ -411,6 +411,9 @@ ol.linenums {margin-left:30px;}
|
||||
#container {
|
||||
width:1200px;
|
||||
}
|
||||
.board {
|
||||
right:1200px;
|
||||
}
|
||||
#content {
|
||||
width:700px;
|
||||
}
|
||||
|
1
serve.py
1
serve.py
@ -9,7 +9,6 @@ lang = 'en-GB'
|
||||
def redirect_to_pinout():
|
||||
return redirect('/pinout')
|
||||
|
||||
|
||||
@app.route("/resources/<path:filename>")
|
||||
def custom_static(filename):
|
||||
return send_from_directory(basedir + 'resources/', filename)
|
||||
|
44
src/en-GB/overlay/display-o-tron-hat.md
Normal file
44
src/en-GB/overlay/display-o-tron-hat.md
Normal file
@ -0,0 +1,44 @@
|
||||
<!--
|
||||
---
|
||||
name: Display-o-Tron HAT
|
||||
manufacturer: Pimoroni
|
||||
url: https://github.com/pimoroni/dot3k
|
||||
description: A 3-line character LCD with a 6-zone RGB backlight and 6 touch buttons
|
||||
pincount: 40
|
||||
pin:
|
||||
3:
|
||||
mode: i2c
|
||||
5:
|
||||
mode: i2c
|
||||
22:
|
||||
name: LCD CMD/DATA
|
||||
mode: output
|
||||
active: high
|
||||
19:
|
||||
mode: spi
|
||||
22:
|
||||
name: LCD Register Select
|
||||
mode: output
|
||||
23:
|
||||
mode: spi
|
||||
24:
|
||||
name: LCD Chip Select
|
||||
mode: chipselect
|
||||
active: high
|
||||
32:
|
||||
name: LCD Reset
|
||||
mode: output
|
||||
active: low
|
||||
-->
|
||||
#Display-o-Tron HAT
|
||||
|
||||
Display-o-Tron HAT uses both SPI and I2c to drive the LCD display, backlight and touch.
|
||||
However both of these busses can be shared with other devices.
|
||||
|
||||
You can use the one-line product installer to get Display-o-Tron HAT set up and ready to go, just:
|
||||
|
||||
```bash
|
||||
curl get.pimoroni.com/dot3k | bash
|
||||
```
|
||||
|
||||
And follow the instructions!
|
@ -2,8 +2,21 @@
|
||||
---
|
||||
name: Display-o-Tron 3000
|
||||
manufacturer: Pimoroni
|
||||
github: https://github.com/pimoroni/dot3k
|
||||
url: https://github.com/pimoroni/dot3k
|
||||
description: A 3-line character LCD with an RGB backlight and joystick
|
||||
install:
|
||||
'devices':
|
||||
- 'i2c'
|
||||
- 'spi'
|
||||
'apt':
|
||||
- 'python-smbus'
|
||||
- 'python3-smbus'
|
||||
- 'python-dev'
|
||||
- 'python3-dev'
|
||||
'python':
|
||||
- 'dot3k'
|
||||
'examples': 'python/examples/'
|
||||
pincount: 40
|
||||
pin:
|
||||
3:
|
||||
|
@ -6,6 +6,15 @@ url: https://github.com/pimoroni/explorer-hat
|
||||
github: https://github.com/pimoroni/explorer-hat
|
||||
buy: http://shop.pimoroni.com/products/explorer-hat
|
||||
description: An all-in-one light, input, motor, touch and output add-on board.
|
||||
install:
|
||||
'apt':
|
||||
- 'python-smbus'
|
||||
- 'python3-smbus'
|
||||
- 'python-dev'
|
||||
- 'python3-dev'
|
||||
'python':
|
||||
- 'explorerhat'
|
||||
'examples': 'examples/'
|
||||
pincount: 40
|
||||
i2c:
|
||||
'0x28':
|
||||
|
@ -6,6 +6,19 @@ url: https://github.com/pimoroni/explorer-hat
|
||||
github: https://github.com/pimoroni/explorer-hat
|
||||
buy: http://shop.pimoroni.com/products/explorer-hat
|
||||
description: An all-in-one light, input, touch and output add-on board.
|
||||
install:
|
||||
'devices':
|
||||
- 'i2c'
|
||||
'apt':
|
||||
- 'python-smbus'
|
||||
- 'python3-smbus'
|
||||
- 'python-dev'
|
||||
- 'python3-dev'
|
||||
'python':
|
||||
- 'explorerhat'
|
||||
'python3':
|
||||
- 'explorerhat'
|
||||
'examples': 'examples/'
|
||||
pincount: 40
|
||||
pin:
|
||||
'7':
|
||||
|
@ -14,11 +14,11 @@ pin:
|
||||
-->
|
||||
#Ground
|
||||
|
||||
The Ground pins ona the Raspberry Pi are all electrically connected, so it doesn't matter
|
||||
The Ground pins on the Raspberry Pi are all electrically connected, so it doesn't matter
|
||||
which one you use if you're wiring up a voltage supply.
|
||||
|
||||
Generally the one that's most convinient or closest to the rest of your connections is tidier
|
||||
and easier, or alternatively the one closes to the supply pin that you use.
|
||||
Generally the one that's most convenient or closest to the rest of your connections is tidier
|
||||
and easier, or alternatively the one closest to the supply pin that you use.
|
||||
|
||||
It's a good idea to use Physical Pin 17 for 3v3 and Physical Pin 25 for ground when using
|
||||
the [SPI](/pinout/spi) connections, for example, as these are right next to the important pins for SPI0.
|
45
src/en-GB/overlay/iqaudio-pi-dac.md
Normal file
45
src/en-GB/overlay/iqaudio-pi-dac.md
Normal file
@ -0,0 +1,45 @@
|
||||
<!--
|
||||
---
|
||||
name: "IQaudIO Pi-DAC+"
|
||||
description: Program Arduino with Raspberry Pi SPI
|
||||
pin:
|
||||
1:
|
||||
2:
|
||||
3:
|
||||
4:
|
||||
5:
|
||||
6:
|
||||
9:
|
||||
12:
|
||||
name: I2S
|
||||
14:
|
||||
16:
|
||||
name: Rotary Encoder
|
||||
18:
|
||||
name: Rotary Encoder
|
||||
22:
|
||||
name: Mute/Unmute
|
||||
25:
|
||||
name: IR Sensor
|
||||
27:
|
||||
28:
|
||||
35:
|
||||
name: I2S
|
||||
38:
|
||||
name: I2S
|
||||
39:
|
||||
40:
|
||||
name: I2S
|
||||
-->
|
||||
#IQaudIO Pi-DAC+
|
||||
|
||||
The Pi-DAC+ takes the digital audio signals (I2S) from the Raspberry Pi and through the
|
||||
onboard Texas Instruments PCM5122 DAC delivers variable output (hardware volume
|
||||
control) analog audio to the Pi-DAC+’s Phono connectors. The PI-DAC+ also, via the
|
||||
Texas Instruments TPA6133A headphone amp, supports the direct use of headphones via
|
||||
the Pi-DAC+’s 3.5mm audio jack.
|
||||
|
||||
The Pi Dac uses GPIO22 to mute/unmute the Pi-AMP+.
|
||||
|
||||
You can use GPIO25 to connect an IR sensor and GPIO23/24 for a rotary encoder. Both of
|
||||
these parts are optional, but are broken out on the Pi-DAC+ for convinient access.
|
47
src/en-GB/overlay/piano-hat.md
Normal file
47
src/en-GB/overlay/piano-hat.md
Normal file
@ -0,0 +1,47 @@
|
||||
<!--
|
||||
---
|
||||
name: Piano HAT
|
||||
manufacturer: Pimoroni
|
||||
url: https://github.com/pimoroni/piano-hat
|
||||
description: A tiny Pi piano with 16 touch-sensitive buttons
|
||||
pincount: 40
|
||||
i2c:
|
||||
'0x28':
|
||||
name: Cap Touch A
|
||||
device: cap1188
|
||||
datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/CAP1188%20.pdf
|
||||
'0x2b':
|
||||
name: Cap Touch B
|
||||
device: cap1188
|
||||
datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/CAP1188%20.pdf
|
||||
pin:
|
||||
3:
|
||||
mode: i2c
|
||||
5:
|
||||
mode: i2c
|
||||
7:
|
||||
name: Alert A
|
||||
mode: input
|
||||
11:
|
||||
name: Reset A
|
||||
mode: output
|
||||
13:
|
||||
name: Alert B
|
||||
mode: input
|
||||
15:
|
||||
name: Reset B
|
||||
mode: output
|
||||
-->
|
||||
#Piano HAT
|
||||
|
||||
Piano HAT has 16 touch-sensitive buttons. 13 of these are a single Piano octave, the rest give you octave up/down and instrument select functionality.
|
||||
|
||||
It uses two Microchip CAP1188 chips with the i2c addresses 0x28 and 0x2b.
|
||||
|
||||
You can use the one-line product installer to get Piano HAT set up and ready to go, just:
|
||||
|
||||
```bash
|
||||
curl get.pimoroni.com/pianohat | bash
|
||||
```
|
||||
|
||||
And follow the instructions!
|
@ -6,6 +6,15 @@ url: https://github.com/pimoroni/skywriter-hat
|
||||
github: https://github.com/pimoroni/skywriter-hat
|
||||
buy: http://shop.pimoroni.com/products/skywriter-hat
|
||||
description: A 3D positional and gesture sensor.
|
||||
install:
|
||||
'apt':
|
||||
- 'python-smbus'
|
||||
- 'python3-smbus'
|
||||
- 'python-dev'
|
||||
- 'python3-dev'
|
||||
'python':
|
||||
- 'skywriter'
|
||||
'examples': 'python/examples/'
|
||||
pincount: 40
|
||||
pin:
|
||||
'3':
|
||||
|
@ -6,6 +6,15 @@ url: http://shop.pimoroni.com/products/unicorn-hat
|
||||
buy: http://shop.pimoroni.com/products/unicorn-hat
|
||||
description: 64 blindingly bright RGB LEDs on a single HAT
|
||||
github: https://github.com/pimoroni/unicornhat
|
||||
install:
|
||||
'apt':
|
||||
- 'python-dev'
|
||||
- 'python3-dev'
|
||||
'python':
|
||||
- 'unicornhat'
|
||||
'python3':
|
||||
- 'unicornhat'
|
||||
'examples': 'python/examples/'
|
||||
pincount: 40
|
||||
pin:
|
||||
'12':
|
||||
|
@ -24,5 +24,8 @@ overlays:
|
||||
- explorer-hat-pro
|
||||
- explorer-hat
|
||||
- display-o-tron
|
||||
- display-o-tron-hat
|
||||
- dots
|
||||
- traffic-hat
|
||||
- iqaudio-pi-dac
|
||||
- piano-hat
|
||||
|
@ -24,6 +24,7 @@
|
||||
<div id="container">
|
||||
<ul class="main-nav">
|
||||
<li><a href="http://pi.gadgetoid.com/">Pi Blog</a></li>
|
||||
<li><a href="http://eagle.gadgetoid.com">Learn Eagle</a></li>
|
||||
<li><a href="https://twitter.com/gadgetoid"><i class="fa fa-twitter"></i> @Gadgetoid</a></li>
|
||||
<li><a href="https://github.com/Gadgetoid/Pinout2"><i class="fa fa-github"></i> Contribute</a></li>
|
||||
</ul>
|
||||
|
68
tools/micropin.jquery.js
Normal file
68
tools/micropin.jquery.js
Normal file
@ -0,0 +1,68 @@
|
||||
$(document).ready(function(){
|
||||
var pin_size = 10;
|
||||
|
||||
$('a').each(function(idx, obj){
|
||||
var href = $(obj).attr('href');
|
||||
if( href.indexOf('http://pi.gadgetoid.com/pinout/pin') == 0){
|
||||
var pin = parseInt(href.replace('http://pi.gadgetoid.com/pinout/pin','').split('_')[0]);
|
||||
console.log(href,pin);
|
||||
$(obj).data('pin', pin).css({position:'relative'});
|
||||
$(obj).hover(
|
||||
function(){$(this).find('.pinout_popup').slideDown(100);},
|
||||
function(){$(this).find('.pinout_popup').slideUp(100);}
|
||||
);
|
||||
var w = ( pin_size + 4 ) * 2;
|
||||
var pinout_popup = $('<div>')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
width: w,
|
||||
overflow: 'hidden',
|
||||
marginLeft: -(w/2),
|
||||
left: '50%',
|
||||
top: $(this).css('line-height'),
|
||||
background: '#073642',
|
||||
padding: 2,
|
||||
border: '5px solid #5F8645',
|
||||
borderLeft: '10px solid #5F8645'
|
||||
})
|
||||
.addClass('pinout_popup')
|
||||
.hide();
|
||||
|
||||
for( var x = 1; x <= 40; x++ ){
|
||||
var bgcol = '#859900';
|
||||
|
||||
if( $.inArray(x, [1,8,10,17]) > -1 ){
|
||||
bgcol = '#B58900';
|
||||
}
|
||||
else if( $.inArray(x, [3,5,27,28]) > -1 ){
|
||||
bgcol = '#268BD2';
|
||||
}
|
||||
else if( $.inArray(x, [2, 4]) > -1 ){
|
||||
bgcol = '#DC322F';
|
||||
}
|
||||
else if( $.inArray(x, [19,21,23,24,26,35,38,40]) > -1 ){
|
||||
bgcol = '#D33682';
|
||||
}
|
||||
else if( $.inArray(x, [6,9,14,20,25,30,34,39]) > -1 ){
|
||||
bgcol = '#002B36';
|
||||
}
|
||||
|
||||
|
||||
$('<div>')
|
||||
.css({
|
||||
float: 'left',
|
||||
width: pin_size-2,
|
||||
height: pin_size-2,
|
||||
margin: 2,
|
||||
background: x==pin ? '#FFFFFF' : bgcol,
|
||||
borderRadius:x==1 ? 0 : pin_size/2,
|
||||
border: '1px solid #FFFFFF',
|
||||
boxShadow : x==pin ? '0px 0px 10px #FFFFFF' : 'none'
|
||||
})
|
||||
.appendTo(pinout_popup);
|
||||
}
|
||||
|
||||
$(obj).append(pinout_popup);
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user