diff options
Diffstat (limited to 'readme.md')
-rw-r--r-- | readme.md | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -46,6 +46,43 @@ requires: ... ``` +<<<<<<< HEAD +## Example +For getting the current acceleration +``` +struct Acceleration{ + double x; + double y; + double z; +}; + +struct Acceleration v = value; + +le_result_t result = brnkl_motion_getCurrentAccleration(&v->x, &v->y, &v->z); +``` +To get a list of all recent impacts. + +``` +double xAcc[N_MAX_IMPACT_VALUES], yAcc[N_MAX_IMPACT_VALUES], zAcc[N_MAX_IMPACT_VALUES]; + uint64_t timestamps[N_MAX_IMPACT_VALUES]; + size_t xSize = N_MAX_IMPACT_VALUES, ySize = N_MAX_IMPACT_VALUES, + zSize = N_MAX_IMPACT_VALUES, timestampsSize = N_MAX_IMPACT_VALUES; + le_result_t r = brnkl_motion_getSuddenImpact( + xAcc, &xSize, yAcc, &ySize, zAcc, &zSize, timestamps, ×tampsSize); + if (r != LE_OK) + return r; + // NOTE this assumes that xSize == ySize == zSize == timestampsSize + // TODO could even assert/log this + int j = 0; + for (int i = 0; i < xSize; i++) { + recordRes[j++] = + le_avdata_RecordFloat(ref, "impactx", xAcc[i], timestamps[i]); + recordRes[j++] = + le_avdata_RecordFloat(ref, "impacty", yAcc[i], timestamps[i]); + recordRes[j++] = + le_avdata_RecordFloat(ref, "impactz", zAcc[i], timestamps[i]); + } +======= ## Examples For getting a list of impact information you may follow this example. @@ -76,4 +113,5 @@ le_result_t result = getCurrentAcceleration(x_val, y_val, z_val); LE_INFO("Current Acceleration: X: %d - Y: %d - Z: %d"); +>>>>>>> 7ba91139470e24608d255ec0156444e26133d935 ``` |