Low Level Skeleton Library for Communication on GNU/Linux platforms
Mocking capability allows libmraa user to work with the library without any real hardware available. Enabling this requires library recompilation with architecture override (see Building section below). When mock is enabled, library simulates actual HW operations at the backend so that for the application it looks like a usual board. Being implemented at the backend, the functionality is available in all language bindings libmraa supports.
This feature is yet in the experimental mode and not all functionality is available. Right now we simulate a single generic board with:
uint8_t, so you can treat them as 10 single-byte registers or 5 single-word ones or a mix thereof.
sent_byte (or word) XOR constantformula. See SPI mock header for constant values.
We plan to develop it further and all ../CONTRIBUTING.md "contributions" are more than welcome.
See the table below for pin layout and features
|MRAA Number||Pin Name||Notes|
|0||GPIO0||GPIO pin, no muxing, no ISR|
|1||ADC0||AIO pin, returns random value on read|
|2||I2C0SDA||SDA pin for I2C0 bus|
|3||I2C0SCL||SCL pin for I2C0 bus|
|4||SPI0CS||CS pin for SPI0 bus|
|5||SPI0MOSI||MOSI pin for SPI0 bus|
|6||SPI0MISO||MISO pin for SPI0 bus|
|7||SPI0SCLK||SCLK pin for SPI0 bus|
|8||UART0RX||RX pin for UART0 port|
|9||UART0TX||TX pin for UART0 port|
Generally all the building steps are the same as listed in the ./building.md "main building guide", you just need to set some specific CMake options.
To build under Linux, follow standard instructions, just make sure to set the
-DBUILDARCH="MOCK" CMake option.
Mocking capability allows us to build and use libmraa under Windows. That helps if you e.g. don't want to leave your customary Windows-based Python IDE, but want to develop libmraa-based programs.
Building Node.js bindings was not yet tested under Windows as MSYS2 does not have a ready-made package. Java was not tested either.
You'll need the following to build libmraa under Windows:
Several additional packages, install them by running
```bash pacman -S cmake base-devel gcc git ```
The procedure is conceptually the same as under Linux - you first need to run CMake with specific options to generate makefiles and then run make to build everything.
Run CMake, switching off unsupported options and enabling mock platform:
```bash cmake ../mraa-src/ -DBUILDARCH="MOCK" -DBUILDSWIGNODE=OFF -DENABLEEXAMPLES=OFF ```
Make, install and test:
```bash make clean && make install && make test ```
All tests should pass.
Note: To have autocompletion in Python IDE, just point it to MSYS2's Python and make sure to specify any additional paths pointing to site-packages dir with mraa module if IDE requires that ("Interpreter Paths" in PyCharm). With the above settings the module will be installed into
/usr/local/lib/python2.7/site-packages and the libmraa itself - into