Private
Public Access
2
0
Commit Graph

1856 Commits

Author SHA1 Message Date
Ivan Mikhaylov
307a6f3bdd mux: add mux interface
Add mux_init_reg interface with different mux modes for GPIO, UART, SPI,
I2C, PWM, AIO.

Signed-off-by: Le Jin <le.jin@siemens.com>
Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com>
2022-08-05 12:04:23 -07:00
Hirokazu MORIKAWA
046bdd0adb Support for swig 4.1.0
In swig 4.1.0, the complicated handling of "SWIG_V8_VERSION" has been cleaned up a bit. I made the same changes as in this swig.

Signed-off-by: Hirokazu MORIKAWA <morikw2@gmail.com>
2022-07-01 07:40:41 -07:00
Aaron Shaw
3b22201791 feat: add newer raspberry pi 4b variants
add newer pi 4 variants a03112, a03115, b03114, b03115, c03114, c03115, d03115

Signed-off-by: Aaron Shaw <shawaj@gmail.com>
2022-07-01 07:38:51 -07:00
Ivan Mikhaylov
9ea6cd2dc6 gpio: fix incorrect assignment of *cinfos in mraa_get_chip_infos
*cinfos in mraa_get_chip_infos is not set in case of
mraa_get_chip_info_by_name failure which happens on access of /dev/gpiochip*
files which leads to memory free by invalid pointer in *cinfos.

As example, it can be easy recreated with non-root run of mraa-gpio:

test@iot2050-debian:~$ mraa-gpio
free(): invalid pointer
Aborted

Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com>
2022-07-01 07:37:59 -07:00
Jan Kiszka
8185e983e1 gpio: Silence own use of deprecated mraa_gpio_use_mmaped
The warning is aiming at external use, not our own one. Silence the
latter by adding an internal service that the deprecated function calls
and use that service in the remaining mraa use cases.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2022-07-01 07:37:42 -07:00
Jan Kiszka
96472d1065 python3: Drop bogus CMAKE_C_FLAGS
CMake automatically pulls CMAKE_C_FLAGS and CMAKE_CXX_FLAGS, according
to the source file. Adding CMAKE_C_FLAGS unconditionally only raises

cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=missing-parameter-type’ is not valid for C++

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2022-07-01 07:37:42 -07:00
Jan Kiszka
73afc7a7e2 iio: Silence format-truncation warnings
Truncation warnings are default-on with many gcc-10 packages but the
module is fine with the potential truncations of sysfs paths as they
are.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2022-07-01 07:37:42 -07:00
Jan Kiszka
a54d4499ec iio: Add missing parameter in error log output
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2022-07-01 07:37:42 -07:00
James Jones
87c6754f00 rockpi4.c: Add chardev GPIO support
The recommended config for upstream kernels (arm64
defconfig) on the Radxa "mainline" kernel Wiki
does not include GPIO sysfs support, so libmraa
applications and utilies don't work out of the
box. This change marks the board as supporting the
GPIO character device interface and fixes the
group and line number assignments such that it
actually works. Performance is also noticeably
better with the chardev path.

I tested this by using mraa-gpio to toggle various
pins on the 40-pin header with a multimeter
attached, and with a program I have that that
toggles 8 GPIO pins at the same time to upload
data to another system using a parallel protocol.
On upstream/mainline kernels, chardev support is
now used. On the older 4.4 kernels from Radxa,
chardev support is not available and libmraa
gracefully falls back to sysfs.

Note another significant difference compared to
the Radxa kernels in upstream kernels is the
default devicetree must be tweaked to disable the
'i2s1' device in order to use GPIO pins 12, 35,
36, 38, and 40 via libmraa. For example, I
appended the following section:

  &i2s1 {
      status = "disabled";
  };

to arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts
to accomplish this.

Signed-off-by: James Jones <linux@theinnocuous.com>
2022-05-25 08:14:41 -07:00
Jan Kiszka
d7ae17171b aio: Update shifter_value and max_analog_value on mraa_aio_set_bit
mraa_aio_set_bit() changes value_bit, so the calculations of
shifter_value and max_analog_value become outdated. Move their
initialization to mraa_aio_set_bit and call that function from
mraa_aio_init instead.

Based on original patch by Le Jin.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-08-23 09:14:26 -07:00
Jan Kiszka
e446cf0110 gpio: Avoid spurious value reset without output mode changes
When a GPIO controlled via sysfs is set again to output mode, the kernel
also sets the value to 0. This can cause spurious output or mux changes,
e.g. when calling "mraa-gpio set <n> 1" for a pin that was already set.

Avoid this by checking the current direction, only writing it when
actually needed.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-06-30 12:57:27 -07:00
Björn Esser
aaa0a5cd4e include: Declare gVERSION global as 'extern'.
Fixes build with '-fno-common'.

Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2021-06-29 12:06:41 -07:00
Jan Kiszka
551486ffff api: Add explicit close methods to classes
This is needed for bindings to languages which perform implicit and lazy
object cleanups. The explicit close methods allow to release resources
when they are no longer required, permitting deterministic reuse. One
example is node-red-node-intel-gpio which will use the new calls on node
closing.

Fixes #1044.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-06-29 11:50:38 -07:00
Jan Kiszka
954b17ded4 led: Fix and cleanup initialization
The structure returned by readdir is may be statically allocated.
Keeping a pointer to it is broken.

The LED path is generally not a directory, it's a link to a directory.
And even if it were a directory, that would tell nothing about the
caller's access permissions.

And then there is a lot of duplication between mraa_led_init and
mraa_led_init_raw.

This addresses that all.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-06-29 11:49:25 -07:00
Jan Kiszka
13ce6ea446 examples: uart: Fix port configuration
mraa_uart_settings retrieves the settings, it does not apply them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-06-29 11:48:16 -07:00
Jan Kiszka
11e65ee9bf uart: Convert rtscts and xonxoff in mraa_uart_settings into mraa_boolean_t
This aligns the getter with the setter (mraa_uart_set_flowcontrol).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-06-29 11:48:16 -07:00
Jan Kiszka
aeb0b331b5 uart: Fix software flow control management
Rather than updating IXON/IXOFF in termios, mraa_uart_set_flowcontrol
was incorrectly issuing a stop or start character on mode changes. This
lead to spurious transmission in setups that actually wanted to disable
software flow control. And it prevented enabling it (which could have
been checked also by reading back the state via mraa_uart_settings).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-06-29 11:48:16 -07:00
Tim Gates
833bac569c docs: fix simple typo, repeately -> repeatedly
There is a small typo in examples/c/pwm.c, examples/c/spi.c.

Should read `repeatedly` rather than `repeately`.
2021-04-07 12:43:04 -07:00
Arora, Jeet
31c4a8d0db Added Intel Learning kit to platforms.
Signed-off-by: Arora, Jeet <jeet.arora@intel.com>
Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2021-04-07 12:41:08 -07:00
Chuckduey
bb1c6df16b Added Raspberry Pi 400 to platforms
Signed-off-by: Chuckduey <cduey@msn.com>
2021-02-01 13:35:09 -08:00
Mihai Tudor Panu
7786c7ded5 mraa: update to v2.2.0
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-10-28 09:41:43 -07:00
Mihai Tudor Panu
36572583e4 ci: remove really old node version builds from ci
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-10-28 09:41:43 -07:00
Mihai Tudor Panu
a0ede33556 readme: update readme and mailing list, remove old reference
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-10-28 09:41:43 -07:00
Mihai Tudor Panu
1a66c6dc6a python2: remove ability to build python2 bindings from project
This removes Python 2 package generation from the project to encourage safer development with Python 3 instead. Documentation for the generated modules switched to Python 3. Default interpreter is now Python 3 but can be overridden if needed for running the tests only on older environments.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-10-28 09:41:43 -07:00
Mihai Tudor Panu
36696db591 cmakelists: disable node.js builds by default as they fail for latest node versions
Disables node.js wrapper generation and builds by default as latest versions of node.js do not build with latest SWIG. An official patch for SWIG should revert this, community pointed out a workaround exists already but requires manual patching. This may affect packaging jobs and builders not using BUILDSWIGNODE explicitly, e.g. NPM and external to the project.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-10-28 09:41:43 -07:00
gowtham.r
aa7c41983f fixing size missmatch between snprintf and actual size.
Signed-off-by: gowtham.r <gowtham.r@adlinktech.com>
2020-09-21 20:05:54 -07:00
Chuckduey
f24fcf5a6e Added Pi 4 8GB to Pi 4 section
Signed-off-by: Chuckduey <cduey@msn.com>
2020-09-15 10:40:12 -07:00
Fabrice Fontaine
cb88e4dd1f CMakeLists.txt: add BUILDCPP option
C++ is a mandatory dependency since version 1.4.0 and
122cab1f1e

As a result, build on embedded toolchains that do not support C++ fails
on:

CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_CXX_COMPILER:

    /home/naourr/work/instance-1/output-1/per-package/mraa/host/bin/arm-linux-g++

  is not a full path to an existing compiler tool.

Fixes:
 - http://autobuild.buildroot.org/results/31086422e03611c16ab59c4418e3669b580bc0c0

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-09-15 10:39:42 -07:00
Jandrioli
d74b0d8a73 Fix code to set SPI frequency/clock
Signed-off-by: Jandrioli <joao_andrioli@hotmail.com>
2020-09-15 10:38:37 -07:00
akgnah
710106d99f rockpi4: add model c support
Signed-off-by: akgnah <1024@setq.me>
2020-09-15 10:38:03 -07:00
Jefferson Lee
da36b7ae84 Added the mraa_strresult function
Signed-off-by: Jefferson Lee <jeffersonlee2000@gmail.com>
2020-09-15 10:37:05 -07:00
gowtham.r
68e75edcad Adding alias name LEC-ALAI for LEC-AL-AI platform.
Signed-off-by: gowtham.r <gowtham.r@adlinktech.com>
2020-09-15 10:36:11 -07:00
gowtham.r
52d1d93d00 Changed serial port address in ARM platform, chenged the spritnf call to snprintf call for safty reason. fixed other warnings.
Signed-off-by: gowtham.r <gowtham.r@adlinktech.com>
2020-09-15 10:36:11 -07:00
Mihai Tudor Panu
f9da60fda1 sonar-scan: disable preview mode for internal PR
No longer supported by sonar scans, the preview feature is now disabled and internal PRs from project contributors are also scanned for vulnerabilities/bugs as part of CI

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-05-29 13:47:59 -07:00
Propanu
85d6279228 readme.md: update instructions for openSUSE
Describes in more detail how to install MRAA for developers on openSUSE and SLE.
2020-05-29 13:47:59 -07:00
Mihai Tudor Panu
e52c5bb7c3 readme.md: fix typo and mention packages may be compatible
For testing purposes it should be possible to share .deb packages across a variety of Debian builds or .rpm packages across systems that have dnf/yum available

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-05-07 14:10:17 -07:00
Mihai Tudor Panu
e70198f659 readme.md: replace node section with RHEL/CentOS
Removed installing for node.js section as latest versions of node have issues building until Swig is patched. Also make it clear some mainstream Linux don't have binaries available in official repos.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-05-07 13:36:32 -07:00
Chuckduey
c10e72b494 Added V1.2 for Pi 4 2GB and 4GB
Signed-off-by: Chuckduey <cduey@msn.com>
2020-05-07 13:36:03 -07:00
Mihai Tudor Panu
e15ce6fbc7 mraa: Update to v2.1.0
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-01-16 11:45:05 -08:00
Chuck Duey
f58cdc9da4 Added Raspberry Pi 4 1GB 2GB and 4GB to the list of detected platforms
Signed-off-by: Chuck Duey <cduey@msn.com>
2020-01-10 09:33:19 -08:00
kathaashok
bb736e762b fixing indentation issues reported by eclipse mraa
Signed-off-by: kathaashok <katha.ashok@adlinktech.com>
2020-01-10 07:33:18 -08:00
ryanzj.huang@adlinktech.com
276868185d modify the content of adlink_ipi_arm.md
Signed-off-by: ryanzj.huang@adlinktech.com <ryanzj.huang@adlinktech.com>
2020-01-10 07:33:18 -08:00
katha ashok
ef8c0fb541 Fixing minor issues. supporting LEC-AL-AI board
Signed-off-by: katha ashok <katha.ashok@adlinktech.com>
2020-01-10 07:33:18 -08:00
ryanzj.huang@adlinktech.com
eb9b55bd99 modify pin 26 function to n/a
Signed-off-by: ryanzj.huang@adlinktech.com <ryanzj.huang@adlinktech.com>
2020-01-10 07:33:18 -08:00
Brian Lee
63de2c4c3a rockpi4.c: fixed pwm issue
e.g.:
    cv2 import at the beginning throws the error:
    import cv2
    import mraa
    import time
    ...

    Error:
    ValueError: Error initialising PWM on pin

Signed-off-by: Brian Lee <brian@vamrs.com>
2020-01-09 10:11:58 -08:00
Michael Campion
1d18da9a22 upxtreme: add spdx tags to source files
Remove MIT notice and replace with SPDX tags in UP Xtreme sources.

Signed-off-by: Michael Campion <michael.campion@emutex.com>
2020-01-06 15:17:55 +00:00
Michael Campion
3d781603f3 upxtreme: Match UP Xtreme Platform enum value
After rebase UP Xtreme supported platform enum value was changed
to 24 in types.h, this commit updates the enum value in types.hpp
to this value.

Signed-off-by: Michael Campion <michael.campion@emutex.com>
2020-01-06 15:17:55 +00:00
Michael Campion
d954599045 upxtreme: Add UP Xtreme support
UP Xtreme is based on the Intel(R) Core(TM) i3/i5/i7 Whiskey Lake SoCs.
The UP Xtreme presents one Raspberry Pi compatible HAT connector.

This implementaion supports i2c, spi, uart, adc and gpio through the
40pin HAT connector.

Gpio chardev capabilities have been disabled in this implementation. When
gpio chardev capabilities are enabled an input becomes unreadable after an
isr has been registered to the pin. See here for details:

https://github.com/intel-iot-devkit/mraa/issues/937

Tested on UP Xtreme, with UP Board Linux kernel 5.0.0
Features tested: gpio, gpio interrupts, i2c, spi, adc and uart.

Signed-off-by: Michael Campion <michael.campion@emutex.com>
2020-01-06 15:17:55 +00:00
Carsten Menke
79043568dd made Rock Pi 4 working again with recent 5.x kernels
Signed-off-by: Carsten Menke <cm@p-i-u.de>
2019-12-29 20:14:42 +00:00
Carsten Menke
5b8ec38440 added readme for Rock Pi
Signed-off-by: Carsten Menke <cm@p-i-u.de>
2019-12-29 20:14:42 +00:00