Added standard context validity check, another check for a replace function
and corrected a return statement to fit our standard code style.
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Mock platform allows one to use mraa without having any real HW.
This commit makes necessary foundational changes and implements
GPIO functionality as well as adds respective tests.
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
As described in issue #91, on Edison setting 0% duty doesn't
disable the PWM on a pin completely.
Therefore we add a couple of Edison-specific _pre functions
and an internal PWM state variable, which we use to toggle PWM
enabled/disabled based on what duty is set for the pin.
Closes#91.
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Make better use of unsigned/signed ints, signed ints are preffered unless there
is a good reason not to.
Signed-off-by: Alexandru Timohi <alexandru.timohi@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit changes also the _replace function and adds exceptions to the C++
API for errors in AIO read
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Imraa allows the automatic flashing and setup of arduino101 subplatforms as
well as the initial setup of GPIO/i2c devices
Signed-off-by: Longwei Su <lsu@ics.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Add pin commands. Old mraa_setup_mux_mapped style is used for other boards
(pincmd = PINCMD_UNDEFINED) where pincmds are not defined.Remove useless
pullup_enable code, Galileo Gen2: review all pin mux and add commands Galileo
Gen2: remove doubled functionality: mraa_intel_galileo_gen2_i2c_init_pre and
mraa_intel_galileo_gen2_uart_init_pre. Galileo Gen2: fix "Invalid AIO pin
specified - do you have an ADC?" error. Galileo Gen2: pullup/pulldown
resistors are disabled during UART/GPIO/SPI/I2C/UIO initialization. Use
mraa_gpio_mode to enable resistors.
Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
The reason for this is that applications that use mraa, like upm, need the
definitions contained in jni header.
Signed-off-by: Andrei Vasiliu <andrei.vasiliu@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This is a re-design of commit 0041801. mraa_lang_func_t structure has been
added (similar in design to mraa_adv_func_t) that points to JNI functions
implemented in src/java/mraajni.c. Functions are set by libmraajava.so,
see wrapper entry in src/java/mraajava.i. As gpio.c now uses these
functions, language specific #ifdef code has been removed as JNI code
is only called if functions are defined (i.e. not NULL)
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
libmraajava.so was statically linking to mraa object files causing
duplicate mraa platform instances if a UPM Java module was also loaded.
JNI functionality has been moved into src/java/mraajni.c. JVM object is
now set when JVM is loaded; see updates to src/java/mraajava.i.
This was necessary as the JVM object cannot be directly referenced from
mraa as it will not be available when building C/C++ examples.
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Every 96Boards baseboard uses the same expansion connector, but the
current 96Boards initialization code assigns the SoC specific GPIO
numbers instead of being consistent across all boards. Change the code
to assign 96Boards GPIO-A through GPIO-L to MRAA GPIOs 23-34.
v2: Create info for all the LS connector pins, not just the GPIO pins.
This gives us room to describe other pins in the future.
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Add support for UP board (www.up-board.org), scoping
the following functions available via 40-pin header:
* GPIO (via sysfs)
* UART
* I2C
* SPI
* PWM
Validated on UP board v0.2, running ubilinux 3.0
Signed-off-by: Dan O'Donovan <dan@emutex.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
- FT4222 GPIO ISR implementation was specific to C/C++ and ignored
language binding support. This is now fixed via adv_func updates.
- GPIO ISR code has been refactored to reduce i2c traffic when using
I/O expanders
- Added support for built-in FT4222 GPIO interrupts
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
The pinout for the Low Speed Expansion on the MinnowBoard
Turbot is the same as the MinnowBoard MAX A2 desgin, with
the exception of pin 26. Pin 26 was changed to provide an MCLK
reference clock for I2S.
In addition, the D2 LED is now under GPIO control.
Add support for these changes.
Signed-off-by: Constantin Musca <constantin.musca@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
mraa_adv_func_t->gpio_init_internal_replace() now has mraa_gpio_context
parameter so that override function can access both physical and logical
pin numbers.
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
- C API read/write integer functions changed to int to match C types
- C API now has close function to release resources acquired during init
- iio internal type isr_event() function now has args param in signature
- C++ API now supports events with handler interface and new data structure
- C and C++ examples updated to use API changes
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This means that a valid platform is no longer required for iio operations and
therefore this is now only a req for using USBPLAT
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Code crept in from ft4222 branch merge and is superflous becuase of the new
advance function structure
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit creates a new structure inside each _iio device when used and can
then be used to understand the data being read after a trigger is run/executed
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>