Skip to content

Commit 904fde5

Browse files
committed
add a check for a DS constraint
OFF_CANC bit must be set to 1 when try to enable 'offset cancellation in single measurement mode'. Signed-off-by: Gioele Fiorenza <gioele.fiorenza2000@gmail.com>
1 parent 195e1b7 commit 904fde5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lis2mdl_reg.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,10 @@ int32_t lis2mdl_set_rst_sensor_single_set(const stmdev_ctx_t *ctx,
563563

564564
ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t *)&reg, 1);
565565

566+
if (val == 1 && reg.set_rst != LIS2MDL_SENS_OFF_CANC_EVERY_ODR) {
567+
return -1;
568+
}
569+
566570
if (ret == 0)
567571
{
568572
reg.off_canc_one_shot = val;

0 commit comments

Comments
 (0)