Skip to content

Commit 1294a69

Browse files
committed
add docs page and migrate some pages on sensors from the wiki
1 parent 81971a6 commit 1294a69

11 files changed

Lines changed: 911 additions & 41 deletions

File tree

_config.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
markdown: kramdown
22
permalink: pretty
3-
exclude: [README.md, Gemfile, Gemfile.lock]
3+
exclude: [README.md, Gemfile, Gemfile.lock, repo-metadata.html]
44

55
gems:
66
- jekyll-mentions
77
- jekyll-sitemap
88

99
defaults:
10+
-
11+
scope:
12+
path: "docs"
13+
type: "pages"
14+
values:
15+
layout: "docs"
16+
-
17+
scope:
18+
path: "docs/sensors"
19+
type: "pages"
20+
values:
21+
category: "sensors"
1022
-
1123
scope:
1224
path: ""

_includes/header.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<li class="left button">
88
<a href="{{ site.github.url }}/" title="There's no place like Home...">Home</a>
99
</li>
10+
<li class="left button">
11+
<a href="{{ site.github.url }}/docs" title="Documentation on how to use ev3dev">Docs</a>
12+
</li>
1013
<li class="left button">
1114
<a href="{{ site.github.url }}/projects" title="List of projects that use ev3dev">Projects Gallery</a>
1215
</li>
@@ -17,9 +20,6 @@
1720
<li class="right button">
1821
<a href="https://github.com/ev3dev/ev3dev/issues" title="Found a bug? Report it here.">Issues</a>
1922
</li>
20-
<li class="right button">
21-
<a href="https://github.com/ev3dev/ev3dev/wiki" title="Useful info on how to use ev3dev">Wiki</a>
22-
</li>
2323
<li class="right button">
2424
<a href="https://github.com/ev3dev/ev3dev/releases" title="SD card image files">Download</a>
2525
</li>

_includes/sensor-connection.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{% case sensor.sensor_type %}
2+
{% when 'nxt-analog-sensor' %}
3+
{% assign connection = "Analog/NXT" %}
4+
{% if sensor.name == 'lego-nxt-touch' or sensor.name == 'lego-nxt-light' or sensor.name == 'nxt-analog' %}
5+
{% assign autodetect = "Y" %}
6+
{% else %}
7+
{% assign autodetect = "N[^nxt-analog]" %}
8+
{% endif %}
9+
{% when 'ev3-analog-sensor' %}
10+
{% assign connection = "Analog/EV3" %}
11+
{% assign autodetect = "Y" %}
12+
{% when 'nxt-i2c-sensor' %}
13+
{% assign connection = "I2C/NXT" %}
14+
{% assign autodetect = "Y" %}
15+
{% when 'gpio-pcf857xr' or 'pcf8591' or 'rtc-ds1307' %}
16+
{% assign connection = "I2C/Other" %}
17+
{% assign autodetect = "N[^standard-i2c]" %}
18+
{% when 'lm75' %}
19+
{% assign connection = "I2C/Other" %}
20+
{% assign autodetect = "Y[^lm75]" %}
21+
{% when 'legoev3-uart' %}
22+
{% assign connection = "UART/EV3" %}
23+
{% assign autodetect = "Y" %}
24+
{% else %}
25+
{% assign connection = "" %}
26+
{% assign autodetect = "" %}
27+
{% endcase %}

_includes/sensor.md

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
{% assign sensor=site.data.sensors[page.sensor_index] %}
2+
{% include sensor-connection.html %}
3+
{% assign footnotes='' %}
4+
{% if sensor.notes %}
5+
{% assign footnotes=footnotes | append: sensor.notes %}
6+
{% endif %}
7+
8+
<!-- the empty comments before and after the footnotes are to prevent unwanted
9+
spaces from being added between the spans -->
10+
11+
### General Info
12+
13+
<table id="sensor-info">
14+
<tr class="{% cycle 'info': 'd0', 'd1' %}">
15+
<th><code>name</code></th>
16+
<td><code>{{ sensor.name }}</code></td>
17+
</tr>
18+
{%if sensor.vendor_website %}
19+
<tr class="{% cycle 'info': 'd0', 'd1' %}">
20+
<th>Website</th>
21+
{% assign split_website=sensor.vendor_website | split: '/' %}
22+
<td><span markdown="1">[{{ split_website[2] }}]({{ sensor.vendor_website }})</span></td>
23+
</tr>
24+
{% endif %}
25+
<tr class="{% cycle 'info': 'd0', 'd1' %}">
26+
<th>Connection</th>
27+
<td>{{ connection }}</td>
28+
</tr>
29+
{% if sensor.default_address %}
30+
<tr class="{% cycle 'info': 'd0', 'd1' %}">
31+
<th>Address</th>
32+
<td>
33+
{{ sensor.default_address }}<!--
34+
{% if sensor.default_address_footnote %}
35+
--><span markdown="1">{{ sensor.default_address_footnote }}</span><!--
36+
{% endif %}
37+
-->
38+
</td>
39+
</tr>
40+
{% endif %}
41+
<tr class="{% cycle 'info': 'd0', 'd1' %}">
42+
<th>sysfs class</th>
43+
<td>
44+
{%if sensor.device_class %}
45+
<span markdown="1">{{ sensor.device_class }}</span><!--
46+
{% else %}
47+
<span markdown="1">[msensor]</span><!--
48+
{% endif %}
49+
{%if sensor.device_class_footnote %}
50+
--><span markdown="1">{{ sensor.device_class_footnote }}</span><!--
51+
{% endif %}
52+
-->
53+
</td>
54+
</tr>
55+
{% if sensor.vendor_id %}
56+
<tr class="{% cycle 'info': 'd0', 'd1' %}">
57+
<th><code>vendor_id</code></th>
58+
<td>{{ sensor.vendor_id }}</td>
59+
</tr>
60+
{% endif %}
61+
{% if sensor.product_id %}
62+
<tr class="{% cycle 'info': 'd0', 'd1' %}">
63+
<th><code>product_id</code></th>
64+
<td>{{ sensor.product_id }}</td>
65+
</tr>
66+
{% endif %}
67+
{%if sensor.device_class == null %}
68+
<tr class="{% cycle 'info': 'd0', 'd1' %}">
69+
<th># Modes</th>
70+
<td>{{ sensor.num_modes }}</td>
71+
</tr>
72+
{% endif %}
73+
</table>
74+
75+
{%if sensor.device_class == null %}
76+
### Modes
77+
78+
<table id="sensor-modes">
79+
<tr class="{% cycle 'modes': 'd0', 'd1' %}">
80+
<th><code>mode</code></th>
81+
<th>Description</th>
82+
<th><code>units</code></th>
83+
<th><code>dp</code><span markdown="1">[^dp]</span></th>
84+
<th><code>num_values</code></th>
85+
<th>Values</th>
86+
</tr>
87+
{% for mode in sensor.ms_mode_info %}
88+
{% if mode.notes %}
89+
{% assign footnotes=footnotes | append: mode.notes %}
90+
{% endif %}
91+
<tr class="{% cycle 'modes': 'd0', 'd1' %}">
92+
<td style="white-space:nowrap;">
93+
<code>{{ mode.name }}</code><!--
94+
{% if mode.name_footnote %}
95+
--><span markdown="1">{{ mode.name_footnote }}</span><!--
96+
{% endif %}
97+
{% if sensor.num_read_only_modes %}
98+
{% assign num_read_only_modes=sensor.num_read_only_modes | plus: 0 %}
99+
{%if forloop.index > num_read_only_modes %}
100+
{% if mode.name_footnote %}
101+
--><sup>,</sup><!--
102+
{% endif %}
103+
--><span markdown="1">[^not-read-only]</span><!--
104+
{% endif %}
105+
{% endif %}
106+
-->
107+
</td>
108+
<td>{{ mode.description }}</td>
109+
<td>
110+
{% if mode.units %}
111+
<code>{{ mode.units }}</code>
112+
{% if mode.units_description %}
113+
({{ mode.units_description }})
114+
{% endif %}
115+
{% else %}
116+
<i>none</i>
117+
{% endif %}
118+
</td>
119+
<td>
120+
<code>
121+
{% if mode.decimals %}
122+
{{ mode.decimals }}
123+
{% else %}
124+
0
125+
{% endif %}
126+
</code>
127+
</td>
128+
<td>
129+
<code>
130+
{% assign num_modes=1 %}
131+
{% if mode.data_sets %}
132+
{% assign num_modes=mode.data_sets %}
133+
{% endif %}
134+
{{ num_modes }}
135+
</code>
136+
</td>
137+
<td>
138+
{% for i in (1..num_modes) %}
139+
{% if i > 1 %}
140+
<br />
141+
{% endif %}
142+
{% assign value=forloop.index0 | prepend: 'value' %}
143+
{% assign value_footnote=value | append: '_footnote' %}
144+
<span style="white-space:nowrap;">
145+
<code>{{ value }}</code>: {{ mode[value] }}<!--
146+
{% if mode[value_footnote] %}
147+
--><span markdown="1">{{ mode[value_footnote] }}</span><!--
148+
{% endif %}
149+
-->
150+
</span>
151+
{% endfor %}
152+
</td>
153+
</tr>
154+
{% endfor %}
155+
</table>
156+
157+
Values in the tables that look like `this` are the names of sysfs attributes
158+
or values returned by said attributes.
159+
160+
[^dp]: Decimal places. For example, if the range of a value is from 0 to 1000
161+
and `dp` is `1`, then the acutal range is 0.0 to 100.0 in the units specified.
162+
163+
[^not-read-only]: This mode is not availible when the sensor is connected to a
164+
read-only input port like the HiTechnic NXT Sensor MUX.
165+
{% endif %}
166+
167+
{{ footnotes }}
168+
169+
[msensor]: ../msensor-class

_layouts/docs.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
layout: page
3+
---
4+
5+
<div class="breadcrumbs">
6+
{% assign parent_dirs=page.url | replace_first: '/', '' | split: '/' %}
7+
{% assign link='/' %}
8+
{% for dir in parent_dirs %}
9+
{% if forloop.last %}
10+
{{ dir }}
11+
{% else %}
12+
{% assign link=link | append: dir | append: '/' %}
13+
<a href="{{ link }}">{{ dir }}</a> &gt;
14+
{% endif %}
15+
{% endfor %}
16+
</div>
17+
<hr />
18+
19+
{{ content }}

docs/index.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Documentation
3+
layout: page
4+
---
5+
6+
We are in the process of moving documentation from the [wiki] to here.
7+
8+
* Getting Started
9+
* Tutorials
10+
* Libraries (Programming Languages)
11+
* [Supported Sensors and Other Input Devices][sensors]
12+
* Supported Motors and Other Output Devices
13+
* sysfs ABI
14+
* ev3dev Developer Tools
15+
16+
[wiki]: https://github.com/ev3dev/ev3dev/wiki
17+
[sensors]: sensors

0 commit comments

Comments
 (0)