mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 01:41:12 +03:00
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>
This commit is contained in:
@ -4,6 +4,22 @@ API Changes {#apichanges}
|
||||
Here's a list of other API changes made to the library that break source/binary
|
||||
compatibility between releases:
|
||||
|
||||
# current master
|
||||
|
||||
* **bno055** This module no longer uses std::strings to pass around
|
||||
binary data (*read/writeCalibrationData()*). Rather, now *std::vectors* of
|
||||
the appropriate type are used. In addition, methods that previously
|
||||
returned certain data in the form of an array, like *getEulerAngles()*,
|
||||
now return a *std::vector* instead. This simplifies the Python,
|
||||
Javascript, and Java bindings considerably, and leads to more
|
||||
"natural" looking Python/Javascript/Java code. For Javascript, Java,
|
||||
and Python, the examples have been modified to use these methods
|
||||
rather than the methods that return data in argument pointers or
|
||||
arrays. The "old style" C pointer API's are still present for
|
||||
backwards compatibility, but may be removed in the future.
|
||||
|
||||
# v1.1.0
|
||||
|
||||
* **i2clcd/jhd1313m1/lcm1602** LCD devices supported by the i2clcd module are
|
||||
being separated into individual libraries. The APIs will be preserved, but
|
||||
we recommend changing your code to use the new libraries as they become
|
||||
|
Reference in New Issue
Block a user