From a8e689784f8108c05d68a208fbaa895d71232d50 Mon Sep 17 00:00:00 2001 From: Chris D <32441086+CheesecakeCG@users.noreply.github.com> Date: Tue, 12 Aug 2025 05:01:00 -0400 Subject: [PATCH] Update BMI160 bulk read function (#466) --- src/sensors/softfusion/drivers/bmi160.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/sensors/softfusion/drivers/bmi160.h b/src/sensors/softfusion/drivers/bmi160.h index 22493af..1f79be1 100644 --- a/src/sensors/softfusion/drivers/bmi160.h +++ b/src/sensors/softfusion/drivers/bmi160.h @@ -30,6 +30,7 @@ #include #include "../../../sensorinterface/RegisterInterface.h" +#include "callbacks.h" #include "vqf.h" namespace SlimeVR::Sensors::SoftFusion::Drivers { @@ -182,12 +183,7 @@ struct BMI160 { return to_ret; } - template - void bulkRead( - AccelCall&& processAccelSample, - GyroCall&& processGyroSample, - TempCall&& processTempSample - ) { + void bulkRead(DriverCallbacks&& callbacks) { const auto fifo_bytes = m_RegisterInterface.readReg16(Regs::FifoLength) & 0x7FF; const auto bytes_to_read = std::min( @@ -218,7 +214,7 @@ struct BMI160 { gyro[0] = getFromFifo(i, read_buffer); gyro[1] = getFromFifo(i, read_buffer); gyro[2] = getFromFifo(i, read_buffer); - processGyroSample(gyro, GyrTs); + callbacks.processGyroSample(gyro, GyrTs); } if (header & Fifo::AccelDataBit) { @@ -226,7 +222,7 @@ struct BMI160 { accel[0] = getFromFifo(i, read_buffer); accel[1] = getFromFifo(i, read_buffer); accel[2] = getFromFifo(i, read_buffer); - processAccelSample(accel, AccTs); + callbacks.processAccelSample(accel, AccTs); } } }