147void xyz_process_callback(uint8_t sensor_id,
const uint8_t *data_ptr, uint32_t len, uint64_t *
timestamp,
void *user_data)
176 Serial.begin(115200);
182 Serial.println(
"Initializing Sensors...");
199#ifdef USE_I2C_INTERFACE
204 Serial.print(
"Failed to initialize sensor - error code:");
205 Serial.println(
bhy.getError());
212#ifdef USE_SPI_INTERFACE
215 Serial.print(
"Failed to initialize sensor - error code:");
216 Serial.println(
bhy.getError());
223 Serial.println(
"Initializing the sensor successfully!");
226 BoschSensorInfo info =
bhy.getSensorInfo();
229 ArduinoStreamPrinter printer(Serial);
230 info.printInfo(printer);
232 info.printInfo([](
const char *format, ...) ->
int {
234 va_start(args, format);
235 int result = vprintf(format, args);
241 float sample_rate = 100.0;
242 uint32_t report_latency_ms = 0;
244#ifdef USING_DATA_HELPER
246 accel.enable(sample_rate, report_latency_ms);
248 gyro.enable(sample_rate, report_latency_ms);
251 bhy.configure(BoschSensorID::ACCEL_PASSTHROUGH, sample_rate, report_latency_ms);
253 bhy.configure(BoschSensorID::GYRO_PASSTHROUGH, sample_rate, report_latency_ms);
255 bhy.onResultEvent(BoschSensorID::ACCEL_PASSTHROUGH, xyz_process_callback);
257 bhy.onResultEvent(BoschSensorID::GYRO_PASSTHROUGH, xyz_process_callback);
260#ifdef USING_SENSOR_IRQ_METHOD