@@ -312,6 +312,38 @@ static int icm45686_init(const struct device *dev)
312312 return err ;
313313 }
314314
315+ /** Write Low-pass filter settings through indirect register access */
316+ uint8_t gyro_lpf_write_array [] = REG_IREG_PREPARE_WRITE_ARRAY (
317+ REG_IPREG_SYS1_OFFSET ,
318+ REG_IPREG_SYS1_REG_172 ,
319+ REG_IPREG_SYS1_REG_172_GYRO_LPFBW_SEL (
320+ cfg -> settings .gyro .lpf ));
321+
322+ err = icm45686_bus_write (dev , REG_IREG_ADDR_15_8 , gyro_lpf_write_array ,
323+ sizeof (gyro_lpf_write_array ));
324+ if (err ) {
325+ LOG_ERR ("Failed to set Gyro BW settings: %d" , err );
326+ return err ;
327+ }
328+
329+ /** Wait before indirect register write is made effective
330+ * before proceeding with next one.
331+ */
332+ k_sleep (K_MSEC (1 ));
333+
334+ uint8_t accel_lpf_write_array [] = REG_IREG_PREPARE_WRITE_ARRAY (
335+ REG_IPREG_SYS2_OFFSET ,
336+ REG_IPREG_SYS2_REG_131 ,
337+ REG_IPREG_SYS2_REG_131_ACCEL_LPFBW_SEL (
338+ cfg -> settings .accel .lpf ));
339+
340+ err = icm45686_bus_write (dev , REG_IREG_ADDR_15_8 , accel_lpf_write_array ,
341+ sizeof (accel_lpf_write_array ));
342+ if (err ) {
343+ LOG_ERR ("Failed to set Accel BW settings: %d" , err );
344+ return err ;
345+ }
346+
315347 LOG_DBG ("Init OK" );
316348
317349 return 0 ;
@@ -341,11 +373,13 @@ static int icm45686_init(const struct device *dev)
341373 .pwr_mode = DT_INST_PROP(inst, accel_pwr_mode), \
342374 .fs = DT_INST_PROP(inst, accel_fs), \
343375 .odr = DT_INST_PROP(inst, accel_odr), \
376+ .lpf = DT_INST_PROP_OR(inst, accel_lpf, 0), \
344377 }, \
345378 .gyro = { \
346379 .pwr_mode = DT_INST_PROP(inst, gyro_pwr_mode), \
347380 .fs = DT_INST_PROP(inst, gyro_fs), \
348381 .odr = DT_INST_PROP(inst, gyro_odr), \
382+ .lpf = DT_INST_PROP_OR(inst, gyro_lpf, 0), \
349383 }, \
350384 }, \
351385 }; \
0 commit comments