Skip to content

Commit 89d8f6c

Browse files
committed
Sferalabs test app.
1 parent 9974918 commit 89d8f6c

63 files changed

Lines changed: 4290 additions & 1758 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/Components/peripherals/accel_gyro.cdf

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,60 @@
33
<CDFInfo>
44
<Version>3</Version>
55
<CreationDate>2023-04-18T13:32:37Z</CreationDate>
6-
<UpdatedDate>2025-03-17T13:48:17Z</UpdatedDate>
6+
<UpdatedDate>2026-03-22T00:00:00Z</UpdatedDate>
77
</CDFInfo>
88
<Description>
9-
<ShortDescription>Accelometer and Gyroscope</ShortDescription>
10-
<LongDescription>Accelometer and Gyroscope</LongDescription>
9+
<ShortDescription>Accelerometer and Gyroscope</ShortDescription>
10+
<LongDescription>Combined IMU function block providing accelerometer and gyroscope readings. Enable/disable control the hardware sensor. read_accel and read_gyro trigger independent reads; either may be used without the other. On platforms that do not provide a gyroscope (e.g. Sfera Labs Exo Sense Pi) read_gyro never fires its done event.</LongDescription>
1111
<UserName/>
1212
<Menu>
1313
Peripherals
14-
<Menu>Accelometer and Gyroscope</Menu>
14+
<Menu>Accelerometer and Gyroscope</Menu>
1515
</Menu>
1616
</Description>
1717
<Block>
1818
<Type>IO</Type>
19+
<Width>75</Width>
20+
<Height>145</Height>
21+
<Text>AccGyro</Text>
22+
<TextX>10</TextX>
23+
<TextY>5</TextY>
24+
<TextScale>1.25</TextScale>
25+
<TextVertical>0</TextVertical>
26+
<LocationX>0</LocationX>
27+
<LocationY>-15</LocationY>
1928
</Block>
2029
<FBID>
2130
<ERT1_ID>1</ERT1_ID>
2231
<Class>accel_gyro</Class>
2332
</FBID>
2433
<Hashes>
2534
<NameHash_CRC16>0xF2AA</NameHash_CRC16>
26-
<FbApiDescriptorHash_CRC32>bad9e7af</FbApiDescriptorHash_CRC32>
35+
<FbApiDescriptorHash_CRC32>00000000</FbApiDescriptorHash_CRC32>
2736
<FbApiDescriptorHash/>
2837
</Hashes>
2938
<Parameters/>
3039
<Functions>
3140
<Function>
32-
<name>EnableFunc</name>
41+
<name>enable</name>
3342
<ID>
3443
<ERT1_ID>1</ERT1_ID>
3544
</ID>
3645
</Function>
3746
<Function>
38-
<name>DisableFunc</name>
47+
<name>disable</name>
3948
<ID>
4049
<ERT1_ID>2</ERT1_ID>
4150
</ID>
4251
</Function>
4352
<Function>
44-
<name>ReadAccelFunc</name>
53+
<name>read_accel</name>
4554
<ID>
4655
<ERT1_ID>3</ERT1_ID>
4756
</ID>
4857
</Function>
4958
<Function>
50-
<name>ReadGyroFunc</name>
59+
<name>read_gyro</name>
5160
<ID>
5261
<ERT1_ID>4</ERT1_ID>
5362
</ID>
@@ -66,11 +75,11 @@
6675
</Function>
6776
</Port>
6877
<Port>
69-
<Description>disbale</Description>
78+
<Description>disable</Description>
7079
<PortType>StartPort</PortType>
7180
<XCoordinate>0</XCoordinate>
7281
<YCoordinate>22</YCoordinate>
73-
<CName>disbale</CName>
82+
<CName>disable</CName>
7483
<Function argument="0">
7584
<Function_ERT1_ID>2</Function_ERT1_ID>
7685
<AtomicFlag>0</AtomicFlag>
@@ -79,7 +88,7 @@
7988
<Port>
8089
<Description>--</Description>
8190
<PortType>FinishPort</PortType>
82-
<XCoordinate>75</XCoordinate>
91+
<XCoordinate>70</XCoordinate>
8392
<YCoordinate>12</YCoordinate>
8493
<Wcet>0</Wcet>
8594
<CName>enabled</CName>
@@ -90,7 +99,7 @@
9099
<Port>
91100
<Description>--</Description>
92101
<PortType>FinishPort</PortType>
93-
<XCoordinate>75</XCoordinate>
102+
<XCoordinate>70</XCoordinate>
94103
<YCoordinate>22</YCoordinate>
95104
<Wcet>0</Wcet>
96105
<CName>disabled</CName>
@@ -102,7 +111,7 @@
102111
<DataType>I</DataType>
103112
<Description>err id</Description>
104113
<PortType>OutputPort</PortType>
105-
<XCoordinate>75</XCoordinate>
114+
<XCoordinate>70</XCoordinate>
106115
<YCoordinate>32</YCoordinate>
107116
<CName>error_id</CName>
108117
<Function argument="1">
@@ -126,8 +135,8 @@
126135
<Port>
127136
<Description>--</Description>
128137
<PortType>FinishPort</PortType>
129-
<XCoordinate>75</XCoordinate>
130-
<YCoordinate>45</YCoordinate>
138+
<XCoordinate>70</XCoordinate>
139+
<YCoordinate>47</YCoordinate>
131140
<Wcet>0</Wcet>
132141
<CName>accel_done</CName>
133142
<Function argument="1">
@@ -138,8 +147,8 @@
138147
<DataType>F</DataType>
139148
<Description>Ax</Description>
140149
<PortType>OutputPort</PortType>
141-
<XCoordinate>75</XCoordinate>
142-
<YCoordinate>55</YCoordinate>
150+
<XCoordinate>70</XCoordinate>
151+
<YCoordinate>57</YCoordinate>
143152
<CName>Ax</CName>
144153
<Function argument="1">
145154
<Function_ERT1_ID>3</Function_ERT1_ID>
@@ -149,8 +158,8 @@
149158
<DataType>F</DataType>
150159
<Description>Ay</Description>
151160
<PortType>OutputPort</PortType>
152-
<XCoordinate>75</XCoordinate>
153-
<YCoordinate>65</YCoordinate>
161+
<XCoordinate>70</XCoordinate>
162+
<YCoordinate>67</YCoordinate>
154163
<CName>Ay</CName>
155164
<Function argument="2">
156165
<Function_ERT1_ID>3</Function_ERT1_ID>
@@ -160,8 +169,8 @@
160169
<DataType>F</DataType>
161170
<Description>Az</Description>
162171
<PortType>OutputPort</PortType>
163-
<XCoordinate>75</XCoordinate>
164-
<YCoordinate>75</YCoordinate>
172+
<XCoordinate>70</XCoordinate>
173+
<YCoordinate>77</YCoordinate>
165174
<CName>Az</CName>
166175
<Function argument="3">
167176
<Function_ERT1_ID>3</Function_ERT1_ID>
@@ -171,7 +180,7 @@
171180
<Description>gyro</Description>
172181
<PortType>StartPort</PortType>
173182
<XCoordinate>0</XCoordinate>
174-
<YCoordinate>87</YCoordinate>
183+
<YCoordinate>92</YCoordinate>
175184
<CName>read_gyro</CName>
176185
<Function argument="0">
177186
<Function_ERT1_ID>4</Function_ERT1_ID>
@@ -181,8 +190,8 @@
181190
<Port>
182191
<Description>--</Description>
183192
<PortType>FinishPort</PortType>
184-
<XCoordinate>75</XCoordinate>
185-
<YCoordinate>87</YCoordinate>
193+
<XCoordinate>70</XCoordinate>
194+
<YCoordinate>92</YCoordinate>
186195
<Wcet>0</Wcet>
187196
<CName>gyro_done</CName>
188197
<Function argument="1">
@@ -193,8 +202,8 @@
193202
<DataType>F</DataType>
194203
<Description>Gx</Description>
195204
<PortType>OutputPort</PortType>
196-
<XCoordinate>75</XCoordinate>
197-
<YCoordinate>97</YCoordinate>
205+
<XCoordinate>70</XCoordinate>
206+
<YCoordinate>102</YCoordinate>
198207
<CName>Gx</CName>
199208
<Function argument="1">
200209
<Function_ERT1_ID>4</Function_ERT1_ID>
@@ -204,7 +213,7 @@
204213
<DataType>F</DataType>
205214
<Description>Gy</Description>
206215
<PortType>OutputPort</PortType>
207-
<XCoordinate>75</XCoordinate>
216+
<XCoordinate>70</XCoordinate>
208217
<YCoordinate>107</YCoordinate>
209218
<CName>Gy</CName>
210219
<Function argument="2">
@@ -215,7 +224,7 @@
215224
<DataType>F</DataType>
216225
<Description>Gz</Description>
217226
<PortType>OutputPort</PortType>
218-
<XCoordinate>75</XCoordinate>
227+
<XCoordinate>70</XCoordinate>
219228
<YCoordinate>117</YCoordinate>
220229
<CName>Gz</CName>
221230
<Function argument="3">
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
5+
<link href="iabStyle.css" rel="StyleSheet" type="text/css"/>
6+
<link href="../iabStyle.css" rel="StyleSheet" type="text/css"/>
7+
<link href="../../iabStyle.css" rel="StyleSheet" type="text/css"/>
8+
<link href="../../../iabStyle.css" rel="StyleSheet" type="text/css"/>
9+
</head>
10+
<body>
11+
<div class="page_container">
12+
<div id="toc_container">
13+
<span class="toc_span">Accelerometer and Gyroscope</span>
14+
<span class="toc_span_items"><a href="#misc">Misc &#8595;</a></span>
15+
<span class="toc_span_items"><a href="#parameters">Params &#8595;</a></span>
16+
<span class="toc_span_items"><a href="#ports">Ports &#8595;</a></span>
17+
</div>
18+
<!--General Description-->
19+
<p class="component">
20+
<strong>AccGyro</strong> provides access to a combined IMU (Inertial Measurement Unit)
21+
with separate accelerometer and gyroscope channels. Both channels share a single
22+
<strong>enable</strong>/<strong>disable</strong> pair.
23+
</p>
24+
<p class="component">
25+
<strong>read_accel</strong> and <strong>read_gyro</strong> trigger independent reads;
26+
either may be used without the other. On platforms that provide only an accelerometer
27+
(e.g. Sfera Labs Exo Sense Pi), <strong>read_gyro</strong> never fires its
28+
<em>gyro_done</em> event.
29+
</p>
30+
<h3>Platform Support</h3>
31+
<table border="1" cellpadding="6">
32+
<thead><tr><th>Platform</th><th>Accel</th><th>Gyro</th><th>Notes</th></tr></thead>
33+
<tbody>
34+
<tr><td>Arduino Nano 33 IoT</td><td>Yes</td><td>Yes</td><td>LSM6DS3 via Arduino_LSM6DS3 library.</td></tr>
35+
<tr><td>Sfera Labs Exo Sense Pi</td><td>Yes</td><td>No</td><td>sysfs <code>/sys/class/exosensepi/accelerometer/</code>; gyro not available.</td></tr>
36+
<tr><td>All other Sfera Labs boards</td><td>No</td><td>No</td><td>Returns <code>EHS_PERIPH_ERR_NOT_SUPPORTED</code> on enable.</td></tr>
37+
<tr><td>Stubbed (development)</td><td>Yes (0,0,0)</td><td>Yes (0,0,0)</td><td>No hardware access; always succeeds.</td></tr>
38+
</tbody>
39+
</table>
40+
<!--Parameters-->
41+
<div class="section_heading">
42+
<span class="toc_span" id="parameters">Parameters</span>
43+
<div class="toc_span_items"><a href="#toc_container">Top &#8593;</a></div>
44+
<div class="toc_span_items"><a href="#misc">Misc &#8595;</a></div>
45+
<div class="toc_span_items"><a href="#ports">Ports &#8595;</a></div>
46+
</div>
47+
<p class="component">No parameters.</p>
48+
<!--Ports-->
49+
<div class="section_heading">
50+
<span class="toc_span" id="ports">Ports</span>
51+
<span class="toc_span_items"><a href="#toc_container">Top &#8593;</a></span>
52+
<span class="toc_span_items"><a href="#misc">Misc &#8595;</a></span>
53+
<span class="toc_span_items"><a href="#parameters">Params &#8593;</a></span>
54+
</div>
55+
<table class="table">
56+
<tr><th>In Ev.</th><th></th></tr>
57+
<tr><td class="portsEvent"><a name="[In]enable">enable</a></td><td>Enable the IMU hardware. Must be called before any <em>read_accel</em> or <em>read_gyro</em> calls. Sets <em>error_id</em> and fires <em>enabled</em> on success.</td></tr>
58+
<tr><td class="portsEvent"><a name="[In]disable">disable</a></td><td>Disable the IMU hardware. Sets <em>error_id</em> to 0 and fires <em>disabled</em>.</td></tr>
59+
<tr><td class="portsEvent"><a name="[In]read_accel">read_accel</a></td><td>Read one accelerometer sample. Fires <em>accel_done</em> with <em>Ax</em>, <em>Ay</em>, <em>Az</em> on success. Does nothing if data is not available.</td></tr>
60+
<tr><td class="portsEvent"><a name="[In]read_gyro">read_gyro</a></td><td>Read one gyroscope sample. Fires <em>gyro_done</em> with <em>Gx</em>, <em>Gy</em>, <em>Gz</em> on success. Never fires on platforms without a gyroscope.</td></tr>
61+
<tr><th>Data In</th><th></th></tr>
62+
<tr><th>Out Ev.</th><th></th></tr>
63+
<tr><td class="portsEvent"><a name="[Out]enabled">enabled</a></td><td>Fired when the IMU has been successfully enabled.</td></tr>
64+
<tr><td class="portsEvent"><a name="[Out]disabled">disabled</a></td><td>Fired when the IMU has been disabled.</td></tr>
65+
<tr><td class="portsEvent"><a name="[Out]accel_done">accel_done</a></td><td>Fired when an accelerometer sample has been read successfully.</td></tr>
66+
<tr><td class="portsEvent"><a name="[Out]gyro_done">gyro_done</a></td><td>Fired when a gyroscope sample has been read successfully.</td></tr>
67+
<tr><th>Data Out</th><th></th></tr>
68+
<tr><td class="portsInt"><a name="[Out]error_id">error_id</a></td><td>Error code from <em>enable</em> or <em>disable</em>. See error codes table below.</td></tr>
69+
<tr><td class="portsFloat"><a name="[Out]Ax">Ax</a></td><td>X-axis acceleration (g or mg — unit is platform-defined). Updated by <a href="#[In]read_accel">read_accel</a>.</td></tr>
70+
<tr><td class="portsFloat"><a name="[Out]Ay">Ay</a></td><td>Y-axis acceleration. Updated by <a href="#[In]read_accel">read_accel</a>.</td></tr>
71+
<tr><td class="portsFloat"><a name="[Out]Az">Az</a></td><td>Z-axis acceleration. Updated by <a href="#[In]read_accel">read_accel</a>.</td></tr>
72+
<tr><td class="portsFloat"><a name="[Out]Gx">Gx</a></td><td>X-axis angular rate (deg/s). Updated by <a href="#[In]read_gyro">read_gyro</a>.</td></tr>
73+
<tr><td class="portsFloat"><a name="[Out]Gy">Gy</a></td><td>Y-axis angular rate (deg/s). Updated by <a href="#[In]read_gyro">read_gyro</a>.</td></tr>
74+
<tr><td class="portsFloat"><a name="[Out]Gz">Gz</a></td><td>Z-axis angular rate (deg/s). Updated by <a href="#[In]read_gyro">read_gyro</a>.</td></tr>
75+
</table>
76+
<!--Error Codes-->
77+
<h3>Error Codes (<code>error_id</code>)</h3>
78+
<table border="1" cellpadding="6">
79+
<thead><tr><th>Code</th><th>Constant</th><th>Description</th></tr></thead>
80+
<tbody>
81+
<tr><td>0</td><td><code>EHS_PERIPH_OK</code></td><td>Success.</td></tr>
82+
<tr><td>-1</td><td><code>EHS_PERIPH_ERR_GENERAL</code></td><td>Unspecified failure (e.g. Arduino IMU.begin() returned false).</td></tr>
83+
<tr><td>-2</td><td><code>EHS_PERIPH_ERR_SYSFS</code></td><td>sysfs I/O error — the accelerometer enable node could not be written (Sfera Labs Exo Sense Pi).</td></tr>
84+
<tr><td>-3</td><td><code>EHS_PERIPH_ERR_NOT_SUPPORTED</code></td><td>IMU not available on this board. The <em>enabled</em> event will not fire.</td></tr>
85+
</tbody>
86+
</table>
87+
<!--Misc-->
88+
<div class="section_heading">
89+
<span class="toc_span" id="misc">Misc</span>
90+
<span class="toc_span_items"><a href="#toc_container">Top &#8593;</a></span>
91+
<span class="toc_span_items"><a href="#ports">Ports &#8593;</a></span>
92+
<span class="toc_span_items"><a href="#parameters">Params &#8593;</a></span>
93+
</div>
94+
<table>
95+
<tr class="fsm_row">
96+
<td style="width:90px;"><b>State Machine</b></td>
97+
<td colspan="5">Stateless</td>
98+
</tr>
99+
<tr>
100+
<td class="heading-cell"><b>Toolbox</b></td><td>Peripherals / Accelerometer and Gyroscope</td>
101+
<td class="heading-cell"><b>Version</b></td><td>v1.0</td>
102+
</tr>
103+
<tr>
104+
<td class="heading-cell"><b>Licence Type</b></td><td>LGPLv3</td>
105+
<td class="heading-cell"><b>Component Supplier</b></td>
106+
<td><a href="http://www.inx-systems.net" target="_blank">inx ltd.</a></td>
107+
</tr>
108+
<tr>
109+
<td class="heading-cell"><b>Minimum DCC</b></td><td>A0000</td>
110+
<td class="heading-cell"><b>Profiles</b></td><td>Arduino Nano 33 IoT; Sfera Labs Exo Sense Pi (accel only).</td>
111+
</tr>
112+
</table>
113+
</div>
114+
</body>
115+
</html>

Common/Components/peripherals/accelerometer.cdf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</CDFInfo>
88
<Description>
99
<ShortDescription>Accelerometer</ShortDescription>
10-
<LongDescription>3-axis accelerometer. Returns X, Y, Z acceleration values in milli-g.</LongDescription>
10+
<LongDescription>DEPRECATEDuse the accel_gyro block instead. The accel_gyro block is a superset of this block and supports both accelerometer and gyroscope via the same HAL switching mechanism. This block remains available for backward compatibility only.</LongDescription>
1111
<UserName/>
1212
<Menu>
1313
Peripherals

0 commit comments

Comments
 (0)