From b55501e327837bfaa20c745c1b0a06bd0234a624 Mon Sep 17 00:00:00 2001 From: "Antoine W. Campagna" Date: Sun, 25 Mar 2018 21:50:34 -0400 Subject: [PATCH] kx122: Note return method change in apichanges.md Updated the API documentation with changes to the kx122. Removed a few extra EOL spaces. Signed-off-by: Antoine W. Campagna Signed-off-by: Noel Eck --- docs/apichanges.md | 5 +++++ src/kx122/kx122.cxx | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/apichanges.md b/docs/apichanges.md index 2b078772..24f19e7a 100644 --- a/docs/apichanges.md +++ b/docs/apichanges.md @@ -4,6 +4,11 @@ API Changes {#apichanges} Here's a list of other API changes made to the library that break source/binary compatibility between releases: +# vNext + * The interface of **kx122** has been modified to return values instead of + receiving pointers. This applies to member functions: getWhoAmI, + getInterruptSource, getBufferStatus, getRawBufferSamples, and getBufferSamples. + # v1.6.0 * Several C libraries had their init function pin type modified from uint8_t diff --git a/src/kx122/kx122.cxx b/src/kx122/kx122.cxx index cd8f097f..a3550f5f 100644 --- a/src/kx122/kx122.cxx +++ b/src/kx122/kx122.cxx @@ -318,7 +318,7 @@ uint KX122::getBufferStatus() if(kx122_get_buffer_status(m_kx122, &nb_samples)){ throw std::runtime_error(std::string(__FUNCTION__) + "kx122_get_buffer_status failed"); } - + return nb_samples; } @@ -339,7 +339,7 @@ std::vector KX122::getRawBufferSamples(uint len) xyz_array[i * 3 + 1] = buffery[i]; xyz_array[i * 3 + 2] = bufferz[i]; } - + return xyz_array; } @@ -349,7 +349,7 @@ std::vector KX122::getBufferSamples(uint len) if(kx122_read_buffer_samples(m_kx122,len,bufferx,buffery,bufferz)){ throw std::runtime_error(std::string(__FUNCTION__) + "kx122_read_buffer_samples failed"); } - + std::vector xyz_array(len * 3); for (uint i = 0; i < len; i++) { @@ -357,7 +357,7 @@ std::vector KX122::getBufferSamples(uint len) xyz_array[i * 3 + 1] = buffery[i]; xyz_array[i * 3 + 2] = bufferz[i]; } - + return xyz_array; }