148void xyz_process_callback(uint8_t sensor_id,
const uint8_t *data_ptr, uint32_t len, uint64_t *
timestamp,
void *user_data)
177 Serial.begin(115200);
183 Serial.println(
"Initializing Sensors...");
186 bhy.setFirmware(bosch_firmware_image, bosch_firmware_size);
197#ifdef USE_I2C_INTERFACE
202 Serial.print(
"Failed to initialize sensor - error code:");
203 Serial.println(
bhy.getError());
210#ifdef USE_SPI_INTERFACE
213 Serial.print(
"Failed to initialize sensor - error code:");
214 Serial.println(
bhy.getError());
221 Serial.println(
"Initializing the sensor successfully!");
224 BoschSensorInfo info =
bhy.getSensorInfo();
227 ArduinoStreamPrinter printer(Serial);
228 info.printInfo(printer);
230 info.printInfo([](
const char *format, ...) ->
int {
232 va_start(args, format);
233 int result = vprintf(format, args);
240 float sample_rate = 100.0;
241 uint32_t report_latency_ms = 0;
243#ifdef USING_DATA_HELPER
245 accel.enable(sample_rate, report_latency_ms);
247 gyro.enable(sample_rate, report_latency_ms);
250 bhy.configure(BoschSensorID::ACCEL_PASSTHROUGH, sample_rate, report_latency_ms);
252 bhy.configure(BoschSensorID::GYRO_PASSTHROUGH, sample_rate, report_latency_ms);
254 bhy.onResultEvent(BoschSensorID::ACCEL_PASSTHROUGH, xyz_process_callback);
256 bhy.onResultEvent(BoschSensorID::GYRO_PASSTHROUGH, xyz_process_callback);
259#ifdef USING_SENSOR_IRQ_METHOD