| |
| <!DOCTYPE html> |
| |
| |
| |
| |
| <html class="no-js"> |
| |
| <head lang="en-us"> |
| <meta charset="utf-8"> |
| <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1"> |
| <meta http-equiv="X-UA-Compatible" content="IE=10" /> |
| <title>XDK110 - Eclipse Mita</title> |
| <meta name="generator" content="Hugo 0.54.0" /> |
| |
| |
| <meta name="description" content="The documentation of Eclipse Mita."> |
| |
| <link rel="canonical" href="../../platforms/xdk110/"> |
| |
| |
| <meta property="og:url" content="/platforms/xdk110/"> |
| <meta property="og:title" content="Eclipse Mita"> |
| <meta property="og:image" content="/images/mita.svg"> |
| <meta name="apple-mobile-web-app-title" content="Eclipse Mita"> |
| <meta name="apple-mobile-web-app-capable" content="yes"> |
| <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> |
| |
| <link rel="shortcut icon" type="image/x-icon" href="../../images/favicon.ico"> |
| <link rel="icon" type="image/x-icon" href="../../images/favicon.ico"> |
| |
| <style> |
| @font-face { |
| font-family: 'Icon'; |
| src: url('/fonts/icon.eot'); |
| src: url('/fonts/icon.eot') |
| format('embedded-opentype'), |
| url('/fonts/icon.woff') |
| format('woff'), |
| url('/fonts/icon.ttf') |
| format('truetype'), |
| url('/fonts/icon.svg') |
| format('svg'); |
| font-weight: normal; |
| font-style: normal; |
| } |
| </style> |
| |
| <link rel="stylesheet" href="../../stylesheets/application.css"> |
| <link rel="stylesheet" href="../../stylesheets/temporary.css"> |
| <link rel="stylesheet" href="../../stylesheets/palettes.css"> |
| <link rel="stylesheet" href="../../stylesheets/highlight/highlight.css"> |
| |
| |
| |
| |
| <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Ubuntu:400,700|Ubuntu+Mono"> |
| <style> |
| body, input { |
| font-family: 'Ubuntu', Helvetica, Arial, sans-serif; |
| } |
| pre, code { |
| font-family: 'Ubuntu Mono', 'Courier New', 'Courier', monospace; |
| } |
| </style> |
| |
| |
| <link rel="stylesheet" href="../../css/custom.css"> |
| |
| <script src="../../javascripts/modernizr.js"></script> |
| |
| |
| |
| </head> |
| <body class="palette-primary-blue-grey palette-accent-light-blue"> |
| |
| |
| |
| |
| <div class="backdrop"> |
| <div class="backdrop-paper"></div> |
| </div> |
| |
| <input class="toggle" type="checkbox" id="toggle-drawer"> |
| <input class="toggle" type="checkbox" id="toggle-search"> |
| <label class="toggle-button overlay" for="toggle-drawer"></label> |
| |
| <header class="header"> |
| <nav aria-label="Header"> |
| <div class="bar default"> |
| <div class="button button-menu" role="button" aria-label="Menu"> |
| <label class="toggle-button icon icon-menu" for="toggle-drawer"> |
| <span></span> |
| </label> |
| </div> |
| <div class="stretch"> |
| <div class="title"> |
| XDK110 |
| </div> |
| </div> |
| |
| |
| <div class="button button-twitter" role="button" aria-label="Twitter"> |
| <a href="https://twitter.com/eclipse_mita" title="@eclipse_mita on Twitter" target="_blank" class="toggle-button icon icon-twitter"></a> |
| </div> |
| |
| |
| |
| <div class="button button-github" role="button" aria-label="GitHub"> |
| <a href="https://github.com/eclipse/mita" title="@eclipse/mita on GitHub" target="_blank" class="toggle-button icon icon-github"></a> |
| </div> |
| |
| |
| |
| </div> |
| <div class="bar search"> |
| <div class="button button-close" role="button" aria-label="Close"> |
| <label class="toggle-button icon icon-back" for="toggle-search"></label> |
| </div> |
| <div class="stretch"> |
| <div class="field"> |
| <input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck> |
| </div> |
| </div> |
| <div class="button button-reset" role="button" aria-label="Search"> |
| <button class="toggle-button icon icon-close" id="reset-search"></button> |
| </div> |
| </div> |
| </nav> |
| </header> |
| |
| <main class="main"> |
| <div class="drawer"> |
| <nav aria-label="Navigation"> |
| <a href="../../" class="project"> |
| <div class="banner"> |
| |
| <div class="logo"> |
| <img src="../../images/mita.svg"> |
| </div> |
| |
| <div class="name"> |
| <strong>Eclipse Mita </strong> |
| |
| </div> |
| </div> |
| </a> |
| |
| <div class="scrollable"> |
| <div class="wrapper"> |
| |
| |
| <div class="toc"> |
| |
| <ul> |
| |
| |
| |
| |
| |
| <li> |
| |
| |
| |
| |
| |
| <a title="Download" href="http://github.com/eclipse/mita"> |
| |
| Download |
| </a> |
| |
| |
| |
| |
| </li> |
| |
| |
| |
| <li> |
| |
| |
| |
| |
| |
| <a title="Concepts" href="../../concepts/"> |
| |
| Concepts |
| </a> |
| |
| |
| |
| |
| </li> |
| |
| |
| |
| <li> |
| |
| <span class="section">Language</span> |
| <ul> |
| |
| |
| |
| |
| |
| |
| <a title="Introduction" href="../../language/introduction/"> |
| |
| Introduction |
| </a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a title="Basics" href="../../language/basics/"> |
| |
| Basics |
| </a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a title="Packages" href="../../language/packages/"> |
| |
| Packages |
| </a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a title="System Setup" href="../../language/setup/"> |
| |
| System Setup |
| </a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a title="Types" href="../../language/types/"> |
| |
| Types |
| </a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a title="Arrays" href="../../language/arrays/"> |
| |
| Arrays |
| </a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a title="Functions" href="../../language/functions/"> |
| |
| Functions |
| </a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a title="Foreign Function Interface" href="../../language/foreignfunctioninterface/"> |
| |
| Foreign Function Interface |
| </a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a title="Events" href="../../language/events/"> |
| |
| Events |
| </a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a title="Exceptions" href="../../language/exceptions/"> |
| |
| Exceptions |
| </a> |
| |
| |
| |
| |
| </ul> |
| |
| </li> |
| |
| |
| |
| <li> |
| |
| <span class="section">Platforms</span> |
| <ul> |
| |
| |
| |
| |
| |
| |
| <a title="Integrators Guide" href="../../platforms/integratorsguide/"> |
| |
| Integrators Guide |
| </a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a title="Arduino Uno" href="../../platforms/arduinouno/"> |
| |
| Arduino Uno |
| </a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <a class="current" title="XDK110" href="../../platforms/xdk110/"> |
| |
| XDK110 |
| </a> |
| |
| |
| <ul id="scrollspy"> |
| </ul> |
| |
| |
| |
| |
| |
| |
| |
| |
| <a title="x86" href="../../platforms/x86/"> |
| |
| x86 |
| </a> |
| |
| |
| |
| |
| </ul> |
| |
| </li> |
| |
| |
| </ul> |
| |
| |
| |
| </div> |
| </div> |
| </div> |
| </nav> |
| |
| </div> |
| |
| <article class="article"> |
| <div class="wrapper"> |
| |
| |
| <h2 id="overview-the-xdk110">Overview: The XDK110</h2> |
| |
| <p>The Bosch Cross Domain Development Kit (XDK) is a programmable sensor device for building IoT applications. |
| It contains a wide range of sensors and means of connectivity and is extensible using its extension bus. |
| Due to its versatility it also serves as reference platform for Mita.</p> |
| |
| <p>To learn more about the XDK head over to <a href="http://xdk.io">http://xdk.io</a>.</p> |
| |
| <h3 id="implemented-system-resources">Implemented System Resources</h3> |
| |
| <p>Currently implemented sensors, connectivities and buses in the XDK110 platform:</p> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Sensors</th> |
| <th>Connectivities</th> |
| <th>Buses</th> |
| <th>IO</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><a href="../../platforms/xdk110/#accelerometer-bma280">Accelerometer</a></td> |
| <td><a href="../../platforms/xdk110/#led">LED</a></td> |
| <td><a href="../../platforms/xdk110/#GPIO">GPIO</a></td> |
| <td><a href="../../platforms/xdk110/#sd-card">SD Card</a></td> |
| </tr> |
| |
| <tr> |
| <td><a href="../../platforms/xdk110/#gyroscope-calibrated-sensor-fusion">Gyroscope</a></td> |
| <td><a href="../../platforms/xdk110/#adc">ADC</a></td> |
| <td><a href="../../platforms/xdk110/#I2C">I2C</a></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><a href="../../platforms/xdk110/#magnetometer-bmm150">Magnetometer</a></td> |
| <td><a href="../../platforms/xdk110/#ble">BLE</a></td> |
| <td></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><a href="../../platforms/xdk110/#environment-bme280">Humidity</a></td> |
| <td><a href="../../platforms/xdk110/#wlan">WLAN</a></td> |
| <td></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><a href="../../platforms/xdk110/#light-max44009">Light</a></td> |
| <td></td> |
| <td></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><a href="../../platforms/xdk110/#environment-bme280">Pressure</a></td> |
| <td><a href="../../platforms/xdk110/#mqtt">MQTT</a></td> |
| <td></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><a href="../../platforms/xdk110/#environment-bme280">Temperature</a></td> |
| <td><a href="../../platforms/xdk110/#eclipse-hono">Eclipse Hono over MQTT</a></td> |
| <td></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><a href="../../platforms/xdk110/#noise-sensor">Noise sensor</a></td> |
| <td><a href="../../platforms/xdk110/#rest-over-http">REST over HTTP</a></td> |
| <td></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><a href="../../platforms/xdk110/#buttons">Two buttons</a></td> |
| <td></td> |
| <td></td> |
| <td></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <p>For the gyroscope you can choose from three different variants:</p> |
| |
| <ol> |
| <li>Pre-calibrated, more robust through sensor fusion</li> |
| <li>Direct access to BMI160</li> |
| <li>Direct access to BMG160</li> |
| </ol> |
| |
| <h2 id="configuration">Configuration</h2> |
| |
| <h3 id="binary-name">Binary Name</h3> |
| |
| <p>To customize the produced binary name configure <code>XDK110.applicationName: string</code> . The default name is <code>MitaApplication</code>:</p> |
| <div class="highlight"><pre class="chroma"><code class="language-TypeScript" data-lang="TypeScript"><span class="nx">setup</span> <span class="nx">XDK110</span> <span class="p">{</span> |
| <span class="nx">applicationName</span> <span class="o">=</span> <span class="s2">"ShockDetector"</span><span class="p">;</span> |
| <span class="p">}</span></code></pre></div> |
| <h3 id="startup-delay">Startup Delay</h3> |
| |
| <p>To debug the startup process you can configure a startup delay so the XDK can connect via USB before setting up devices, connectivity, etc.:</p> |
| <div class="highlight"><pre class="chroma"><code class="language-TypeScript" data-lang="TypeScript"><span class="nx">setup</span> <span class="nx">XDK110</span> <span class="p">{</span> |
| <span class="nx">startupDelay</span> <span class="o">=</span> <span class="mi">5000</span><span class="p">;</span> <span class="cm">/* wait 5 seconds before initialization */</span> |
| <span class="p">}</span></code></pre></div> |
| <h3 id="extension-bus-power">Extension Bus Power</h3> |
| |
| <p>Per default the XDK doesn’t power the 2.5V and 3.3V lines on its extension bus. Some system resources like I2C or GPIO already change this, however in some cases you need to do this manually for example when using the ADC with a microphone:</p> |
| <div class="highlight"><pre class="chroma"><code class="language-TypeScript" data-lang="TypeScript"><span class="nx">setup</span> <span class="nx">XDK110</span> <span class="p">{</span> |
| <span class="nx">powerExternalDevices</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span> |
| <span class="p">}</span></code></pre></div> |
| <h3 id="sensors">Sensors</h3> |
| |
| <p>Any sensor can be used without configuring it. It will be initialized with sensible defaults. If you want to change a sensor’s default hardware parameters just set it up, e.g. the accelerometer:</p> |
| <div class="highlight"><pre class="chroma"><code class="language-TypeScript" data-lang="TypeScript"><span class="nx">setup</span> <span class="nx">accelerometer</span> <span class="p">{</span> |
| <span class="c1">// change the bandwidth of the low-pass filter |
| </span><span class="c1"></span> <span class="nx">bandwidth</span> <span class="o">=</span> <span class="nx">BW_1000Hz</span><span class="p">;</span> |
| <span class="p">}</span></code></pre></div> |
| <p>Content assist (<code>CTRL+Space</code>) will provide you with all available configuration items and their valid values.</p> |
| |
| <p>Temperature, pressure and humidity are available from a single resource: <code>environment</code>.</p> |
| |
| <h3 id="connectivities">Connectivities</h3> |
| |
| <h4 id="hardware">Hardware</h4> |
| |
| <p>Hardware connectivities are available as named singletons: this means that you can configure each connectivity only once and need to give it a name. These connectivities however offer multiple instantiation of their signals. This means that for example the LED resource can provide up to three different signals for the yellow, orange and red LED.</p> |
| |
| <h4 id="software">Software</h4> |
| |
| <p>Software connectivities can have as many instances as you want. Both HTTP REST and MQTT require you to specify a WLAN instance as a transport layer.</p> |
| |
| <h3 id="buses">Buses</h3> |
| |
| <h4 id="gpio">GPIO</h4> |
| |
| <p>GPIO is a named singleton: you can instantiate it once and need to give it a name. Each of the 21 available GPIO pins can be configured as either input or output. Input pins can be operated in different modes:</p> |
| |
| <ul> |
| <li>pull up/pull down: the pin is connected to high or low via a resistor, so that if the pin is not driven from the outside it returns to a set state.</li> |
| <li>pull up with glitch filter: like pull up except for small glitches being filtered out.</li> |
| <li>no pull: the pin floats freely, i.e. if it is not driven it keeps its current state except for environmental influences and self-drain.</li> |
| </ul> |
| |
| <h4 id="i2c">I2C</h4> |
| |
| <p>I2C can be instantiated multiple times so you can model different devices on the same bus. You can exchange either single words from one to four byte or complete messages as arrays of integer words. For multi-byte words, both little and big endianess are supported with the default being the XDK’s endianess, little endian.</p> |
| |
| <h3 id="events">Events</h3> |
| |
| <p>Some sensors provide events you can react to. These events are things like “device moved” (<code>accelerometer.any_motion</code>) or “button was pressed” (<code>button_one</code>/<code>button_two.pressed</code>).</p> |
| |
| <p>The platform itself provides a special <code>startup</code> event which is triggered after the device has fully started up. This means that all resources are initialized, for example WLAN is connected, sensors collect data, and all events are enabled.</p> |
| |
| <h1 id="specification">Specification</h1> |
| |
| <h2 id="sensors-1">Sensors</h2> |
| |
| <h3 id="accelerometer-bma280">Accelerometer (BMA280)</h3> |
| |
| <p>The BMA280 is a tri axial, low-g acceleration sensor with digital output for consumer applications. It allows measurements of acceleration in three perpendicular axes.</p> |
| |
| <h4 id="configuration-1">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td></td> |
| <td><code>range: BMA280_Range</code></td> |
| <td>The range of acceleration we want to measure. Default: <code>2G</code></td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>bandwidth: BMA280_Bandwidth</code></td> |
| <td>The low-pass filter bandwidth used by the BMA. Default: <code>500Hz</code></td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>any_motion_threshold: uint32</code></td> |
| <td>The threshold of acceleration that has to be crossed before an any motion event is triggered. Default: <code>20</code></td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>no_motion_threshold: uint32</code></td> |
| <td>The threshold of acceleration that must not be exceeded for a no motion event to be triggered. Default: <code>20</code></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="modalities">Modalities</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td></td> |
| <td><code>x_axis: int32</code></td> |
| <td>The X axis of the BMA280.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>y_axis: int32</code></td> |
| <td>The Y axis of the BMA280.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>z_axis: int32</code></td> |
| <td>The Z axis of the BMA280.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>magnitude: int32</code></td> |
| <td>The L2 norm of the acceleration vector: <code>sqrt(x^2 + y^2 + z^2)</code></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="events-1">Events</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><code>any_motion</code></td> |
| <td>The any motion event (also called activity) uses the change between two successive acceleration measurements to detect changes in motion. An event is generated when this change exceeds the any_motion_threshold.</td> |
| </tr> |
| |
| <tr> |
| <td><code>no_motion</code></td> |
| <td>The no motion event (also called any inactivity) uses the change between two successive acceleration measurements to detect changes in motion. An event is generated when this change consecutively stays below the no_motion_threshold.</td> |
| </tr> |
| |
| <tr> |
| <td><code>low_g</code></td> |
| <td>The low g event is based on comparing acceleration to a threshold which is most useful for free-fall detection.</td> |
| </tr> |
| |
| <tr> |
| <td><code>high_g</code></td> |
| <td>The high g event is based on comparing acceleration to a threshold to detect shocks or other high acceleration events.</td> |
| </tr> |
| |
| <tr> |
| <td><code>single_tap</code></td> |
| <td>A single tap is an event triggered by high activity followed shortly by no activity.</td> |
| </tr> |
| |
| <tr> |
| <td><code>double_tap</code></td> |
| <td>A double tap consists of two single tap events right after one another.</td> |
| </tr> |
| |
| <tr> |
| <td><code>flat</code></td> |
| <td>The flat event is triggered when the device is flat on the ground.</td> |
| </tr> |
| |
| <tr> |
| <td><code>orientation</code></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><code>fifo_full</code></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><code>fifo_wml</code></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><code>new_data</code></td> |
| <td>This event serves the asynchronous reading of data. It is generated after storing a new value of z-axis acceleration data in the data register.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h3 id="gyroscope-calibrated-sensor-fusion">Gyroscope (Calibrated, Sensor Fusion)</h3> |
| |
| <p>This sensor is a front end for a software library that improves on accuracy and physical limititations of the built-in sensors using sensor fusion.</p> |
| |
| <p>Alternatively you can access two hardware sensors directly: <a href="../../platforms/xdk110/#sensor-gyroscope-bmi160">BMI160</a> and <a href="../../platforms/xdk110/#sensor-gyroscope-bmg160">BMG160</a></p> |
| |
| <p>This virtual sensor only offers modalities.</p> |
| |
| <h5 id="modalities-1">Modalities</h5> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><code>x_axis: int32</code></td> |
| <td>The X axis of the gyroscope</td> |
| </tr> |
| |
| <tr> |
| <td><code>y_axis: int32</code></td> |
| <td>The Y axis of the gyroscope</td> |
| </tr> |
| |
| <tr> |
| <td><code>z_axis: int32</code></td> |
| <td>The Z axis of the gyroscope</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h3 id="gyroscope-bmi160">Gyroscope (BMI160)</h3> |
| |
| <p>The BMI160 is a small, low power, low noise 16-bit inertial measurement unit designed for use in mobile applications like augmented reality or indoor navigation which require highly accurate, real-time sensor data.</p> |
| |
| <h4 id="configuration-2">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td></td> |
| <td><code>bandwidth: BMI160_Bandwidth</code></td> |
| <td>The low-pass filter bandwidth used by the BMI160. Default: 39.9Hz.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>range: BMI160_Range</code></td> |
| <td>The range the BMI160 should measure in. Default: 2000 deg/s.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="modalities-2">Modalities</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><code>x_axis: int32</code></td> |
| <td>The X axis of the BMI160</td> |
| </tr> |
| |
| <tr> |
| <td><code>y_axis: int32</code></td> |
| <td>The Y axis of the BMI160</td> |
| </tr> |
| |
| <tr> |
| <td><code>z_axis: int32</code></td> |
| <td>The Z axis of the BMI160</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h3 id="gyroscope-bmg160">Gyroscope (BMG160)</h3> |
| |
| <p>The BMG160 is an ultra-small, digital 3-axis angular rate sensor with a measurement range up to 2000°/s and a digital resolution of 16 bit for consumer electronics applications.</p> |
| |
| <h4 id="configuration-3">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td></td> |
| <td><code>bandwidth: BMI160_Bandwidth</code></td> |
| <td>The low-pass filter bandwidth used by the BMG160. Default: 523Hz.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>range: BMI160_Range</code></td> |
| <td>The measurement range of the BMG160. Default: 2000 deg/s.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="modalities-3">Modalities</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><code>x_axis: int32</code></td> |
| <td>The X axis of the BMG160</td> |
| </tr> |
| |
| <tr> |
| <td><code>y_axis: int32</code></td> |
| <td>The Y axis of the BMG160</td> |
| </tr> |
| |
| <tr> |
| <td><code>z_axis: int32</code></td> |
| <td>The Z axis of the BMG160</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h3 id="magnetometer-bmm150">Magnetometer (BMM150)</h3> |
| |
| <p>The BMM150 is a low power and low noise 3-axis digital geomagnetic sensor to be used in compass applications.</p> |
| |
| <h4 id="configuration-4">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td></td> |
| <td><code>mode: BMM150_Preset</code></td> |
| <td>One of four preset modes. Default: <code>Regular</code>.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="modalities-4">Modalities</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><code>x_axis: int32</code></td> |
| <td>The X axis of the BMM150</td> |
| </tr> |
| |
| <tr> |
| <td><code>y_axis: int32</code></td> |
| <td>The Y axis of the BMM150</td> |
| </tr> |
| |
| <tr> |
| <td><code>z_axis: int32</code></td> |
| <td>The Z axis of the BMM150</td> |
| </tr> |
| |
| <tr> |
| <td><code>resistance: uint16</code></td> |
| <td>The resistance of the BMM150</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h3 id="environment-bme280">Environment (BME280)</h3> |
| |
| <p>The BME280 is a combined digital <strong>humidity</strong>, <strong>pressure</strong> and <strong>temperature</strong> sensor based on proven sensing principles.</p> |
| |
| <h4 id="configuration-5">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td></td> |
| <td><code>power_mode: BME280_PowerMode</code></td> |
| <td>The BME280 power mode. Default: <code>Normal</code>.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>standby_time: uint32</code></td> |
| <td>The standby time used in normal mode in milliseconds. Beware that the value supplied here will be clipped to the nearest valid value.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>temperature_oversampling: BME280_Oversampling</code></td> |
| <td>Reduces noise in the temperature measurement by over sampling. Higher oversampling settings reduce noise but increase measurement time and power consumption.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>pressure_oversampling: BME280_Oversampling</code></td> |
| <td>Reduces noise in the pressure measurement by over sampling. Higher oversampling settings reduce noise but increase measurement time and power consumption.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>humidity_oversampling: BME280_Oversampling</code></td> |
| <td>Reduces noise in the humidity measurement by over sampling. Higher oversampling settings reduce noise but increase measurement time and power consumption.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="modalities-5">Modalities</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><code>temperature : int32</code></td> |
| <td>The temperature reported by the BME280.</td> |
| </tr> |
| |
| <tr> |
| <td><code>pressure : uint32</code></td> |
| <td>The pressure reported by the BME280.</td> |
| </tr> |
| |
| <tr> |
| <td><code>humidity : uint32</code></td> |
| <td>The humidity reported by the BME280 in percentage.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h3 id="light-max44009">Light(MAX44009)</h3> |
| |
| <p>The XDK light sensor.</p> |
| |
| <h4 id="configuration-6">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td></td> |
| <td><code>manual_mode: bool</code></td> |
| <td>Enables the manual configuration of integration time and high brightness mode. If set to <code>false</code> (default) the chip automatically selects those values. Default: <code>false</code>.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>integration_time: MAX44009_IntegrationTime</code></td> |
| <td>The integration time is the time the sensor collects light for. In automatic mode (manual mode set to <code>false</code>) the chip automatically selects the integration time. Default: 800ms.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>high_brightness: bool</code></td> |
| <td>Set to <code>true</code> so that only <sup>1</sup>⁄<sub>8</sub> of the photo diode current goes to the ADC. This mode is used in high-brightness situations to avoid saturation/clipping effects of the ADC. Default: <code>false</code>.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>continuous_mode: bool</code></td> |
| <td>In default mode (<code>false</code>) the IC measures lux intensity only once every 800ms regardless of integration time. This mode allows the part to operate at its lowest possible supply current. <br><br> In continuous mode (<code>true</code>) the IC continuously measures lux intensity. That is, as soon as one reading is finished, a new one begins. If integration time is 6.25ms, readings are taken every 6.25ms. If integration time is 800ms, readings are taken every 800ms. In this mode, the part consumes slightly higher power than in the default mode. Default: <code>false</code>.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="modalities-6">Modalities</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><code>intensity: uint32</code></td> |
| <td>The light intensity of the MAX44009.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h3 id="noise-sensor">Noise Sensor</h3> |
| |
| <p>The noise sensor uses the XDK’s microphone to detect noise around it. The noise is calculated over 256 microphone samples. Note that this value is without unit and needs to be calibrated/converted by your application if you require absolute noise level measurements.</p> |
| |
| <h4 id="configuration-7">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td></td> |
| <td><code>samplingFrequency: uint32</code></td> |
| <td>How often the microphone is sampled in Hertz. Default: <code>2560Hz</code>.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>timeout: uint32</code></td> |
| <td>If not enough samples are ready how long to wait for additional samples in milliseconds. Default: <code>100ms</code>.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="modalities-7">Modalities</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><code>noise: float</code></td> |
| <td>An uncalibrated noise level. Should not enough samples be ready when getting this modality even after waiting <code>timeout</code> milliseconds this will throw an exception.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h3 id="buttons">Buttons</h3> |
| |
| <p>The XDK features two buttons. Pressed and released are encoded by <code>true</code> and <code>false</code> in Mita. Button presses can be detected using event handlers, i.e. <code>every button_one.pressed</code>.</p> |
| |
| <h4 id="modalities-8">Modalities</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><code>is_pressed: bool</code></td> |
| <td>True if the button is pressed in this very right moment. False otherwise.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="events-2">Events</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><code>pressed</code></td> |
| <td>Fires after the button was pressed.</td> |
| </tr> |
| |
| <tr> |
| <td><code>released</code></td> |
| <td>Fires after the button was released.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="connectivities-1">Connectivities</h2> |
| |
| <h3 id="led">LED</h3> |
| |
| <p>The XDK features three custom usable LEDs in red, orange and yellow. On and off are encoded using <code>true</code> and <code>false</code> in Mita.</p> |
| |
| <h4 id="modalities-9">Modalities</h4> |
| |
| <p>Name | Description | Parameters | |
| ——————————–|—————————————|————|———— |
| <code>light_up: bool</code> | Represents one of the three LEDs. | <code>color: LedColor</code> | One of <code>Yellow</code>, <code>Orange</code> or <code>Red</code>.</p> |
| |
| <h3 id="adc">ADC</h3> |
| |
| <p>The XDK’s ADC (Analog Digital Converter) can measure voltages against internal or external potentials.</p> |
| |
| <h4 id="configuration-8">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td></td> |
| <td><code>externalReferenceVoltage: uint16</code></td> |
| <td>The reference voltage to measure against when you use an external reference voltage in a signal in [mV].</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="signals">Signals</h4> |
| |
| <p>Name | Description | Parameters | |
| ——————————–|—————————————|————|———— |
| <code>channel: uint16</code> | An ADC channel, read only. [mV] | <code>channel: ADC_Channel</code> | Which channel to measure. |
| || <code>referenceVoltage: ADC_Reference_Voltage</code> | Which voltage to measure against. Default: <code>2.5V</code> internal voltage reference. |
| || <code>resolution: ADC_Resolution</code> | Default: <code>12 bit</code> |
| || <code>sampleTime: ADC_SampleTime</code> | Over how many <em>clock</em> cycles the ADC samples its input. Default: <code>16</code> cycles.</p> |
| |
| <h3 id="ble">BLE</h3> |
| |
| <p>BLE (Bluetooth Low Energy) allows the XDK to communicate over short range, up to 50m, with various devices like smartphones. In BLE a server continuously advertises all characteristics and clients can connect without requiring further interaction or authentication.</p> |
| |
| <h4 id="configuration-9">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td></td> |
| <td><code>deviceName: string</code></td> |
| <td>The name of the device as advertised via GAP.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>macAddress: string</code></td> |
| <td>MAC address of the device. Must start with <code>FC-D6-BD</code>. You may use either colon <code>:</code> or dash <code>-</code> as byte separators.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>serviceUID: uint32</code></td> |
| <td>The last four bytes of the UUID of the GATT service we’ll create.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>advertisingInterval: int16</code></td> |
| <td>The GAP advertisement interval. Default: <code>1000</code>.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="signals-1">Signals</h4> |
| |
| <p>Name | Description | Parameters | |
| ——————————–|—————————————|————|———— |
| <code>bool_characteristic(): bool</code> | A boolean GATT characteristic. | <code>UUID: uint32</code> | The last four bytes of the characteristic UUID. Defaults to the hash code of the VCI name. |
| <code>uint32_characteristic(): uint32</code> | An unsigned integer GATT characteristic. | <code>UUID: uint32</code> | The last four bytes of the characteristic UUID. Defaults to the hash code of the VCI name. |
| <code>int32_characteristic(): int32</code> | A signed integer GATT characteristic. | <code>UUID: uint32</code> | The last four bytes of the characteristic UUID. Defaults to the hash code of the VCI name.</p> |
| |
| <h3 id="wlan">WLAN</h3> |
| |
| <p>WLAN is one of the hardware connectivities available on the XDK. Configuration is done using <a href="../../language/types/#sum-tymes">sum types</a>. Even though the concept of sum types may be daunting they are actually very easy to use. |
| Say you want to configure <code>authentication</code>. Content assist (<code>CTRL+Space</code>) offers you three different choices: <code>None</code>, <code>Enterprise</code> and <code>Personal</code>. Each accepts a different number of parameters. For example to configure a WLAN with WPA2 Personal you would write this:</p> |
| <div class="highlight"><pre class="chroma"><code class="language-TypeScript" data-lang="TypeScript"><span class="nx">setup</span> <span class="nx">net</span>: <span class="kt">WLAN</span> <span class="p">{</span> |
| <span class="nx">ssid</span> <span class="o">=</span> <span class="s2">"MyWlan"</span><span class="p">;</span> |
| <span class="nx">authentication</span> <span class="o">=</span> <span class="nx">Personal</span><span class="p">(</span><span class="nx">psk</span> <span class="o">=</span> <span class="s2">"mySecretKey"</span><span class="p">);</span> |
| <span class="cm">/* ... */</span> |
| <span class="p">}</span></code></pre></div> |
| <p>Configuring IP address works the same: you can choose from either <code>Dhcp</code> or <code>Static</code>.</p> |
| |
| <p>Content assist will help you fill in all parameters.</p> |
| |
| <h4 id="configuration-10">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>authentication: Authentication</code></td> |
| <td>How to authenticate to the WLAN network.</td> |
| </tr> |
| |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>ssid: string</code></td> |
| <td>The SSID of the WLAN network we want to connect to.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>isHostPgmEnabled: bool</code></td> |
| <td>If true, server certificate will be uploaded to the WLAN chip CC3100. Make sure to update service pack of the WLAN and then upload the certificate. Certificate must placed under <code>XDK110/common/certs/XDKDummy</code>. Default: <code>false</code>.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>ipConfiguration: IpConfiguration</code></td> |
| <td>How to configure IP address. Default: <code>Dhcp()</code>.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h3 id="mqtt">MQTT</h3> |
| |
| <p>MQTT is a messaging protocol for low bandwidth networks. The current implementation is based on the serval stack. MQTT requires a setup WLAN resource.</p> |
| |
| <h4 id="example">Example</h4> |
| <div class="highlight"><pre class="chroma"><code class="language-TypeScript" data-lang="TypeScript"><span class="nx">setup</span> <span class="nx">net</span>: <span class="kt">WLAN</span> <span class="p">{</span> <span class="cm">/* ... */</span> <span class="p">}</span> |
| |
| <span class="nx">setup</span> <span class="nx">backend</span>: <span class="kt">MQTT</span> <span class="p">{</span> |
| <span class="nx">transport</span> <span class="o">=</span> <span class="nx">net</span><span class="p">;</span> |
| <span class="nx">url</span> <span class="o">=</span> <span class="s2">"mqtt://iot.eclipse.org"</span><span class="p">;</span> |
| <span class="nx">clientId</span> <span class="o">=</span> <span class="s2">"XDK42"</span><span class="p">;</span> |
| |
| <span class="kd">var</span> <span class="nx">telemetry</span> <span class="o">=</span> <span class="nx">topic</span><span class="p">(</span><span class="s2">"telemetry"</span><span class="p">);</span> |
| <span class="p">}</span> |
| |
| <span class="nx">every</span> <span class="mi">100</span> <span class="nx">milliseconds</span> <span class="p">{</span> |
| <span class="nx">backend</span><span class="p">.</span><span class="nx">telemetry</span><span class="p">.</span><span class="nx">write</span><span class="p">(</span><span class="sb">`</span><span class="si">${</span><span class="nx">accelerometer</span><span class="p">.</span><span class="nx">magnitude</span><span class="p">.</span><span class="nx">read</span><span class="p">()</span><span class="si">}</span><span class="sb">`</span><span class="p">);</span> |
| <span class="p">}</span></code></pre></div> |
| <h4 id="configuration-11">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>transport: WLAN</code></td> |
| <td>The transport layer used for communication.</td> |
| </tr> |
| |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>url: string</code></td> |
| <td>The URL pointing to the MQTT broker, for example: <code>mqtt://does-not.exist:1883</code>. You can use MQTT with TLS by specifying the protocol <code>mqtts://</code> instead of <code>mqtt://</code>. Doing so requires you to specify the expected server certificate with <code>certificatePath</code>.</td> |
| </tr> |
| |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>clientId: string</code></td> |
| <td>A unique name the broker can use to identify devices. No two clients may have the same name per broker.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>authentication: MqttAuthentication</code></td> |
| <td>Username/Password authentication or unauthenticated, for example <code>authentication = Login("user", "pass")</code>. Default: <code>None()</code>.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>lastWill: MqttWill</code></td> |
| <td>The last will that will be published on a forceful disconnect. Either <code>NoWill()</code> or <code>LastWill(topic="topic", message="message", qos=1)</code>. Default: <code>NoWill()</code>.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>cleanSession: bool</code></td> |
| <td>The clean session flag indicates to the broker whether the client wants to establish a clean session or a persistent session where all subscriptions and messages (QoS 1 & 2) are stored for the client. Default: <code>false</code>.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>keepAliveInterval: uint32</code></td> |
| <td>The keep alive interval (in seconds) is the time the client commits to for when sending regular pings to the broker. The broker responds to the pings enabling both sides to determine if the other one is still alive and reachable. Default: <code>60</code>.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>certificatePath: string</code></td> |
| <td>The path to the expected server certificate used for MQTT with TLS. Can be an absolute path like <code>C:\certificates\mosquitto.crt</code> or <code>/etc/ssl/certs/mosquitto.crt</code> or a relative path like <code>certificates/server.crt</code>. In the latter case this will look for the certificate relative to the project root. The certificate needs to be in PEM format (<code>-----BEGIN CERTIFICATE-----</code>/<code>-----END CERTIFICATE-----</code>). <strong>This configuration item is required when using MQTT over TLS.</strong></td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>sntpServer: string</code></td> |
| <td>To verify the server’s certificate the XDK needs to get the current time over SNTP. Per default it connects to <code>pool.ntp.org:123</code>, however if for some reason like being in a closed network you cannot access this NTP server you can specify your own.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="signals-2">Signals</h4> |
| |
| <p>Name | Description | Parameters | |
| ——————————–|—————————————|————|———— |
| <code>topic: string</code> | Publishes a message to a particular topic. | <code>name: string</code> | The topic’s name. |
| || <code>qos: uint32</code> | Default: <code>0</code></p> |
| |
| <h3 id="eclipse-hono">Eclipse Hono</h3> |
| |
| <p>Mita implements a <code>HonoMqtt</code> resource you can use to easily connect to an <a href="https://www.eclipse.org/hono/">Eclipse Hono</a> service via MQTT.</p> |
| |
| <h4 id="example-1">Example</h4> |
| <div class="highlight"><pre class="chroma"><code class="language-TypeScript" data-lang="TypeScript"><span class="nx">setup</span> <span class="nx">net</span>: <span class="kt">WLAN</span> <span class="p">{</span> <span class="cm">/* ... */</span> <span class="p">}</span> |
| |
| <span class="nx">setup</span> <span class="nx">backend</span>: <span class="kt">HonoMqtt</span> <span class="p">{</span> |
| <span class="nx">transport</span> <span class="o">=</span> <span class="nx">net</span><span class="p">;</span> |
| <span class="nx">url</span> <span class="o">=</span> <span class="s2">"mqtt://iot.eclipse.org"</span><span class="p">;</span> |
| <span class="nx">clientId</span> <span class="o">=</span> <span class="s2">"XDK42"</span><span class="p">;</span> |
| <span class="nx">authentication</span> <span class="o">=</span> <span class="nx">Authenticated</span><span class="p">(</span><span class="nx">username</span><span class="o">=</span><span class="s2">"consumer@HONO"</span><span class="p">,</span> <span class="nx">password</span><span class="o">=</span><span class="s2">"verysecret"</span><span class="p">);</span> |
| |
| <span class="kd">var</span> <span class="nx">telemetry</span> <span class="o">=</span> <span class="nx">telemetry</span><span class="p">(</span><span class="nx">qos</span><span class="o">=</span><span class="mi">0</span><span class="p">);</span> |
| <span class="p">}</span> |
| |
| <span class="nx">every</span> <span class="mi">100</span> <span class="nx">milliseconds</span> <span class="p">{</span> |
| <span class="nx">backend</span><span class="p">.</span><span class="nx">telemetry</span><span class="p">.</span><span class="nx">write</span><span class="p">(</span><span class="sb">`</span><span class="si">${</span><span class="nx">accelerometer</span><span class="p">.</span><span class="nx">magnitude</span><span class="p">.</span><span class="nx">read</span><span class="p">()</span><span class="si">}</span><span class="sb">`</span><span class="p">);</span> |
| <span class="p">}</span></code></pre></div> |
| <h4 id="configuration-12">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>transport: WLAN</code></td> |
| <td>The transport layer used for communication.</td> |
| </tr> |
| |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>url: string</code></td> |
| <td>The URL pointing to the MQTT broker, for example: <code>mqtt://does-not.exist:1883</code>.</td> |
| </tr> |
| |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>clientId: string</code></td> |
| <td>A unique name the broker can use to identify devices. No two clients may have the same name per broker.</td> |
| </tr> |
| |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>authentication: HonoAuthentication</code></td> |
| <td>Credentials or identification for authentication to the Hono network.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="signals-3">Signals</h4> |
| |
| <p>Name | Description | Parameters | |
| ——————————–|—————————————|————|———— |
| <code>telemetry: string</code> | Publishes a message to a particular topic. | <code>qos: uint32</code> | Default: <code>0</code> |
| <code>event: string</code> | Publishes a message to a particular topic. | <code>qos: uint32</code> | Default: <code>0</code></p> |
| |
| <h3 id="rest-over-http">REST over HTTP</h3> |
| |
| <p>Using REST you can easily talk to servers over HTTP. REST defines a stateless interface with a simple URL scheme. Normally a REST server consists of a versioned endpoint like <code>http://api.github.com/v3</code> which then provides different resources, for example <code>api.github.com/v3/repos/eclipse/mita/branches</code> and <code>/repos/eclipse/mita/issues</code>.</p> |
| |
| <p>Currently only writing is supported.</p> |
| |
| <h4 id="example-2">Example</h4> |
| <div class="highlight"><pre class="chroma"><code class="language-TypeScript" data-lang="TypeScript"><span class="nx">setup</span> <span class="nx">net</span>: <span class="kt">WLAN</span> <span class="p">{</span> <span class="cm">/* ... */</span> <span class="p">}</span> |
| |
| <span class="nx">setup</span> <span class="nx">backend</span>: <span class="kt">HttpRestClient</span> <span class="p">{</span> |
| <span class="nx">transport</span> <span class="o">=</span> <span class="nx">net</span><span class="p">;</span> |
| <span class="nx">endpointBase</span> <span class="o">=</span> <span class="s2">"http://jsonplaceholder.typicode.com"</span><span class="p">;</span> |
| |
| <span class="kd">var</span> <span class="nx">posts</span> <span class="o">=</span> <span class="nx">resource</span><span class="p">(</span><span class="s2">"/posts"</span><span class="p">);</span> |
| <span class="p">}</span> |
| |
| <span class="nx">every</span> <span class="mi">100</span> <span class="nx">milliseconds</span> <span class="p">{</span> |
| <span class="nx">backend</span><span class="p">.</span><span class="nx">branches</span><span class="p">.</span><span class="nx">write</span><span class="p">(</span><span class="sb">`</span><span class="si">${</span><span class="nx">accelerometer</span><span class="p">.</span><span class="nx">magnitude</span><span class="p">.</span><span class="nx">read</span><span class="p">()</span><span class="si">}</span><span class="sb">`</span><span class="p">);</span> |
| <span class="p">}</span></code></pre></div> |
| <h4 id="configuration-13">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>transport: WLAN</code></td> |
| <td>The transport layer used for communication.</td> |
| </tr> |
| |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>endpointBase: string</code></td> |
| <td>The server URL base to which REST requests are made.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>headerContent: string</code></td> |
| <td>A custom header which is added to each HTTP request. Example: <code>"X-Auth: MySecretToken\nX-Version: 1.0"</code>.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="signal">Signal</h4> |
| |
| <p>Name | Description | Parameters | |
| ——————————–|—————————————|————|———— |
| <code>resource: string</code> | A REST resource on the server. | <code>endpoint: string</code> | The REST path to the resource. |
| || <code>writeMethod: HttpMethod</code> | Which method to use when writing. Default: <code>POST</code> |
| || <code>readMethod: HttpMethod</code> | Which method to use when reading. Default: <code>GET</code></p> |
| |
| <h2 id="buses-1">Buses</h2> |
| |
| <h3 id="gpio-1">GPIO</h3> |
| |
| <p>GPIO provides bit-wise communication with the environment. Low (0V) and high (3.3V) are represented by <code>false</code> and <code>true</code>.</p> |
| |
| <h4 id="example-3">Example</h4> |
| <div class="highlight"><pre class="chroma"><code class="language-TypeScript" data-lang="TypeScript"><span class="nx">setup</span> <span class="nx">test</span>: <span class="kt">GPIO</span> <span class="p">{</span> |
| <span class="kd">var</span> <span class="nx">out</span> <span class="o">=</span> <span class="nx">digitalOut</span><span class="p">(</span><span class="nx">pin</span> <span class="o">=</span> <span class="nx">PA1</span><span class="p">,</span> <span class="nx">initialValue</span> <span class="o">=</span> <span class="kc">false</span><span class="p">);</span> |
| <span class="kd">var</span> <span class="nx">inp</span> <span class="o">=</span> <span class="nx">digitalIn</span><span class="p">(</span><span class="nx">pin</span> <span class="o">=</span> <span class="nx">PB2</span><span class="p">,</span> <span class="nx">mode</span> <span class="o">=</span> <span class="nx">PullDown</span><span class="p">);</span> |
| <span class="p">}</span> |
| |
| <span class="nx">every</span> <span class="mi">100</span> <span class="nx">milliseconds</span> <span class="p">{</span> |
| <span class="nx">test</span><span class="p">.</span><span class="nx">out</span><span class="p">.</span><span class="nx">write</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span> |
| <span class="kd">let</span> <span class="nx">x</span> <span class="o">=</span> <span class="nx">test</span><span class="p">.</span><span class="nx">inp</span><span class="p">.</span><span class="nx">read</span><span class="p">();</span> |
| <span class="p">}</span></code></pre></div> |
| <h4 id="signals-4">Signals</h4> |
| |
| <p>Name | Description | Parameters | |
| ——————————–|—————————————|————|———— |
| <code>digitalIn: bool</code> | A GPIO-pin configured in input mode. | <code>pin: GPIOPin</code> | which pin to configure. |
| | | <code>mode: GPIOMode</code> | whether this pin is pull up, pull down or floating. |
| <code>digitalOut: bool</code> | A GPIO-pin configured in output mode. | <code>pin: GPIOPin</code> | which pin to configure. |
| | | <code>initialValue: bool</code> | The pin’s initial value after startup. Default is low (<code>false</code>).</p> |
| |
| <h3 id="i2c-1">I2C</h3> |
| |
| <p>The I2C bus provides access to interfaced devices via I2C.</p> |
| |
| <h4 id="configuration-14">Configuration</h4> |
| |
| <table> |
| <thead> |
| <tr> |
| <th></th> |
| <th>Name</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| |
| <tbody> |
| <tr> |
| <td><strong>Required</strong></td> |
| <td><code>deviceAddress: uint8</code></td> |
| <td>The slave address identifying the interfaced device on the I2C bus.</td> |
| </tr> |
| |
| <tr> |
| <td></td> |
| <td><code>byteOrder: ByteOrder</code></td> |
| <td>Byte ordering for multi-byte words. Default is little endian, the XDK’s internal order.</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h4 id="signals-5">Signals</h4> |
| |
| <p>Name | Description | Parameters | |
| ——————————–|—————————————|————|———— |
| <code>register_</code><em>intType</em><code>:</code><em>intType</em> | A device register of size and sign specified by <em>intType</em>. | <code>address: uint8</code> | the register’s address. |
| | | <code>I2CMode: I2CMode</code> | whether this register is read, write, both or none. This only has an effect on validation, not on initialization. |
| <code>array_register_</code> <em>intType</em> <code>: array<</code><em>intType</em><code>></code> | A device register consisting of multiple words of size and sign specified by <em>intType</em>. | <code>address: uint8</code> | the register’s starting address. |
| | | <code>I2CMode: I2CMode</code> | whether this register is read, write, both or none. This only has an effect on validation, not on initialization. |
| | | <code>length: uint8</code> | how many words this register consists of.</p> |
| |
| <h2 id="io">IO</h2> |
| |
| <h3 id="sd-card">SD Card</h3> |
| |
| <p>SD cards can be used to log data without connectivity. Only FAT32 is supported.</p> |
| |
| <p>There are different kinds of file access:</p> |
| |
| <ul> |
| <li>read or write</li> |
| <li>resuming/appending or rewinding</li> |
| <li>text or binary</li> |
| </ul> |
| |
| <p>Resuming only applies to read access to files. It means that, when you do consecutive reads, the second reads picks up where the first left of.</p> |
| |
| <p>Appending only applies to write access to files. It means that, when you write to an already existing file, you will always append content.</p> |
| |
| <p>Rewinding applies to both kinds of accesses to files. It means that reads or writes always start at the beginning of the file. When writing, the file will always be truncated first.</p> |
| |
| <p>Text means you will get null terminated strings, where binary will give you blocks of bytes.</p> |
| |
| <p>In all cases, writing will ensure that the file exists and create it if it doesn’t.</p> |
| |
| <p>You can declare multiple files with the same path; this way you can read and write at the same time or emulate pipes.</p> |
| |
| <p>Files will not stay open between calls, this means that you can safely declare a file with write access multiple times, for example to read it in both text- and binary-mode.</p> |
| |
| <h4 id="configuration-15">Configuration</h4> |
| |
| <p>Name | Description | Parameters | |
| ——————————–|—————————————|————|———— |
| <code>resumingTextRead: string</code> | Provides read access to a file. Continues reading from last position. | <code>filePath: string</code> | The absolute path to the file. |
| | | <code>blockSize: uint32</code> | The size of the buffer to be read at once. |
| <code>appendingTextWrite: string</code> | Provides write access to a file. Appends to existing files. | <code>filePath: string</code> | The absolute path to the file. |
| <code>rewindingTextRead: string</code> | Provides read access to a file. Always reads from the start of the file. | <code>filePath: string</code> | The absolute path to the file. |
| | | <code>fileSize: uint32</code> | The size of the buffer to be read at once. |
| <code>rewindingTextWrite: string</code> | Provides write access to a file. Always truncates the file. | <code>filePath: string</code> | The absolute path to the file. |
| <code>resumingBinaryRead: array<uint8></code> | Provides read access to a file. Continues reading from last position. Reads bytes instead of text. | <code>filePath: string</code> | The absolute path to the file. |
| | | <code>blockSize: uint32</code> | The size of the buffer to be read at once. |
| <code>appendingBinaryWrite: array<uint8></code> | Provides write access to a file. Appends to existing files. Reads bytes instead of text. | <code>filePath: string</code> | The absolute path to the file. |
| <code>rewindingBinaryRead: array<uint8></code> | Provides read access to a file. Always reads from the start of the file. Reads bytes instead of text. | <code>filePath: string</code> | The absolute path to the file. |
| | | <code>fileSize: uint32</code> | The size of the buffer to be read at once. |
| <code>rewindingBinaryWrite: array<uint8></code> | Provides write access to a file. Always truncates the file. Reads bytes instead of text. | <code>filePath: string</code> | The absolute path to the file.</p> |
| |
| |
| |
| <aside class="copyright" role="note"> |
| <div class="incubation"> |
| <a href="https://www.eclipse.org/projects/what-is-incubation.php" target="_blank"> |
| <img src="../../images/incubating.png" /> |
| </a> |
| </div> |
| <div class="logo"> |
| <a href="https://www.eclipse.org" target="_blank"> |
| <img src="../../images/eclipse_foundation_logo.svg" /> |
| </a> |
| </div> |
| <p class="notice"> |
| |
| Documentation built with |
| <a href="https://www.gohugo.io" target="_blank">Hugo</a> |
| using the |
| <a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme. |
| </p> |
| <p class="quickLinks"> |
| <a href="http://www.eclipse.org/legal/privacy.php" target="_blank"> |
| > Privacy Policy |
| </a> |
| <a href="http://www.eclipse.org/legal/termsofuse.php" target="_blank"> |
| > Terms of Use |
| </a> |
| <a href="http://www.eclipse.org/legal/copyright.php" target="_blank"> |
| > Copyright Agent |
| </a> |
| <a href="http://www.eclipse.org/legal" target="_blank"> |
| > Legal |
| </a> |
| <a href="https://eclipse.org/security" target="_blank"> |
| > Report a Vulnerability |
| </a> |
| </p> |
| </aside> |
| </div> |
| </article> |
| |
| <div class="results" role="status" aria-live="polite"> |
| <div class="scrollable"> |
| <div class="wrapper"> |
| <div class="meta"></div> |
| <div class="list"></div> |
| </div> |
| </div> |
| </div> |
| </main> |
| |
| <script> |
| |
| var base_url = ''; |
| var repo_id = ''; |
| |
| </script> |
| |
| <script src="../../javascripts/application.js"></script> |
| |
| |
| <script> |
| /* Add headers to scrollspy */ |
| var headers = document.getElementsByTagName("h2"); |
| var scrollspy = document.getElementById('scrollspy'); |
| |
| if(scrollspy) { |
| if(headers.length > 0) { |
| for(var i = 0; i < headers.length; i++) { |
| var li = document.createElement("li"); |
| li.setAttribute("class", "anchor"); |
| |
| var a = document.createElement("a"); |
| a.setAttribute("href", "#" + headers[i].id); |
| a.setAttribute("title", headers[i].innerHTML); |
| a.innerHTML = headers[i].innerHTML; |
| |
| li.appendChild(a) |
| scrollspy.appendChild(li); |
| } |
| } else { |
| scrollspy.parentElement.removeChild(scrollspy) |
| } |
| |
| |
| /* Add permanent link next to the headers */ |
| var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6"); |
| |
| for(var i = 0; i < headers.length; i++) { |
| var a = document.createElement("a"); |
| a.setAttribute("class", "headerlink"); |
| a.setAttribute("href", "#" + headers[i].id); |
| a.setAttribute("title", "Permanent link") |
| a.innerHTML = "#"; |
| headers[i].appendChild(a); |
| } |
| } |
| </script> |
| |
| |
| |
| <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script> |
| <script>hljs.initHighlightingOnLoad();</script> |
| </body> |
| </html> |