Skip to content

Commit

Permalink
AP_Baro: fix LPS22H on I2C
Browse files Browse the repository at this point in the history
  • Loading branch information
khancyr authored and tridge committed May 21, 2019
1 parent 2348fa4 commit 3fa419e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libraries/AP_Baro/AP_Baro_LPS2XH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,13 @@ bool AP_Baro_LPS2XH::_init()
CallTime = 40 * AP_USEC_PER_MSEC;
}
if(_lps2xh_type == BARO_LPS22H){
_dev->write_register(LPS22H_CTRL_REG1,LPS22H_CTRL_REG1_ODR_75HZ|LPS22H_CTRL_REG1_BDU|LPS22H_CTRL_REG1_EN_LPFP|LPS22H_CTRL_REG1_LPFP_CFG);
_dev->write_register(LPS22H_CTRL_REG2,0x18);
_dev->write_register(LPS22H_CTRL_REG1, 0x00); // turn off for config
_dev->write_register(LPS22H_CTRL_REG1, LPS22H_CTRL_REG1_ODR_75HZ|LPS22H_CTRL_REG1_BDU|LPS22H_CTRL_REG1_EN_LPFP|LPS22H_CTRL_REG1_LPFP_CFG);
if (_dev->bus_type() == AP_HAL::Device::BUS_TYPE_SPI) {
_dev->write_register(LPS22H_CTRL_REG2, 0x18); // disable i2c
} else {
_dev->write_register(LPS22H_CTRL_REG2, 0x10);
}

// request 75Hz update
CallTime = 1000000/75;
Expand Down

0 comments on commit 3fa419e

Please sign in to comment.