Merge remote-tracking branch 'Gadgetoid/master'
This commit is contained in:
commit
c3bca952a9
62
README.md
62
README.md
|
@ -16,35 +16,49 @@ them, how they can better support translation and any other suggestions you migh
|
|||
|
||||
#Contributing
|
||||
|
||||
The contents of this GitHub repository are used to build http://pi.gadgetoid.com/pinout.
|
||||
If you have a board you'd like to contribute, raise an issue and we'll consider it!
|
||||
|
||||
If you have a board you'd like to contribute, you should look at these folders:
|
||||
#Translating
|
||||
|
||||
* [overlay/](overlay/)
|
||||
* [description/overlay/](description/overlay/)
|
||||
The contents of this GitHub repository are used to build http://pinout.xyz and its translated subdomains.
|
||||
|
||||
Current known contributors are:
|
||||
|
||||
* tr-TR - @Ardakilic
|
||||
* fr-FR - @RogueM
|
||||
|
||||
We're looking for ( based on traffic ):
|
||||
|
||||
* German, de-DE
|
||||
* Italian, it-IT
|
||||
* Spanish ( Spain ), es-ES
|
||||
* Polish pl-PL
|
||||
* And any others!
|
||||
|
||||
You should start by duplicating the `src/en-GB` directory to the
|
||||
appropriate culture. For example if you want to create a German translation you would create the folder `src/de-DE`.
|
||||
|
||||
At the moment cultures are not fully supported, so you can't have `src/fr-CA` ( sorry! ), and there are no plans for this.
|
||||
|
||||
Once you've made your translation, build and preview it with, for example:
|
||||
|
||||
```bash
|
||||
make serve LANG=de-DE
|
||||
```
|
||||
|
||||
And then open: http://127.0.0.1:5000 in your browser.
|
||||
|
||||
Please do not attempt to translate the `/resources` folder, this is shared between sites on the server and should be generic.
|
||||
|
||||
Feel free to modify the template with links relevent to your country, and your Twitter handle but don't fiddle with the structure!
|
||||
|
||||
Submit your finished translation as a pull request and I'll get it live on pinout.xyz.
|
||||
|
||||
#Roadmap
|
||||
|
||||
##Phase 1
|
||||
|
||||
Replace the current Pinout site with a generated version built from this repository, aim for 100% compatibility.
|
||||
|
||||
* Drop ancient and redundant boards such as ladder, Clockatoo
|
||||
* Replace things like Arduino with more relevant and up-to-date alternatives ( Alex's PiDuino )
|
||||
* Compliment Pibrella with Explorer HAT (Pro)
|
||||
|
||||
##Phase 2
|
||||
|
||||
Redesign UI to support browsing a wider variety of boards and viewing their pinouts, description, links to library
|
||||
+ buy links etc.
|
||||
|
||||
* Redesign UI to support browsing a wider variety of boards and viewing their pinouts ( partially done with drop down )
|
||||
* Replace top tabs with some sort of search functionality or easy categorised UI for finding boards
|
||||
* Allow for slightly longer descriptions of Pin functions ( baloons? ), current width is very restrictive
|
||||
|
||||
##Phase 3
|
||||
|
||||
Introduce advanced functionality such as board compatibility checks and more detailed overlays on Pin alt functions.
|
||||
|
||||
* Does X board work with Y board
|
||||
* What extra functions does this pin have
|
||||
* Convert WiringPi to GPIO to BCM and back
|
||||
* What extra functions does this pin have ( mostly done with ALT functions tables, but needs descriptions )
|
||||
* Tool to convert WiringPi to GPIO to BCM and back
|
202
generate-html.py
202
generate-html.py
|
@ -14,67 +14,6 @@ import urlmapper
|
|||
reload(sys)
|
||||
sys.setdefaultencoding('utf8')
|
||||
|
||||
lang = "en-GB"
|
||||
default_strings = {
|
||||
'made_by': '* Made by {manufacturer}',
|
||||
'type_hat': '* HAT form-factor',
|
||||
'type_classic': '* Classic form-factor',
|
||||
'pin_header': '* {} pin header',
|
||||
'uses_i2c': '* Uses I2C',
|
||||
'wiring_pi_pin': 'Wiring Pi pin {}'
|
||||
}
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
lang = sys.argv[1]
|
||||
|
||||
alternate_urls = urlmapper.generate_urls(lang)
|
||||
|
||||
pinout.load(lang)
|
||||
|
||||
overlays = pinout.settings['overlays']
|
||||
|
||||
strings = pinout.get_setting('strings',{})
|
||||
|
||||
if type(strings) == list:
|
||||
_strings = {}
|
||||
for item in strings:
|
||||
_strings[item.keys()[0]] = item.values()[0]
|
||||
strings = _strings
|
||||
|
||||
for key, val in default_strings.items():
|
||||
if key not in strings:
|
||||
strings[key] = val
|
||||
|
||||
|
||||
base_url = pinout.get_setting('base_url','/pinout/') # '/pinout-tr/pinout/'
|
||||
resource_url = pinout.get_setting('resource_url','/resources/') # '/pinout-tr/resources/'
|
||||
url_suffix = pinout.get_setting('url_suffix','') # '.html'
|
||||
|
||||
template = open('src/{}/template/layout.html'.format(lang)).read()
|
||||
|
||||
pages = {}
|
||||
navs = {}
|
||||
select_overlays = []
|
||||
|
||||
overlays_html = ''
|
||||
|
||||
|
||||
if not os.path.isdir('output'):
|
||||
try:
|
||||
os.mkdir('output')
|
||||
except OSError:
|
||||
exit('Failed to create output dir')
|
||||
if not os.path.isdir('output/{}'.format(lang)):
|
||||
try:
|
||||
os.mkdir('output/{}'.format(lang))
|
||||
except OSError:
|
||||
exit('Failed to create output/{} dir'.format(lang))
|
||||
if not os.path.isdir('output/{}/pinout'.format(lang)):
|
||||
try:
|
||||
os.mkdir('output/{}/pinout'.format(lang))
|
||||
except OSError:
|
||||
exit('Failed to create output/{}/pinout dir'.format(lang))
|
||||
|
||||
def cssify(value):
|
||||
value = slugify(value);
|
||||
if value[0] == '3' or value[0] == '5':
|
||||
|
@ -356,6 +295,102 @@ def render_nav(url, overlay=None):
|
|||
<ul class="top">
|
||||
{}</ul>'''.format(html_odd, html_even)
|
||||
|
||||
def get_hreflang_urls(src):
|
||||
hreflang = []
|
||||
for lang in alternate_urls:
|
||||
if src in alternate_urls[lang]:
|
||||
url = alternate_urls[lang][src]
|
||||
hreflang.append('<link rel="alternate" src="{url}" hreflang="{lang}"/>'.format(
|
||||
lang=lang,
|
||||
url=url
|
||||
))
|
||||
return hreflang
|
||||
|
||||
|
||||
def get_lang_urls(src):
|
||||
urls = []
|
||||
for url_lang in alternate_urls:
|
||||
if src in alternate_urls[url_lang]:
|
||||
img_css = ''
|
||||
if url_lang == lang:
|
||||
img_css = ' class="grayscale"'
|
||||
url = alternate_urls[url_lang][src]
|
||||
urls.append('<li><a href="{url}" rel="alternate" hreflang="{lang}"><img{css} src="{resource_url}{lang}.png" /></a>'.format(
|
||||
lang=url_lang,
|
||||
url=url,
|
||||
resource_url=resource_url,
|
||||
css=img_css
|
||||
))
|
||||
return urls
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Main Program Flow
|
||||
'''
|
||||
|
||||
|
||||
lang = "en-GB"
|
||||
default_strings = {
|
||||
'made_by': '* Made by {manufacturer}',
|
||||
'type_hat': '* HAT form-factor',
|
||||
'type_classic': '* Classic form-factor',
|
||||
'pin_header': '* {} pin header',
|
||||
'uses_i2c': '* Uses I2C',
|
||||
'wiring_pi_pin': 'Wiring Pi pin {}'
|
||||
}
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
lang = sys.argv[1]
|
||||
|
||||
alternate_urls = urlmapper.generate_urls(lang)
|
||||
|
||||
pinout.load(lang)
|
||||
|
||||
overlays = pinout.settings['overlays']
|
||||
|
||||
strings = pinout.get_setting('strings',{})
|
||||
|
||||
if type(strings) == list:
|
||||
_strings = {}
|
||||
for item in strings:
|
||||
_strings[item.keys()[0]] = item.values()[0]
|
||||
strings = _strings
|
||||
|
||||
for key, val in default_strings.items():
|
||||
if key not in strings:
|
||||
strings[key] = val
|
||||
|
||||
|
||||
base_url = pinout.get_setting('base_url','/pinout/') # '/pinout-tr/pinout/'
|
||||
resource_url = pinout.get_setting('resource_url','/resources/') # '/pinout-tr/resources/'
|
||||
url_suffix = pinout.get_setting('url_suffix','') # '.html'
|
||||
|
||||
template = open('src/{}/template/layout.html'.format(lang)).read()
|
||||
|
||||
pages = {}
|
||||
navs = {}
|
||||
select_overlays = []
|
||||
|
||||
overlays_html = ''
|
||||
|
||||
|
||||
if not os.path.isdir('output'):
|
||||
try:
|
||||
os.mkdir('output')
|
||||
except OSError:
|
||||
exit('Failed to create output dir')
|
||||
if not os.path.isdir('output/{}'.format(lang)):
|
||||
try:
|
||||
os.mkdir('output/{}'.format(lang))
|
||||
except OSError:
|
||||
exit('Failed to create output/{} dir'.format(lang))
|
||||
if not os.path.isdir('output/{}/pinout'.format(lang)):
|
||||
try:
|
||||
os.mkdir('output/{}/pinout'.format(lang))
|
||||
except OSError:
|
||||
exit('Failed to create output/{}/pinout dir'.format(lang))
|
||||
|
||||
|
||||
overlays = map(load_overlay,overlays)
|
||||
|
||||
|
@ -381,24 +416,12 @@ for pin in range(1,len(pinout.pins)+1):
|
|||
if pin_url == None:
|
||||
continue
|
||||
|
||||
hreflang = []
|
||||
|
||||
src = 'pin{}'.format(pin)
|
||||
|
||||
for code in alternate_urls:
|
||||
if src in alternate_urls[code]:
|
||||
alt = alternate_urls[code][src]
|
||||
code_lang = code.split('-')[0] + '.'
|
||||
if code_lang == 'en.':
|
||||
code_lang = ''
|
||||
hreflang.append('<link rel="alternate" src="//{lang}pinout.xyz/pinout/{alt}" hreflang="{code}"/>'.format(
|
||||
lang=code_lang,
|
||||
alt=alt,
|
||||
code=code
|
||||
))
|
||||
hreflang = get_hreflang_urls('pin{}'.format(pin))
|
||||
langlinks = get_lang_urls('pin{}'.format(pin))
|
||||
|
||||
pin_nav = render_nav(pin_url)
|
||||
pin_html = pinout.render_html(template,
|
||||
lang_links="\n\t\t".join(langlinks),
|
||||
hreflang = "\n\t\t".join(hreflang),
|
||||
nav = pin_nav,
|
||||
content = pin_html,
|
||||
|
@ -420,32 +443,16 @@ for url in pages:
|
|||
content = pages[url]['rendered_html']
|
||||
nav = navs[url]
|
||||
hreflang = []
|
||||
langlinks = []
|
||||
|
||||
if url == 'index':
|
||||
for code in alternate_urls:
|
||||
code_lang = code.split('-')[0] + '.'
|
||||
if code_lang == 'en.':
|
||||
code_lang = ''
|
||||
hreflang.append('<link rel="alternate" src="//{lang}pinout.xyz" hreflang="{code}"/>'.format(
|
||||
lang=code_lang,
|
||||
alt=alt,
|
||||
code=code
|
||||
))
|
||||
hreflang = get_hreflang_urls('index')
|
||||
langlinks = get_lang_urls('index')
|
||||
|
||||
if 'src' in pages[url]:
|
||||
src = pages[url]['src']
|
||||
|
||||
for code in alternate_urls:
|
||||
if src in alternate_urls[code]:
|
||||
alt = alternate_urls[code][src]
|
||||
code_lang = code.split('-')[0] + '.'
|
||||
if code_lang == 'en.':
|
||||
code_lang = ''
|
||||
hreflang.append('<link rel="alternate" src="//{lang}pinout.xyz/pinout/{alt}" hreflang="{code}"/>'.format(
|
||||
lang=code_lang,
|
||||
alt=alt,
|
||||
code=code
|
||||
))
|
||||
hreflang = get_hreflang_urls(src)
|
||||
langlinks = get_lang_urls(src)
|
||||
|
||||
if not 'description' in pages[url]:
|
||||
pages[url]['description'] = pinout.settings['default_desc']
|
||||
|
@ -456,6 +463,7 @@ for url in pages:
|
|||
pages[url]['name'] = pinout.settings['default_title']
|
||||
|
||||
html = pinout.render_html(template,
|
||||
lang_links="\n\t\t".join(langlinks),
|
||||
hreflang = "\n\t\t".join(hreflang),
|
||||
nav = nav,
|
||||
content = content,
|
||||
|
|
Before Width: | Height: | Size: 599 B After Width: | Height: | Size: 599 B |
Binary file not shown.
After Width: | Height: | Size: 545 B |
Before Width: | Height: | Size: 492 B After Width: | Height: | Size: 492 B |
|
@ -44,23 +44,19 @@ pin:
|
|||
-->
|
||||
#SPI - Serial Peripheral Interface
|
||||
|
||||
###Known as the four-wire serial bus, SPI lets you daisy-chain multiple compatible devices off a single set of pins by assigning them different addresses.
|
||||
###Known as the four-wire serial bus, SPI lets you daisy-chain multiple compatible devices off a single set of pins by assigning them different chip-select pins.
|
||||
|
||||
A simple example of an SPI peripheral is the MCP23S17 digital IO expander chip Note the S in place of the 0 found on the I2C version. Using it in WiringPi2 is a doddle:
|
||||
A useful example of an SPI peripheral is the MCP23S17 digital IO expander chip Note the S in place of the 0 found on the I2C version.
|
||||
|
||||
To talk to an SPI device, you assert its corresponding chip-select pin. By default the Pi has CE0 and CE1.
|
||||
|
||||
```python
|
||||
import wiringpi2 as wiringpi
|
||||
HIGH = 1
|
||||
OUTPUT = 1
|
||||
PIN_BASE = 65
|
||||
SPI_ADDR = 0x20
|
||||
wiringpi.wiringPiSetup()
|
||||
wiringpi.mcp23S17Setup(PIN_BASE,SPI_ADDR)
|
||||
# 16 pins including the starting pin
|
||||
mcp23S17pins = range(PIN_BASE,PIN_BASE+15)
|
||||
for pin in mcp23S17pins:
|
||||
wiringpi.pinMode(pin,OUTPUT)
|
||||
wiringpi.digitalWrite(pin,HIGH)
|
||||
import spidev
|
||||
|
||||
spi = spidev.SpiDev()
|
||||
spi.open(0, CHIP_SELECT_0_OR_1)
|
||||
spi.max_speed_hz = 1000000
|
||||
spi.xfer([value_8bit])
|
||||
```
|
||||
|
||||
You can also use the SPI port to "Bit-Bang" an ATmega 328, loading Arduino sketches onto it with Gordon's modified version of AVRDude.
|
||||
|
|
|
@ -5,6 +5,7 @@ default_title: Raspberry Pi GPIO Pinout - Pi 1, B+, Pi 2
|
|||
title_suffix: " at Raspberry Pi GPIO Pinout"
|
||||
base_url: /pinout/
|
||||
resource_url: /resources/
|
||||
domain: pinout.xyz
|
||||
url_suffix:
|
||||
urls:
|
||||
GND: ground
|
||||
|
|
|
@ -24,12 +24,11 @@
|
|||
<body>
|
||||
<div id="container">
|
||||
<ul class="main-nav">
|
||||
<li><img class="grayscale" src="{{resource_url}}gb.png" /></li>
|
||||
<li><a href="http://tr.pinout.xyz" hreflang="tr-TR"><img src="{{resource_url}}tr.png" /></a></li>
|
||||
<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>
|
||||
{{lang_links}}
|
||||
</ul>
|
||||
<h1 class="logo"><a title="Raspberry Pi GPIO Pinout home" href="/"><img src="{{resource_url}}pinout-logo.png" style="top:8px;" /><span>Raspberry Pi</span>n<span class="out">out</span></a></h1>
|
||||
<div class="overlay-container">
|
||||
|
|
|
@ -5,6 +5,7 @@ default_title: Raspberry Pi GPIO Pinout - Pi 1, B+, Pi 2
|
|||
title_suffix: " at Raspberry Pi GPIO Pinout"
|
||||
base_url: /pinout/
|
||||
resource_url: /resources/
|
||||
domain: fr.pinout.xyz
|
||||
url_suffix:
|
||||
urls:
|
||||
GND: ground
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>{{title}}</title>
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
||||
<meta name="description" content="{{description}}" />
|
||||
<link href='//fonts.googleapis.com/css?family=Sanchez|Ubuntu+Mono' rel='stylesheet' type='text/css' />
|
||||
<link href='{{resource_url}}prettify/prettify.css' rel='stylesheet' />
|
||||
|
@ -9,6 +10,7 @@
|
|||
<link href="{{resource_url}}pinout.css?v={{v}}" rel="stylesheet">
|
||||
<link href="{{resource_url}}print.css?v={{v}}" rel="stylesheet" media="print">
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
||||
{{hreflang}}
|
||||
<script type='text/javascript'>
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-32070014-1']);
|
||||
|
@ -27,6 +29,7 @@
|
|||
<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>
|
||||
{{lang_links}}
|
||||
</ul>
|
||||
<h1 class="logo"><a title="Raspberry Pi GPIO Pinout home" href="/pinout"><img src="{{resource_url}}pinout-logo.png" style="top:8px;" /><span>Raspberry Pi</span>n<span class="out">out</span></a></h1>
|
||||
<div class="overlay-container">
|
||||
|
|
|
@ -4,6 +4,7 @@ default_title: Raspberry Pi GPIO Pinleri - Pi 1, B+, Pi 2
|
|||
title_suffix: " - Raspberry Pi Pinleri"
|
||||
base_url: /pinout/
|
||||
resource_url: /resources/
|
||||
domain: tr.pinout.xyz
|
||||
url_suffix: ''
|
||||
urls:
|
||||
GND: ground_toprak
|
||||
|
|
|
@ -10,21 +10,29 @@
|
|||
<link href="{{resource_url}}pinout.css?v={{v}}" rel="stylesheet">
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
||||
{{hreflang}}
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-69846516-2', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<ul class="main-nav">
|
||||
|
||||
<li><a href="http://pinout.xyz" hreflang="en-GB"><img src="{{resource_url}}gb.png" /></a></li>
|
||||
<li><a><img class="grayscale" src="{{resource_url}}tr.png" /></a></li>
|
||||
<li><a href="http://www.raspi.gen.tr/">Raspberry Pi Türkiye</a></li>
|
||||
<li><a href="https://twitter.com/RPiTR"><i class="fa fa-twitter"></i> @RPiTR</a></li>
|
||||
<li><a href="http://forum.raspi.gen.tr/">Forumlar</a></li>
|
||||
<li><a href="http://pi.gadgetoid.com/">Pi Blog</a></li>
|
||||
<li><a href="https://twitter.com/gadgetoid"><i class="fa fa-twitter"></i> @Gadgetoid</a></li>
|
||||
<li><a href="https://github.com/Ardakilic/Pinout2"><i class="fa fa-github"></i> Destekleyin</a></li>
|
||||
{{lang_links}}
|
||||
</ul>
|
||||
<h1 class="logo"><a title="Raspberry Pi GPIO Pinout home" href="/pinout-tr/pinout.html"><img src="{{resource_url}}pinout-logo.png" style="top:8px;" /><span>Raspberry Pi</span>n<span class="out">out</span></a></h1>
|
||||
<h1 class="logo"><a title="Raspberry Pi GPIO Pinout home" href="//tr.pinout.xyz"><img src="{{resource_url}}pinout-logo.png" style="top:8px;" /><span>Raspberry Pi</span>n<span class="out">out</span></a></h1>
|
||||
<div class="overlay-container">
|
||||
<span>Raspberry Pi Eklenti kartları ve özellikleri <i class="fa fa-arrow-right"></i></span>
|
||||
<div class="drop-down">
|
||||
|
|
11
urlmapper.py
11
urlmapper.py
|
@ -57,6 +57,10 @@ def generate_for_lang(lang="en-GB"):
|
|||
|
||||
overlays = pinout.settings['overlays']
|
||||
|
||||
base_url = pinout.get_setting('base_url','/pinout/')
|
||||
|
||||
domain = pinout.get_setting('domain','pinout.xyz')
|
||||
|
||||
overlays_html = ''
|
||||
|
||||
overlays = map(lambda overlay: load_overlay_url(overlay, lang),overlays)
|
||||
|
@ -66,13 +70,16 @@ def generate_for_lang(lang="en-GB"):
|
|||
if pin_url is None:
|
||||
continue
|
||||
|
||||
url_lookup['pin{}'.format(pin)] = '{}'.format(pin_url)
|
||||
url_lookup['pin{}'.format(pin)] = '//{domain}{base_url}{url}'.format(domain=domain,base_url=base_url,url=pin_url)
|
||||
|
||||
for url in overlays:
|
||||
if url is None:
|
||||
continue
|
||||
|
||||
url_lookup['{}'.format(url[0])] = '{}'.format(url[1])
|
||||
url_lookup['{}'.format(url[0])] = '//{domain}{base_url}{url}'.format(domain=domain,base_url=base_url,url=url[1])
|
||||
|
||||
|
||||
url_lookup['index'] = '//{}'.format(domain)
|
||||
|
||||
return url_lookup
|
||||
|
||||
|
|
Loading…
Reference in New Issue