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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>