mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 17:31:13 +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:
@ -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