1487 Commits

Author SHA1 Message Date
Norbert Wesp
8342b4c079 tmp006: Added upm support for sensor TMP006
TMP006 is a infrared-thermopile sensor.

Signed-off-by: Norbert Wesp <nwesp@phytec.de>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2017-03-16 17:24:01 -07:00
Norbert Wesp
e83b8ef114 tcs37727: Added upm support for color sensor TCS37727
TCS37727 is a Color Light-To-Digital Converter.
I also added the manufacturer 'ams' of TCS37727.

Signed-off-by: Norbert Wesp <nwesp@phytec.de>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2017-03-16 17:23:16 -07:00
Lay, Kuan Loon
fabf4287d6 upm: enable MMC35240 3-axis magnetic sensor library and example
MMC35240 is 3-axis magnetic sensor from MEMSIC.

This sensor can measure magnetic fields within the full scale range of
+-24 Gauss (G).

The library provided is libupm-mmc35240.so
The example provided is mmc35240-example-cxx where it will print x,y,z axis
when trigger buffer data is ready. It's also print azimuth value.

This sensor requires calibration. Please shake the sensor in figure 8 pattern,
mmc35240-example will print the calibrated level.

As the sensor data is noisy, we have implemented denoise algorithm within the
sensor library.

The azimuth formula is provided by Han, He <he.han@intel.com>.

Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2017-03-16 17:22:40 -07:00
Jon Trulson
4ea01180a1 lcdks: renamed from sainsmartks, added backlight support
The sainsmartks driver has been reimplemented in it's own, new C/C++
library: lcdks (LCD Keypad Shield).

In addition, support for an optional backlight GPIO was added.

This was tested with the SainsmartKS and DFRobot LCD Keypad Shields.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-03-16 12:40:10 -06:00
Jon Trulson
ab171573f9 lcd/lcm1602/jhd1313m1: remove lcm1602 and jhd1313m1 from lcd library
The lcm1602 and jhd1313m1 drivers had been rewritten in C with a C++
wrapper some time ago, however the original lcm and jhd drivers were
still present in the lcd library.  In addition, to avoid header file
conflicts, the new, separated lcm and jhd header files were renamed
with a .hxx prefix.

This patch:

- renames the new lcm1602/ and jhd1313m1/ header files to have the
  usual .hpp prefix.

- removes the lcm1602, jhd1313m1, and sainsmartks drivers from the
  lcd/ (i2clcd) library.

- fixes the examples to use the "new" libraries (lcm1602 and
  jhd1313m1)

- changes the argument type for the createChar() (C++) to use a byte
  vector (std::vector<uint8_t>) rather than a typedef'd char array.
  The lcm1602_create_char() function (C) uses a standard char *.  The
  use of std::vector is well supported by SWIG.

- SWIG interface files changed to use upm_vectortypes.i, and removes
  the carrays helpers, which should no longer be needed for these
  drivers.

- removes the inclusion of the driver C .h header files into the SWIG
  interface files - this should not be needed for these drivers.

- the sainsmartks driver will be placed into it's own new lcdks (LCD
  Keypad Shield) library.  This library should support the
  SainsmartKS, DFRobot LCD Keypad Shield, and similar products from
  other manufacturers in a future commit.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-03-16 12:39:52 -06:00
Abhishek Malik
d965b92af1 ABPDRRT005PG2A5: Initial Commit
This commit enables the ABP Honeywell sensor. Java examples is
yet to be tested and has not been provided with the current commit
and will be provided in a future commit.

Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2017-03-13 11:13:10 -07:00
Jon Trulson
cc0174910b ds18b20: fix delay timing error in ds18b20_update()
Due to the change of using upm_delay_ms() instead of usleep(), but
failing to adjust the delay time accordingly, ds18b20_update() was
waiting for 750000ms (12 minutes) before reading the result of a
measurement, instead of the more appropriate 750ms.

This should fix Issue #530.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-03-13 12:05:22 -06:00
Jon Trulson
c4a506f5a3 bmp280/bme280: C port, C++ wraps C
Some private methods (relating to calibration/compensation) are no
longer exposed.  In addition, the driver auto-detects the chip (BMP280
or BME280) and acts accordingly, rather than requiring the
specification of a chip id in the ctor.

The getHumidity() method no longer accepts an arguement representing
pressure at sea level.  A new method is provided to specify this.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-03-10 17:00:50 -07:00
Noel Eck
58cdfadf4e p9813: Chainable LEDS
Initial commit of the p9813 chainable LED controller.
Added C, C++, python, java, and node examples.

Signed-off-by: Sergey Kiselev <sergey.kiselev@intel.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-03-08 09:46:43 -08:00
Noel Eck
b3a5275183 t6713: Static analysis fixes
Updated t6713 to use class instances vs class pointers.  Creating these
on the stack clears up some memory leaks where items created in the
heap are not deleted for a handful of the throw conditions.  Removed
all news/deletes.

Also reformatted to remove tabs and some spaces.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-03-07 22:10:16 -08:00
Jon Trulson
b314f56c00 l298: fix a potential divied-by-zero
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-03-07 14:24:04 -07:00
Jon Trulson
d4b536b593 bno055: C port; C++ wraps C
The API has been changed in some cases - see the apichanges.md
document.

In addition, this driver uses a new upm_vectortypes.i SWIG interface
file to provide a mechanism for methods that return a vector of floats
and ints instead of a pointer to an array.

This works much nicer than C array pointers, and results in Python/JS/Java
code that looks much more "natural" to the language in use.

The Python, JS, and Java examples have been changed to use these
methods.  Support for the "old" C-style pointer methods are still
provided for backward compatibility with existing code.

As an example - to retrieve the x, y, and z data for Euler Angles from
the bno055, the original python code would look something like:

       ...
       x = sensorObj.new_floatp()
       y = sensorObj.new_floatp()
       z = sensorObj.new_floatp()
       ...
       sensor.getEulerAngles(x, y, z)
       ...
       print("Euler: Heading:", sensorObj.floatp_value(x), end=' ')
       print(" Roll:", sensorObj.floatp_value(y), end=' ')
       ...

Now the equivalent code is simply:

       floatData = sensor.getEulerAngles()
       print("Euler: Heading:", floatData[0], ...
       print(" Roll:", floatData[1], end=' ')
       ...

Additionally, interrupt handling for Java is now implemented
completely in the C++ header file now rather than the .cxx file, so no
special SWIG processing is required anymore. See Issue #518 .

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-03-07 13:16:24 -07:00
Jon Trulson
2bdde21a2f src/upm_vectortypes.i: SWIG interface file for vector types
This interface file can be used to support some standard vector types
in our SWIG interface code.  The current vector types supported are:

%template(intVector)    vector<int>;
%template(int16Vector)  vector<int16_t>;
%template(floatVector)  vector<float>;
%template(doubleVector) vector<double>;
%template(byteVector)   vector<uint8_t>;

Using these makes it much easier and more "natural" for use with the
SWIG languages rather than the currently used mechanism of array
pointers and certain other pointer-based methods.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-03-07 13:16:14 -07:00
Jon Trulson
6ceebc9a17 ppd42ns_data.h: replace tabs with spaces
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-03-07 13:16:08 -07:00
Noel Eck
65fc70a31a rf22: Static analysis fixes
A few small fixes for the rf22 to satisfy klocwork.

    * Converted malloc's to new's to be more C++'ish and since
      malloc return were not checked.
    * Initialize data, buf, and _lastInterruptFlags
    * Up'ed RF22_MAX_MESSAGE_LEN to 64.
        Reason:

void RF22::sendNextFragment()
{
    if (_txBufSentIndex < _bufLen)
    {
    // Some left to send?
    uint8_t len = _bufLen - _txBufSentIndex;
    // But dont send too much
    if (len > (RF22_FIFO_SIZE - RF22_TXFFAEM_THRESHOLD - 1))
        len = (RF22_FIFO_SIZE - RF22_TXFFAEM_THRESHOLD - 1);
    spiBurstWrite(RF22_REG_7F_FIFO_ACCESS, _buf + _txBufSentIndex, len);
    _txBufSentIndex += len;
    }
}

        RF22_FIFO_SIZE = 64
        RF22_TXFFAEM_THRESHOLD = 4
        RF22_MAX_MESSAGE_LEN = 50
        _buf[RF22_MAX_MESSAGE_LEN]
        Length of _buf *was* 50, so if the 'But dont send too much' above
        was to happen, the length is set to 63, which overruns
        _buf[RF22_MAX_MESSAGE_LEN]

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-03-06 12:13:27 -08:00
Noel Eck
51a181a14f java_interfaces: Moved ifdefs for swig version
Moved the SWIG version check from each sensor library .i file to
the base SWIG .i file (per interface).  This cleans up the number
of #if SWIG_VERSION's across the code base, and will make cleanup
of these easier at a later date.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-03-03 10:27:12 -08:00
Noel Eck
cfb4105dd8 docs: Added space to swig interface include
Documentation script was failing when parsing swig file.  Added
a space in the ads1x15 java swig file to make the doc parser happy.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-03-03 10:11:25 -08:00
Noel Eck
b7faba556f sensortemplate: Added a template sensor
The purpose of the templatesensor is to get contributors up and running
faster when adding a new sensor.

    * Created library named 'sensortemplate'
    * Added C++ source
    * Added swig interface files for java, javascript, and python
    * Added sensortemplate image file
    * Added examples for c++, java, javascript, and python
    * Updated contributions.md with steps to create a new sensor from
      the sensortemplate library.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-03-02 23:05:51 -08:00
Stefan Andritoiu
95801b395d Corrected typo in led.hpp. File includes led.h, not led.hpp
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
2017-03-02 20:19:24 -08:00
sisinty sasmita patra
1f18369fbe SWIG_JAVA: C++ Interfaces to Java interfaces, Modified one Java Example
This commit translates C++ interfaces to Java interfaces, previously C++ Interfaces implemented java classes.

    * Added java swig interface files for all C++ interfaces to simplify swig
    javaupm_iADC.i
    javaupm_iCO2Sensor.i
    javaupm_iHumiditySensor.i
    javaupm_iLightController.i
    javaupm_iLightSensor.i
    javaupm_iModuleStatus.i
    javaupm_interfaces.i
    javaupm_iPressureSensor.i
    javaupm_iTemperatureSensor.i

    <example Usage>
        %include"../interfaces/javaupm_iADC.i"

    * Modified swig interface files for few sensors that implements interfaces
    ads1x15
    bmp280
    bmpx8x
    ds1808lc
    hlg150h
    lp8860
    max44009
    ms5611
    si1132
    si7005
    t6713

    * Removed few methods that were mentioned Protected and made them public, so that menthods can be overridden

    * Made IModuleStatus virtual to avoid ambiguity in multiple inheritance
    For example
    class A {};
    class B : public A {};
    class C : public A {};
    class D : public B, public C {};

    This can be solved as
    class A {};
    class B : virtual public A {};
    class C : virtual public A {};
    class D : public B, public C {};

    * Modified java interface files to support multiple swig versions

    * Modified javaupm interface file to support standard auto load library code

    * Fixed autoloadlibrary tests for interfaces

    * Created one interface example separately <BME280_InterfaceExample.java>,
    <example Usage>
        BME280_InterfaceExample.java
    since we cann't define swig versions inside java example file.
    So, instaed added swig versions in Cmake.
    <example Usage>
         if (SWIG_VERSION VERSION_GREATER 3.0.8)
           add_example_with_path(BME280_InterfaceExample bmp280 bmp280)
         endif()

Signed-off-by: sisinty sasmita patra <sisinty.s.patra@intel.com>
2017-03-02 20:14:03 -08:00
Noel Eck
1d6d660769 max30100: Small typo fix
Changed initializate->initialization...

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-02-17 16:49:39 -08:00
Noel Eck
b57710cd78 groups.md: Removed redundant group maxbotix
Removed redundant group and renamed Maxbotixs to MaxBotix.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-02-17 16:40:09 -08:00
Noel Eck
6d41566e93 doc: Changed <B5> to u for python doc run
The µ character (<B5>) fails the python documentation run.
Replacing with 'u'.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-02-14 08:31:55 -08:00
Abhishek Malik
7a60cd5abe AQI: Adding ugm3 calculation to ppd42ns and aqi calculation to upm_utilities
Contributions by: Rex Tsai <rex.cc.tsai@gmail.com>

Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2017-02-13 23:04:20 -08:00
Mihai Tudor Panu
70bcdfefa4 lcm1602/jhd1313m1: temporarily rename headers to avoid duplicates
This should be reverted when these 2 classes are removed from the i2clcd library. Will also require updating all the examples to load the new modules instead.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2017-02-09 15:06:12 -08:00
Noel Eck
762c28f000 docs: Changed magnometer to magnetometer
Replaced all occurances.  While there are a few references
to magnometer out there, magnetometer is used much more broadly.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-02-08 13:56:28 -08:00
Noel Eck
283fce619e doc: Scrubbed ALL sensor library descriptions
In an effort to clean-up and standardize UPM library
documentation, this commit updates (and in most cases,
unifies) the CMake description string AND CXX header
@comname string.

Strings were taken from datasheets when possible, spelling
mistakes were addressed, copy/paste errors where fixed,
Title Case was used, etc.

    * Tested/updated/added @web tags
    * Added/updated invalid sensor images
    * Added/updated @man tags, added missing manufacturers

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-02-08 11:50:00 -08:00
Noel Eck
7a5c8a6cb3 swigjava: Added SWIGJAVA define to java module build
SWIGJAVA is defined for the swig interface file processing but is not
defined for the sensor library source build.  There are multiple sensors
that appear to rely solely on SWIGJAVA - these are not building
correctly.  Adding SWIGJAVA define for the java module src build.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-02-07 15:37:46 -08:00
Mihai Tudor Panu
4342b880b9 st7735: add typemaps to uint8_t arrays for js and python
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2017-02-06 21:28:04 -08:00
Noel Eck
567476b89a cmake: Explicit dependency for mraa and interfaces
A handful of modules do not require mraa.  Captured this in
    src/CMakeLists.txt - only add mraa dependency for targets which
    use:

        upm_module_init(mraa ... )
            or
        upm_mixed_module_init(... REQUIRES mraa)

    All sensors which use UPM interfaces (src/interfaces) now
    explicitly add the interfaces target:

        upm_module_init(interfaces ... )
            or
        upm_mixed_module_init(... REQUIRES interfaces)

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-02-06 16:52:27 -08:00
Noel Eck
d345006c03 cmake: Dependency refactoring for includes and libs
This commit attempts to use a more cmake-friendly approach when
handling inter-target dependencies.  A combination of macros and
include_directories usage provided overzealous compile -I/blah
entries which equates to large catch-all build commands.  For
example, the last CXX target contains include directories for nearly
all preceeding targets (~190).  Library dependencies were also often
wrong or missing.

    * Removed nearly all used of include_directories (swig cmake
      commands still appear to need these for generating the swig
      command line)
    * Updated usage of target_link_libraries in upm_module_init,
      also changed to using target_include_directories per target.
      This greatly simplifies upm/mixed_module_init usage for libraries
      which depend on other libraries (in this project).

        example (src/tb7300/CMakeLists.txt)
            old:
                 # upm-libbacnetmstp will bring in libbacnet, I hope
                 set (reqlibname "upm-bacnetmstp")
                 include_directories(${BACNET_INCLUDE_DIRS})
                 include_directories("../bacnetmstp")
                 upm_module_init()
                 upm_target_link_libraries(${libname} bacnetmstp)
            new:
                 upm_module_init(bacnetmstp)

      The reason here, is that tb7300 depends on bacnetmstp, which
      depends on BACNET includes/libs, so tb7300 gets the headers and
      libraries transitively via its dependency on bacnetmstp.
    * Updated pkg-config .pc file generation flow to reflect changes
      with dependencies.
    * Create a real target for the interfaces (CXX abstract sensor
      classes).  Renamed the directory from 'upm/src/upm' to
      'upm/src/interfaces'  Also changed the install location of the
      interface headers to include/upm/interfaces.  Updated interface
      header usage to reflect this.
    * Updated a few sensor libs to use fwd declarations for mraa.
      Ideally the UPM libs would do more of this which eases the
      burden on anyone building on top of the sensor libraries since
      they would not need to know about mraa headers.
    * Fixed examples which use symbols not defined in local includes

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-02-06 10:23:28 -08:00
Noel Eck
7f0e03b0e3 cmake: Convert module_init to function
This is a housekeeping commit to move the upm_module_init
macro to a function.  The scope resolution of the function
call adds a bit more protection for the variables used inside
this macro/function.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-02-05 21:30:20 -08:00
Jon Trulson
08a46ee8e6 grovecollision,groveeldriver,groveelectromagnet,waterlevel: remove unnecessary librt dependency
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-02-02 14:36:51 -07:00
Jon Trulson
fb88fda5cb upm_utilities: Add a _POSIX_C_SOURCE define if needed
In certain systems, where -std=c11 is used, certain posix extensions
are disabled unless specifically enabled.  On these systems, this
could cause usleep() and/or nanosleep() to fail with an implicit
declaration warning.  This patch ensures that at least POSIX 200809 is
used, if otherwise undefined.

This should fix Issue #513.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-02-02 13:58:41 -07:00
Jon Trulson
90d856d128 utilities: use nanosleep() instead of usleep() for upm_delay*() functions
usleep() has been deprecated, and can cause compile problems on never
glibc versions (debian jesse).  We now use nanosleep() on linux
systems to implement delays.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-02-02 12:32:04 -07:00
Jon Trulson
d2e0327c30 src/CMakLists.txt: re-disable other warnings for SWIG building
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-02-02 12:31:57 -07:00
Jon Trulson
2e97aa9979 speaker: fix some incorrect comments/documentation
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-02-01 17:59:15 -07:00
Noel Eck
cdb75e8c13 swig_java: Fix for #518 - java wrapper implementations
This commit fixes #518 by adding source back into the CXX swig-
generated wrapper.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-02-01 16:15:30 -08:00
Jon Trulson
dac31a0347 speaker: Add pwm functionality and 5 new examples to demonstrate
These changes add the ability to intialize a speaker instance to use a
PWM pin instead of a standard GPIO pin in order to emit sounds.

The current GPIO functionality is fairly constrained by the
implementation -- it only permits playing cerain hardcoded "notes".

The PWM support allows one to emit specific frequencies (currently
between 50-32Khz) using a PWM pin.  Of course, you may still be
constrained by the limits of your PWM hardware in the end.

There are a few new functions provided to support this PWM mode.  To
use the PWM mode of speaker, use the speaker_init_pwm() initialization
routine instead of speaker_init() (for C). For C++ and the SWIG
languages, pass "true" as the second argument to the constructor to
enable PWM mode.  The default is "false", to match current default
behavior (GPIO).

Functions that are not related to a given mode (GPIO vs. PWM) will do
nothing if not usable in that mode.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-02-01 17:08:05 -07:00
Jon Trulson
0749f130e1 nunchuck: C port; FTI; C++ wraps C
Some API changes were made as well, see docs/apichanges.md.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-01-31 13:08:20 -07:00
Jon Trulson
1bbb9386b7 enc03r: C port; FTI; C++ wraps C
The API for this driver has changed.  See docs/apichanges.md.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-01-30 12:06:32 -07:00
Noel Eck
f914159e21 ims: Small logging change for C init method
Added a bit more description if the library cannot set I2C
standard mode.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-01-27 11:16:24 -08:00
Jon Trulson
849711c47d wfs: C port; C++ wraps C
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-01-26 15:13:01 -07:00
Jon Trulson
0a91eb0b46 hmc5883l: C port; FTI; C++ wraps C
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-01-25 17:42:38 -07:00
Jon Trulson
806b00c2b7 uartat: add missing uartat_defs.h to SWIG interface files
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-01-24 17:31:57 -07:00
Jon Trulson
e8151640a1 uartat, le910: initial implementation.
uartat is the underlying UART driver, specifically for use with
AT-style command driven devices like modems.

The le910 support is provided in the form of examples that make use
of the uartat driver to interact with the device.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-01-24 14:02:03 -07:00
Jon Trulson
123e611f45 cjq4435: C port, C++ wraps C
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-01-20 12:02:30 -07:00
Jon Trulson
ab96e8f3a3 speaker: C port, C++ wraps C
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-01-19 13:54:47 -07:00
Jon Trulson
d3b864362d ds18b20: rewrite C++ to wrap C, add FTI, update examples
Previously, the C++ and C versions of this driver were separate.  Now
the C++ implementation wraps the C implementation.

In addition, the C++ init() function has been deprecated.  It
currently does nothing, and examples have been modified to remove it's
calls.  This function will be removed in a separate release.

The examples have been further modified to update all detected devices
and print their respective temperatures, instead of only reporting the
on the first device detected.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2017-01-18 13:33:44 -07:00
Noel Eck
6769d976a0 max30100: ISR recover attempt
Handle failure in ISR routine - attempt to read status and
FIFO registers and continue sampleing (vs exiting and turning
off continuous sampling).

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-01-11 15:52:41 -08:00