mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
Merge pull request #10578 from mikeller/fix_dps310_i2c
Fixed initialisation of DPS310 when used over I2C.
This commit is contained in:
commit
284ec67cad
1 changed files with 10 additions and 2 deletions
|
@ -167,8 +167,16 @@ static bool deviceConfigure(busDevice_t * busDev)
|
|||
|
||||
// 1. Read the pressure calibration coefficients (c00, c10, c20, c30, c01, c11, and c21) from the Calibration Coefficient register.
|
||||
// Note: The coefficients read from the coefficient register are 2's complement numbers.
|
||||
uint8_t coef[18];
|
||||
if (!busReadBuf(busDev, DPS310_REG_COEF, coef, sizeof(coef))) {
|
||||
|
||||
// Do the read of the coefficients in multiple parts, as the chip will return a read failure when trying to read all at once over I2C.
|
||||
#define COEFFICIENT_LENGTH 18
|
||||
#define READ_LENGTH (COEFFICIENT_LENGTH / 2)
|
||||
|
||||
uint8_t coef[COEFFICIENT_LENGTH];
|
||||
if (!busReadBuf(busDev, DPS310_REG_COEF, coef, READ_LENGTH)) {
|
||||
return false;
|
||||
}
|
||||
if (!busReadBuf(busDev, DPS310_REG_COEF + READ_LENGTH, coef + READ_LENGTH, COEFFICIENT_LENGTH - READ_LENGTH)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue