Not defining this causes undefined behaviour leading to the check mux_total
sometimes being true and asking the kernel to export all sorts of garbage gpio
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Avoids on some platforms where when setting a mux will set it low when
it wouldn't be safe to.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
If a gpio doesnt have a direction, like some muxes do, try and set value
if HIGH or LOW was passed.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
Instead of plain char* to avoid need to malloc and do all the needed
error checking needed that goes along with that.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
Used for getting the path to the character device under linux for uart
device. i.e. "/dev/ttyS0"
Adds paths to existing platforms.
Closes#84
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
Removed mraa_setup_uart from core mraa.c moved logic within init
function
Add more syslog output for easier debugging.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
There is an issue that when you take an IO pin that has an external PU
resistor and switch it from INPUT to OUTPUT the state of the pin will go
down before you can set it back high.
Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This lets you access a spidev device directly without any checking in the style
of mraa_i2c_init_raw
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This change also changes the C++ API write(char) call to writeByte(uint8_t) and
the write() call now takes a uint8_t* instead of a char*. This should not alter
any code significantly and does not affect the C API.
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
gcc-4.8.2 fails to build from source and complains :
error: format not a string literal and no format arguments
Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Since gpios are +256 in 3.18+ kernels this stops dual definitions and possible
issues later on if errors are found
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Whilst this value is not used because it's only required by the aio module it
is interesting to have this information if we want to expose it to the user
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This should adjust the pinouts, at runtime, based on the current
kernel that's in use. The Linux kernel made a change between
3.17 and 3.18 ( specifically ea584595fc85e65796335033dfca25ed655cd0ed )
that changed the numbering for GPIOs. This obviously breaks everything
for mraa on the MinnowBoard MAX if you have a 3.18 or newer kernel.
Signed-off-by: John 'Warthog9' Hawley <john.hawley@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
The gpio_close_pre was put on the wrong board definition. So calling close of
GPIO pin on mini-board caused a fault
Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
There is an issue that mraa_pwm_write would fail, because mraa_pwm_read
would fail and return 0. When the read fails, journalctl shows an
error:
Dec 28 18:01:38 Edison libmraa[365]: pwm: Error in reading period
So now trying version, where the pwm object caches the period, that is
updated whenever you do a read or write of the period. Side benefit is
that the write should be sped up.
Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
Made like changes to Edison to cache the output enable.
Note: different than Edison as the pin structure holds enable pin number
instead of external array.
2nd note: noticed PU resistors are also in structure but there is also
external array.
Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
It's already the case for rpi & MMAX but it should be noted that on 1 indexed
boards gpio_count should be +1
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
test was adding board gpio_count to pin so that 0 would use the info for pin 14
on some boards when asking for aio capability
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
mraa_init() will now:
- print user name and EUID of the process instead of UID,
- print full platform text name in addition to numeric type,
- return, log and print an error if started by non-root user
Fixes#64
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>