mirror of
https://github.com/eclipse/upm.git
synced 2025-03-22 00:17:30 +03:00

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>
18 lines
426 B
OpenEdge ABL
18 lines
426 B
OpenEdge ABL
%module jsupm_bno055
|
|
%include "../upm.i"
|
|
%include "cpointer.i"
|
|
%include "../upm_vectortypes.i"
|
|
|
|
/* Send "int *" and "float *" to JS as intp and floatp, though
|
|
* using the vector return (upm_vectortypes.i) functions instead of
|
|
* the pointer argument functions is preferable.
|
|
*/
|
|
%pointer_functions(int, intp);
|
|
%pointer_functions(float, floatp);
|
|
|
|
%include "bno055_regs.h"
|
|
%include "bno055.hpp"
|
|
%{
|
|
#include "bno055.hpp"
|
|
%}
|