The gpio pins numbers aren't just matching the physical pin numbers...
on some distros like raspbian, with a kernel explicitly setting the
base to 0, it works, but for kernels using the first free slot it
doesn't (see gpiochip_find_base() in kernel's gpiolib.c).
To get the proper gpio pin value, we thus need to find the base for
the corresponding gpiochip. For the raspberry pi, we search for the
chip with a label containing 'bcm2835'.
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
While some distributions have a modified /proc/cpuinfo including
the board revision for raspberry pi, most distributions don't
have this.
In order to guess the raspberry pi version in such cases, use
the /proc/device-tree/compatible content as a fallback solution.
The values expected from this file have been taken from
upstream kernel documentation:
Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
As per Documentation/ABI/testing/sysfs-firmware-ofw, perfer
/proc/device-tree over /sys/firmware/devicetree/base as this
is the stable one.
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
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>
Change PLATFORM_RASPBERRY_PI_ZERO into an integer to avoid
build error when comparing it to integer platform_detected.
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
GT/GrosseTete -> Joule. This commit deprecates the MRAA_INTEL_GT_TUCHUCK
mraa_platform_t value and links the grossetete.md page to joule.md.
Signed-off-by: Wai Lun Poon <wai.lun.poon@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Like the beaglebone, the phyBOARD-Wega also got an am335x.
So I merged the four mmap-functions for gpio_context and some
identical defines in a separate header and c-file.
The new platform support-files are based on beaglebone-files.
The documentation of phyBOARD-Wega is still in process,
but for now there are enough informations.
At this time it is possible to use GPIO-Pins and Uart0
(tested via python with mraa). The code for using SPI, I2C and
PWM is also still in process and not tested yet.
Signed-off-by: Norbert Wesp <nwesp@phytec.de>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
.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>
The command() function had a logic error that caused a command to be
broadcast to all devices on the DS OW bus when a proper ID was
specified. This should only be done when NO ID is specified.
This fixes UPM issue #502.
In addition, there were two cases where the C++ string accessor method
.c_str() was used when .data() should be used instead. This worked
anyway (accidentally), but is improper since the strings can have
embedded 0 bytes.
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This adds logic to save PWM duty when disabling the pin (which sets
the duty to 0), and restore it when re-enabling the pin.
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Edison pwm can stuck at high if pin is disabled during ON pwm peroid.
Workaround is to force zero duty time before disabling the pin.
Signed-off-by: Billy Bai <belugon@outlook.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
When mraa_init_uart_raw is called it places the path arg in dev->path. This
works in non raw mode because the path is statically in the device
configuration but in raw mode this is a dynamic address meaning that we need to
copy it. Fix this by simply copying the device path rather than relying on the
user keeping that string path in memory.
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This strips the local RPATH when doing a `make install` rather than running
from the build/ dir
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Some details regarding the UP board are not in-sync with the
final production version of the board. This update adds an
ADC, removes a UART, and some corrections in the docs for UP.
Signed-off-by: Dan O'Donovan <dan@emutex.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
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>