Private
Public Access
2
0
Commit Graph

238 Commits

Author SHA1 Message Date
Manivannan Sadhasivam
25b951dd6a examples: Fix samples.mapping
Fix samples.mapping.txt with the cleaned-up C++ examples

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2018-01-25 11:24:23 +01:00
Manivannan Sadhasivam
83a67b96fd examples: Cleanup C++ examples
Modify the C++ examples to be of same coding standard like C. As a
part of this cleanup, a new LED example is also added.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2018-01-25 11:23:36 +01:00
Manivannan Sadhasivam
eaaebae69d examples: c++: Add mraa include path to CMakeLists.txt
C++ specific examples depends on headers in api/mraa, so include
them in CMakeLists.txt

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2018-01-18 14:12:08 +01:00
Manivannan Sadhasivam
e562c774cf examples: cleanup examples directory
Following changes are done as a part of cleanup:

1. Moved the platform specific `C` examples from top level examples/
directory to platform/ subdirectory and renamed helloedison.c to
gpio_edison.c

2. C specific examples are moved to a new c/ subdirectory. As a part
of this process, examples are modified to follow same standards
and few new examples are also added.

3. Include the newly added C examples to relevant API documentation

4. Ran clang-format for all source files in c/, c++/, platform/
subdirectories

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2018-01-18 14:12:08 +01:00
Nicola Lunghi
44bebc4f87 analogin example: add sleep between read
Signed-off-by: Nicola Lunghi <nicola.lunghi@emutex.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2018-01-04 13:59:22 +01:00
Manivannan Sadhasivam
ec26f92fe6 tools: add new tools directory
This is the start of the series of commits focussed on
cleaning up the exmaples/ directory.

This commit moves mraa-gpio, mraa-i2c, mraa-uart files
out of examples directory into new tools directory. Moved
files are the good cadidates to be treated as tools
instead of examples.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-11-02 10:00:35 +01:00
Noel Eck
65e30bf7d3 iio: Allow mraa_iio_trigger_buffer to handle void* args
Previously, mraa_iio_trigger_buffer took a void* args but did not use
this.  Included implementation to allow user to pass a void* to this
method and have the corresponding pointer returned in the interrupt
handler.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-08-30 14:14:41 -07:00
Noel Eck
1217c5c034 examples: Remove heap allocation from C++ examples
Small cleanup of MRAA C++ examples.  Switched from heap allocation to
stack allocation when possible.  This simplifies the samples since it
removes the need for explicit memory management.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-08-23 14:49:12 -07:00
Nicolas Oliver
e0a1862ce3 Travis CI and Documentation Generation improvements
* Use docker images from docker hub instead of building them on Travis
* Fix doxygen warnings for C/C++ Documentation
* Fix examples inclusion in documentation
* Modify Travis build matrix to include stages and additional jobs
* Update doxygen2jsdoc submodule
* Add doxyport submodule
* Generate documentation for each language in Travis
* Add sonar.java.binaries to sonar-scan.sh

Signed-off-by: Nicolas Oliver <dario.n.oliver@intel.com>
2017-08-10 10:47:11 -03:00
Alex Tereschenko
c36e4add5a examples: make main loops finite to ensure proper cleanup
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-06-06 15:52:48 +02:00
Alex Tereschenko
32340f6819 examples: misc static code analysis fixes
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-06-06 15:52:48 +02:00
Brendan Le Foll
8133de0cc0 mraa-uart.c: Remove impossible condition with a fprintf
Thanks to @pylbert for the spot

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-05-31 12:12:18 +02:00
Tapani Utriainen
56d5666ae9 mraa-uart: add a tool for testing, using and debugging UARTs using MRAA
This patch introduces examples/mraa-uart that can be used as a general tool
for UART communication and UART settings.

The syntax mimics the one used for mraa-gpio.

This is an initial version, beware of insects.

Signed-off-by: Tapani Utriainen <tapani@technexion.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-05-28 08:12:18 +02:00
Alex Tereschenko
b73fdff00d examples: be more defensive and replace strcmp() with strncmp()
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2017-05-17 19:45:05 +02:00
Alex Tereschenko
9545a2e320 stability: replace strcpy with strncpy to avoid potential overflows
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2017-05-15 21:04:18 +02:00
Kas Perch
075a7b1225 JS examples: refactor for clarity and consistent style
Signed-off-by: Kassandra Perch <the@nodebotani.st>
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2017-05-06 14:38:54 +02:00
Brendan Le Foll
69fcd861a7 android-things: Peripheralmanager target build
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-04-24 14:42:54 -07:00
Cédric Bosdonnat
06359e39cd examples: add return in spi_max7219.c
Some compilers are raising an error if no value is returned in main.
Add a return 0 in spi_max7219.c main to quiet them.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-03-02 08:32:10 -08:00
Brendan Le Foll
4264aa5a3b blink_onboard.c: Blink LED101 on Joule
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-02-27 18:07:51 +01:00
Jon Trulson
e38630097e UartOW.cpp example: Use .data() string accessor instead of .c_str().
.c_str() works accidentally, but is technically incorrect as these
"strings" can have embedded 0 bytes in them.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-01-19 08:04:45 +00:00
Henry Bruce
a0332a13b0 examples: Python MCP3004 ADC example (use with MinnowMax Calamari lure)
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-11-21 10:23:21 +00:00
Henry Bruce
a63ad7e10d json: Initial config file for Intel Aero platform (i2c and spi only)
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-11-21 10:23:21 +00:00
Henry Bruce
9de294b389 json: Improve i2c and spi configuration.
Bus number no longer has to be the same as its id and all busses are
disabled until a configuration entry is found.

Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-11-21 10:23:21 +00:00
Henry Bruce
61d20c7266 json: Removed tabs and tidied up Turbot JSON formatting
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-11-21 10:23:21 +00:00
Brendan Le Foll
c993cf10b4 firmata_curie_imu.c: Fix warning due to signed nature of function input buffer
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-10-26 14:24:50 +01:00
Brendan Le Foll
6c85b61daa mraa: Fix compiler warnings unused vars and useless statements
Should have 0 functionality effect, just cleans up a few things. Fixes #577

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-09-13 11:20:41 +01:00
Houman Brinjcargorabi
5d763cb7e5 Example: Added example json file for reference
Signed-off-by: Houman Brinjcargorabi <houman.brinjcargorabi@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-07-27 11:33:29 +01:00
Brendan Le Foll
6c9aeb9b9e mraa-i2c: stop switching on every platform type and assume linux
This patch makes mraa-i2c give sensible bus numbers

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-07-12 12:09:37 +01:00
Houman Brinjcargorabi
b5b84c6186 examples: Added examples for initio by description
Signed-off-by: Houman Brinjcargorabi <houman.brinjcargorabi@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-06-27 11:46:24 +01:00
Brendan Le Foll
5f515f7648 mraa-gpio.c: dont display pins set as not MRAA_PINS_VALID
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-06-20 12:18:38 +01:00
Brendan Le Foll
3d2163e2cb mraa-gpio.c: Fix raw gpio setting
setraw was not using mraa_gpio_init_raw so did not work

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-06-20 10:39:20 +01:00
Evgen48
800c89bfa4 examples/java: input pin number should be parsed in base 10, not in base 8, similar to c++ sample
Signed-off-by: Eugene Smirnov <o1o2o3o4o5@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-05-04 09:46:16 +01:00
Brendan Le Foll
c41c3b41d5 uart_ow: Better error handling in corner cases
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-04-15 12:03:32 +01:00
Brendan Le Foll
4a52ad6c4f uart_ow: Make onewire functionality optional but on by default
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-04-14 13:52:09 +01:00
Jon Trulson
a379eb7bf6 uart_ow: Initial support for Dallas 1-wire over UART support for MRAA
This commit introduces support for Dallas Semiconductor (DS) 1-wire
compliant device support using an available UART device.

The principle of operation is described in the following Application
note by Maxim Electronics:

https://www.maximintegrated.com/en/app-notes/index.mvp/id/214

with help (1-wire search) from:
https://www.maximintegrated.com/en/app-notes/index.mvp/id/187

It has been tested on Galileo 2 and Edison, with 2 DS 1-wire devices,
the DS18B20 and DS2413 connected to the bus.  A UPM driver for the
DS2413 is already complete and a PR will be submitted after this one.

It is important that you use a UART with CMOS/TTL level voltages
(3.3v/5v) RX and TX lines.  DO NOT use standard RS232 level voltages
or you are going to have a bad day.

In order for this to work, a simple interface circuit, using a single
diode must be constructed:

(forgive my "Asciihematic" :)

-|
U|
A| TX---|<--+
R|          |
T| RX-------o--------o 1-wire data bus
-|

The diode on TX is a 1N4148 (cheap and common), with the cathode
connected to TX, and the anode connected to RX and the 1-wire data
line.

The 1-wire data line requires a pull-up resistor, as the DS 1-wire
spec requires. 4.7-5K is typical for DS 1-wire buses.

NOTE: DHT-type (temp/humidity sensor) 1-wire devices ARE NOT DS 1-wire
compliant, and will not work with this code/circuit unfortunately.

Also note, this will use up one of your UARTs, which cannot be used
for any other purpose (ie: to access true UART-type serial devices).

You can however, connect as many DS 1-wire devices as feasible to this
UART, as it will function as a DS 1-wire bus master.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-04-14 13:41:31 +01:00
Alex Tereschenko
00a0abd030 isr.js: updated JS ISR example to avoid GPIO context being destroyed
Closes #403.

Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-04-11 15:28:22 +01:00
Fathi Boudra
e1c500414b docs: fix spelling errors
Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-04-11 15:13:06 +01:00
Brendan Le Foll
21bea74b74 mraa-gpio.c: Add return to list_pins
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-03-24 09:46:31 +00:00
Houman Brinjcargorabi
6fc2bef13f hellomraa.c: Remove unused variables
Signed-off-by: Houman Brinjcargorabi <houman.brinjcargorabi@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-03-22 18:12:30 +00:00
deadprogram
c302269750 firmata: Call FirmataCurieIMU firmata plugin API to retrieve raw accelerometer data
Signed-off-by: Ron Evans <ron@hybridgroup.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-03-22 18:12:30 +00:00
deadprogram
de0b9e72c6 firmata: Add very simple mraa firmata examples for JS & Python
Signed-off-by: Ron Evans <ron@hybridgroup.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-03-22 18:12:30 +00:00
Brendan Le Foll
537a69923b examples: disable firmata examples if firmata disabled
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-03-22 18:12:29 +00:00
Brendan Le Foll
59107f0a29 firmata: add public firmata API to support custom firmata plugins
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-03-22 18:12:29 +00:00
Henry Bruce
6c83886a51 examples: gpio-tool.js now catches exception if invalid pin is specified
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
2016-03-22 18:04:57 +00:00
Henry Bruce
143bc38e47 examples: hello_isr.py now catches exception if invalid pin is specified
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
2016-03-22 18:04:57 +00:00
Henry Bruce
a51f3a939f examples: Isr.java now catches exception if invalid pin is specified
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
2016-03-22 18:04:57 +00:00
Henry Bruce
85a848960a examples: Java ISR example now displays pin number and level
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
2016-03-22 18:04:57 +00:00
Henry Bruce
237308898c examples: Added isrExit() call to gpio-tool.js for ISR shutdown testing
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-03-22 18:04:57 +00:00
Henry Bruce
b1fd66c561 examples: Updated python gpio isr example
Example now takes pin number from command line and displays gpio level
when it changes.

Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-03-22 18:04:57 +00:00
Henry Bruce
d313ac0579 java: Allows Java GPIO ISR sample to exit so IsrExit() method can be tested
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-03-22 18:04:57 +00:00