mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 01:41:12 +03:00
mraa: change all existing code to use libmraa.
* Made CMake depend on 0.4 libmraa Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
@ -11,6 +11,6 @@ Here are the rules of contribution:
|
||||
avoid GPL. (LGPL is fine). If your license is not MIT please include a
|
||||
LICENSE file in src/<mymodule>/
|
||||
- Please test your module builds before contributing and make sure it works on
|
||||
the latest version of maa. If you tested on a specific board/platform please
|
||||
the latest version of mraa. If you tested on a specific board/platform please
|
||||
tell us what this was in your PR.
|
||||
|
||||
|
@ -9,7 +9,7 @@ people made arduino code already so we'll use that as a
|
||||
|
||||
### Basics
|
||||
|
||||
This is a spi module so we will use the maa spi functions to build our module.
|
||||
This is a spi module so we will use the mraa spi functions to build our module.
|
||||
First thing to do is to create a tree structure like this in upm/src/max31855:
|
||||
|
||||
* max31855.cxx
|
||||
|
@ -1,7 +1,7 @@
|
||||
Porting a module from Arduino {#porting}
|
||||
=============================
|
||||
|
||||
Porting arduino libraries to libmaa as UPM libraries is usually fairly easy.
|
||||
Porting arduino libraries to libmraa as UPM libraries is usually fairly easy.
|
||||
The issues typically come from misunderstanding of how a non real time OS deals
|
||||
with interupts and timers. It also highly depends on the sensor. A concrete
|
||||
example is explained in detail on @ref max31855
|
||||
@ -31,22 +31,22 @@ upm_module_init()
|
||||
|
||||
The easiest way to do this is to have a look at a similar sensor to yours.
|
||||
Typically create a class for your sensor with a constructor that defines the
|
||||
pins it is on. This constructor will create the maa_*_context structs that are
|
||||
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
|
||||
maa_i2c_context, keep it as a private member and require a bus number and slave
|
||||
mraa_i2c_context, keep it as a private member and require a bus number and slave
|
||||
address in it's constructor.
|
||||
|
||||
Typically in sensors a simple object->read() function is prefered, depending on
|
||||
your sensor/actuaotr this may or may not be easy or not even make sense. Most
|
||||
UPM apis have a simple set of functions.
|
||||
|
||||
### Mapping arduino API to libmaa
|
||||
### Mapping arduino API to libmraa
|
||||
|
||||
Your constructor is similar to the setup() function in arduino, you should
|
||||
initialise your IO the way you want it. This means initialising contexts
|
||||
(private members) and setting the correct modes for them.
|
||||
|
||||
See the maa API documentation for exact API.
|
||||
See the mraa API documentation for exact API.
|
||||
|
||||
### Building
|
||||
|
||||
|
Reference in New Issue
Block a user