Loading...
Searching...
No Matches
CallbackTests.cpp File Reference
`#include "unity.h"`
`#include "../include/BNO08xTestHelper.hpp"`
Include dependency graph for CallbackTests.cpp:

## Functions

| TEST_CASE ("BNO08x Driver Creation for [CallbackTests] Tests", "[CallbackTests]")

imu

register_cb ([&imu, &new_data, &report_data, &prev_report_data, &msg_buff]() { static int cb_execution_cnt=0;cb_execution_cnt++;BNO08xTestHelper::update_report_data(&report_data);if(BNO08xTestHelper::accelerometer_data_is_new(&report_data, &prev_report_data)) { new_data=true;sprintf(msg_buff, "Rx Data Trial %d Success: AngularAccel: aX: %.2lf accel aY: %.2lf accel aZ: " "%.2lf Accuracy %s", cb_execution_cnt, report_data.accel_x, report_data.accel_y, report_data.accel_z, BNO08xTestHelper::BNO08xAccuracy_to_str(report_data.accel_accuracy));BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);} })

imu | enable_accelerometer (REPORT_PERIOD)
| for (int i=0;i< RX_REPORT_TRIAL_CNT;i++)
imu | disable_accelerometer ()

imu

register_cb ([&imu, &new_data, &report_data, &prev_report_data, &msg_buff]() { static int cb_execution_cnt=0;cb_execution_cnt++;BNO08xTestHelper::update_report_data(&report_data);if(BNO08xTestHelper::accelerometer_data_is_new(&report_data, &prev_report_data)) { new_data[0]=true;sprintf(msg_buff, "Rx Data Trial %d Success: AngularAccel: aX: %.2lf accel aY: %.2lf accel aZ: " "%.2lf Accuracy %s", cb_execution_cnt, report_data.accel_x, report_data.accel_y, report_data.accel_z, BNO08xTestHelper::BNO08xAccuracy_to_str(report_data.accel_accuracy));BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);} if(BNO08xTestHelper::linear_accelerometer_data_is_new(&report_data, &prev_report_data)) { new_data[1]=true;sprintf(msg_buff, "Rx Data Trial %d Success: LinearAccel: laX: %.2lf laY: %.2lf laZ: " "%.2lf Accuracy: %s",(cb_execution_cnt+1), report_data.lin_accel_x, report_data.lin_accel_y, report_data.lin_accel_z, BNO08xTestHelper::BNO08xAccuracy_to_str(report_data.lin_accel_accuracy));BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);} })

imu | enable_linear_accelerometer (REPORT_PERIOD)
| TEST_ASSERT_EQUAL (true, new_data[0])
| TEST_ASSERT_EQUAL (true, new_data[1])
imu | disable_linear_accelerometer ()
| TEST_CASE ("BNO08x Driver Cleanup for [CallbackTests] Tests", "[CallbackTests]")

## Variables

BNO08x * | imu = nullptr
BNO08xTestHelper::imu_report_data_t | report_data
BNO08xTestHelper::imu_report_data_t | prev_report_data
const constexpr uint8_t | RX_REPORT_TRIAL_CNT = 5
const constexpr uint32_t | REPORT_PERIOD = 100000UL
bool | new_data = false
char | msg_buff [200] = {}
const constexpr uint8_t | ENABLED_REPORT_CNT = 2

## Function Documentation

## disable_accelerometer()

imu disable_accelerometer | ( |  | ) |

## disable_linear_accelerometer()

imu disable_linear_accelerometer | ( |  | ) |

## enable_accelerometer()

imu enable_accelerometer | ( | REPORT_PERIOD |  | ) |

## enable_linear_accelerometer()

imu enable_linear_accelerometer | ( | REPORT_PERIOD |  | ) |

Here is the call graph for this function:

## for()

for | ( |  | ) |

Here is the call graph for this function:

## register_cb() [1/2]

imu register_cb

(

[&imu, &new_data, &report_data, &prev_report_data, &msg_buff] () { static int cb_execution_cnt=0;cb_execution_cnt++;BNO08xTestHelper::update_report_data(&report_data);if(BNO08xTestHelper::accelerometer_data_is_new(&report_data, &prev_report_data)) { new_data=true;sprintf(msg_buff, "Rx Data Trial %d Success: AngularAccel: aX: %.2lf accel aY: %.2lf accel aZ: " "%.2lf Accuracy %s", cb_execution_cnt, report_data.accel_x, report_data.accel_y, report_data.accel_z, BNO08xTestHelper::BNO08xAccuracy_to_str(report_data.accel_accuracy));BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);} }

)

Here is the call graph for this function:

## register_cb() [2/2]

imu register_cb

(

[&imu, &new_data, &report_data, &prev_report_data, &msg_buff] () { static int cb_execution_cnt=0;cb_execution_cnt++;BNO08xTestHelper::update_report_data(&report_data);if(BNO08xTestHelper::accelerometer_data_is_new(&report_data, &prev_report_data)) { new_data[0]=true;sprintf(msg_buff, "Rx Data Trial %d Success: AngularAccel: aX: %.2lf accel aY: %.2lf accel aZ: " "%.2lf Accuracy %s", cb_execution_cnt, report_data.accel_x, report_data.accel_y, report_data.accel_z, BNO08xTestHelper::BNO08xAccuracy_to_str(report_data.accel_accuracy));BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);} if(BNO08xTestHelper::linear_accelerometer_data_is_new(&report_data, &prev_report_data)) { new_data[1]=true;sprintf(msg_buff, "Rx Data Trial %d Success: LinearAccel: laX: %.2lf laY: %.2lf laZ: " "%.2lf Accuracy: %s",(cb_execution_cnt+1), report_data.lin_accel_x, report_data.lin_accel_y, report_data.lin_accel_z, BNO08xTestHelper::BNO08xAccuracy_to_str(report_data.lin_accel_accuracy));BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);} }

)

Here is the call graph for this function:

## TEST_ASSERT_EQUAL() [1/2]

TEST_ASSERT_EQUAL | ( | true | ,
|  | new_data | [0] )

Here is the caller graph for this function:

## TEST_ASSERT_EQUAL() [2/2]

TEST_ASSERT_EQUAL | ( | true | ,
|  | new_data | [1] )

## TEST_CASE() [1/2]

TEST_CASE | ( | "BNO08x Driver Cleanup for Tests" | [CallbackTests],
|  | "" | [CallbackTests] )

Here is the call graph for this function:

## TEST_CASE() [2/2]

TEST_CASE | ( | "BNO08x Driver Creation for Tests" | [CallbackTests],
|  | "" | [CallbackTests] )

Here is the call graph for this function:

## Variable Documentation

## ENABLED_REPORT_CNT

const constexpr uint8_t ENABLED_REPORT_CNT = 2

constexpr

## imu

BNO08x * imu = nullptr

## msg_buff

char msg_buff = {}

## new_data

bool new_data = false

## prev_report_data

BNO08xTestHelper::imu_report_data_t prev_report_data

## report_data

BNO08xTestHelper::update_report_data & report_data

## REPORT_PERIOD

const constexpr uint32_t REPORT_PERIOD = 100000UL

constexpr

## RX_REPORT_TRIAL_CNT

const constexpr uint8_t RX_REPORT_TRIAL_CNT = 5

constexpr