mirror of
https://github.com/eclipse/upm.git
synced 2025-03-14 20:47:30 +03:00
2 lines
8.3 KiB
HTML
2 lines
8.3 KiB
HTML
<!doctype html><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"><link href="https://fonts.googleapis.com/css?family=Roboto+Slab:100,300,400,700|Roboto:100,300,400,500,700,900" rel="stylesheet"><link rel="shortcut icon" type="image/png" href="/assets/images/favicon.png"/><link rel="stylesheet" href="/assets/css/style.css"><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/dracula.min.css"> <script src="/assets/js/library/jquery-2.2.4.min.js"></script> <script src="/assets/js/library/handlebars.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script> <script type="text/javascript">hljs.initHighlightingOnLoad();</script> <script type="text/javascript"> $(function(){ var current = location.pathname; $('.nav li a').each(function(){ var $this = $(this); /* if the current path is like this link, make it active */ if($this.attr('href').indexOf(current) !== -1){ $this.addClass('active'); } }) }); </script> <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','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-17890616-13', 'auto'); ga('send', 'pageview'); </script><body><header><nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"><div class="container"><div class="row"><div class="col-xs-12 col-sm-5"> <a class="navbar-logo pull-left" href="/"> <img src="/assets/images/logo.png" class="logo-img"> </a><div class="navbar-header pull-right" style="display: inline-block;"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button></div></div><div class="col-sm-7 col-xs-12 menu-inner"><div id="navbar" class="navbar-collapse collapse"><ul class="nav navbar-nav navbar-right nav-list"><li> <a href="/findSensor.html"><span class="icon find-sensor" ></span> <span class="">Find</span></a><li> <a href="/addSensor.html"><span class="icon add-sensor" ></span> <span class="">Join</span></a><li> <a href="/Documentation/docindex.html"><span class="icon documentation" ></span> <span class="">Documentation</span></a><li> <a href="https://github.com/intel-iot-devkit/upm" target="_blank"><span class="icon github github-mobile"></span> <span class="github-desktop">Github</span></a></ul></div></div></div></div></nav></header><main><div class="main-container inner-pages"><div class="container"><div class="row"><div class="col-sm-8 col-xs-12 "><div class="page-heading"> Share your sensors and code.</div></div></div></div><div class="section-wrapper add-sensor"><div class="container"><div class="row "><div class="col-sm-8"><div class="heading">Instructions and templates</div><div class="description">The IoT community benefits from access to lots of sensors and code. Share yours. Just write it up and turn it in for review. Once we make sure it works well with UPM and is open source and is free, we’ll post it to the library.</div><div class="separator"></div><div class="heading">Rules and guidelines</div><div class="description">Your driver should be written in C/C++ with SWIG interfaces, have proper documentation and include at least one example.<div class="detail-link"><table class="documentation-table"><tr><td style="width: 40%"><a class="link" href="/Documentation/contributingrules.html"> Contribution rules</a><td style="width: 60%"><a target="_blank" class="link" href="https://github.com/intel-iot-devkit/upm/blob/master/docs/creating_java_bindings.md"> Creating Java* bindings</a><tr><td style="width:40%"><a class="link" href="/Documentation/moduleNaming.html"> Module naming</a><td style="width: 60%"><a target="_blank" class="link" href="https://github.com/intel-iot-devkit/upm/blob/master/docs/documentation.md"> Writing sensor documentation</a><tr><td style="width: 40%"><td style="width: 60%"><a target="_blank" class="link" href="https://github.com/intel-iot-devkit/upm/blob/master/docs/guidelines.md"> Code commenting and documentation guidelines</a></table></div></div></div></div></div></div><div class="section-wrapper add-sensor background-theme"><div class="container"><div class="row "><div class="col-sm-8 col-xs-12"><div class="heading">Step-by-step: Creating or porting a module</div><div class="description">Porting Arduino libraries to MRAA as UPM libraries is usually easy. The key to successful sharing is to understand how a non-real time OS deals with interrupts and timers. It also depends on the sensor’s design. For a detailed example, see Making a UPM module for MAX31855.</div><div class="title">Adding a new module to UPM</div><div class="description"> 1. Review contribution rules (see <a class="link" href="/Documentation/contributingrules.html">Contribution rules</a> and <a target="_blank" class="link" href="https://github.com/intel-iot-devkit/upm/blob/master/docs/documentation.md"> Writing sensor documentation</a>)<br /> 2. Choose a name for your module (see <a class="link" href="/Documentation/moduleNaming.html">Module naming </a>)<br /> 3. Make a new folder in src/modulename<br /> 4. Create a CMakeLists.txt file inside src/modulename<br /></div><div class="title">CmakeLists.txt</div><div class="description"><div>By default, you'll need a header called modulename.hpp and a C++ file called modulename.cxx. You can have multiple headers and source files. Only public headers need to be added to module_hpp. All source files need to be in module_src.</div><br /> set (libname "modulename")<br /> set (libdescription "Module Description")<br /> set (module_src ${libname}.cxx)<br /> set (module_hpp ${libname}.hpp)<br /> upm_module_init()<br /></div><div class="title">Making your API</div><div class="description">If you’re starting from scratch, use the <a href="/Documentation/contributingrules.html" class="link"> new sensor template</a>. Most UPM APIs have a simple set of functions. A simple object->read() function is usually preferred. Depending on your sensor/actuator, however, this may or may not be easy or not even make sense. In that case, you should look at a sensor on UPM that’s similar to yours and see how its APIs were created.</div><br /><div class="description">Create a class for your sensor with a constructor that defines the pins it is on. This constructor will create the mraa_*_context structs that are required to talk to the board's IO. An I2c sensor will create a mraa_i2c_context. Keep it as a private member and require a bus number and slave address in its constructor.</div><div class="title">Mapping Arduino API to libmraa</div><div class="description">Your constructor is similar to the setup() function in Arduino, you should initialize your IO the way you want it. This means initializing contexts (private members) and setting the correct modes for them.</div><br /><div class="description">See the MRAA API documentation for the exact API.</div><div class="title">Building your module</div><div class="description">To build your module just follow Building UPM. By creating a folder and the CMakelists.txt file you have done all that is required to add your sensor to the UPM build system.</div><div class="title">Sending your module to us for inclusion in UPM</div><div class="description">The last step is when you're happy with your module and it works send us a pull request! We'd love to include your sensor in our repository.</div><div class="description document-padding">Feel free to use github, or email us at mihai.tudor.panu@intel.com with a git formatted patch of your sensor.<a target="_blank" href="https://help.github.com/articles/creating-a-pull-request/" class="link"> Learn more about creating a pull request.</a></div></div></div></div></div></div><footer class="site-footer"><div class="container"><div class="row"><div class="col-xs-6"><p class="text-muted">(* Trademarks)</div><div class="col-xs-6 text-right"><p class="text-muted">© 2017 UPM</div></div></div><script src="/assets/js/library/bootstrap.min.js"></script></footer></main>
|