146void step_detector_process_callback(uint8_t sensor_id,
const uint8_t *data_ptr, uint32_t len, uint64_t *
timestamp,
void *user_data)
152void step_counter_process_callback(uint8_t sensor_id,
const uint8_t *data_ptr, uint32_t len, uint64_t *
timestamp,
void *user_data)
171 Serial.begin(115200);
177 Serial.println(
"Initializing Sensors...");
194 Serial.println(
"Initializing Sensors...");
196#ifdef USE_I2C_INTERFACE
201 Serial.print(
"Failed to initialize sensor - error code:");
202 Serial.println(
bhy.getError());
209#ifdef USE_SPI_INTERFACE
212 Serial.print(
"Failed to initialize sensor - error code:");
213 Serial.println(
bhy.getError());
220 Serial.println(
"Initializing the sensor successfully!");
223 BoschSensorInfo info =
bhy.getSensorInfo();
226 ArduinoStreamPrinter printer(Serial);
227 info.printInfo(printer);
229 info.printInfo([](
const char *format, ...) ->
int {
231 va_start(args, format);
232 int result = vprintf(format, args);
239 float sample_rate = 1.0;
240 uint32_t report_latency_ms = 0;
242#ifdef USING_DATA_HELPER
244 stepCounter.enable(sample_rate, report_latency_ms);
247 bhy.configure(BoschSensorID::STEP_DETECTOR, sample_rate, report_latency_ms);
249 bhy.configure(BoschSensorID::STEP_COUNTER, sample_rate, report_latency_ms);
251 bhy.onResultEvent(BoschSensorID::STEP_DETECTOR, step_detector_process_callback);
252 bhy.onResultEvent(BoschSensorID::STEP_COUNTER, step_counter_process_callback);
255#ifdef USING_SENSOR_IRQ_METHOD