I am using the Arduino IDE. Because the Arduino_BHY2 lib does not expose all functionality of the bhy2 C API and also does not give access to the bhy2_dev structure, you have to add the following code to the BoschSensortec class in BoschSensortec.h: public:
bhy2_dev& dev() {return _bhy2;}; In the setup() function of the Arduino sketch I do this: void setup()
{
...
struct bhy2_self_test_resp accel_result;
int err = bhy2_perform_self_test(BSX_PHYS_SENS_ID_ACCEL, &accel_result, &sensortec.dev());
if (err != BHY2_OK) {
goto Error;
}
if (accel_result.test_status != 0) {
goto Error;
}
...
set_LED_color(0xff,0xff,0); // yellow
return;
Error:
set_LED_color(0xff,0,0);
} "sensortec" is a global variable defined by the Arduino_BHY2 lib.
... View more