Skip to content

Commit

Permalink
ADIS16470: Explicitly write & check all bits in MSC_CTRL register
Browse files Browse the repository at this point in the history
In case of any register read/write errors it is not enough to just check if
one of the bits is 0; the whole register contents needs to be checked. Also,
if initial read of the register fails in any reason, we should not write
back some corrupted value such as 0 or 0xFFFE.

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Jan 8, 2025
1 parent a666e96 commit ef3ef60
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/drivers/imu/analog_devices/adis16470/ADIS16470.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ class ADIS16470 : public device::SPI, public I2CSPIDriver<ADIS16470>
} _state{STATE::RESET};

uint8_t _checked_register{0};
static constexpr uint16_t msc_ctrl_val = 0xC1 & ~MSC_CTRL_BIT::DR_polarity;
static constexpr uint8_t size_register_cfg{1};
register_config_t _register_cfg[size_register_cfg] {
// Register | Set bits, Clear bits
{ Register::MSC_CTRL, 0, MSC_CTRL_BIT::DR_polarity },
{ Register::MSC_CTRL, msc_ctrl_val, (uint16_t)~msc_ctrl_val},
};
};

0 comments on commit ef3ef60

Please sign in to comment.