42 for (i = 0; i < 16; i++) {
44 res ^= ((prom[i >> 1]) & 0x00FF);
46 res ^= (prom[i >> 1] >> 8);
48 for (j = 8; j > 0; j--) {
56 if (crc == ((res >> 12) & 0xF)) {
69 int64_t dt, tempms, off, sens, t2, off2, sens2;
74 tempms = 2000 + ((
int64_t)dt * ms->
c[6]) / (1 << 23);
78 sens = ((
int64_t)ms->
c[1] * (1 << 15)) + ((
int64_t)ms->
c[3] * dt) / (1 << 8);
81 t2 = (dt * dt) / (1 << 31);
82 off2 = 5 * ((
int64_t)(tempms - 2000) * (tempms - 2000)) / (1 << 1);
83 sens2 = 5 * ((
int64_t)(tempms - 2000) * (tempms - 2000)) / (1 << 2);
85 off2 = off2 + 7 * (
int64_t)(tempms + 1500) * (tempms + 1500);
86 sens2 = sens2 + 11 * ((
int64_t)(tempms + 1500) * (tempms + 1500)) / (1 << 1);
96 if ((tempms > -4000) && (tempms < 8500) && (p > 1000) && (p < 120000)) {
112 int64_t dt, tempms, off, sens, t2, off2, sens2;
117 tempms = 2000 + ((
int64_t)dt * ms->
c[6]) / (1 << 23);
119 off = ((
int64_t)ms->
c[2] * (1 << 17)) + ((
int64_t)ms->
c[4] * dt) / (1 << 6);
121 sens = ((
int64_t)ms->
c[1] * (1 << 16)) + ((
int64_t)ms->
c[3] * dt) / (1 << 7);
124 t2 = (dt * dt) / (1 << 31);
125 off2 = 61 * ((
int64_t)(tempms - 2000) * (tempms - 2000)) / (1 << 4);
126 sens2 = 2 * ((
int64_t)(tempms - 2000) * (tempms - 2000));
127 if (tempms < -1500) {
128 off2 = off2 + 15 * (
int64_t)(tempms + 1500) * (tempms + 1500);
129 sens2 = sens2 + 8 * ((
int64_t)(tempms + 1500) * (tempms + 1500));
131 tempms = tempms - t2;
139 if ((tempms > -4000) && (tempms < 8500) && (p > 1000) && (p < 120000)) {
uint32_t pressure
pressure in Pascal (0.01mbar)
bool_t ms5611_prom_crc_ok(uint16_t *prom)
Check if CRC of PROM data is OK.
MS5611 barometer driver common interface (I2C and SPI).
bool_t ms5607_calc(struct Ms5611Data *ms)
Calculate temperature and compensated pressure for MS5607.
bool_t ms5611_calc(struct Ms5611Data *ms)
Calculate temperature and compensated pressure for MS5611.
int32_t temperature
temperature with 0.01 degrees Celsius resolution