44 for (i = 0; i < 8; i++) {
54 for (i = 0; i < 16; i++) {
56 res ^= ((prom[i >> 1]) & 0x00FF);
59 res ^= (prom[i >> 1] >> 8);
61 for (j = 8; j > 0; j--) {
70 if (crc == ((res >> 12) & 0xF)) {
83 int64_t dt, tempms, off, sens, t2, off2, sens2;
88 tempms = 2000 + ((
int64_t)dt * ms->
c[6]) / (1 << 23);
92 sens = ((
int64_t)ms->
c[1] * (1 << 15)) + ((
int64_t)ms->
c[3] * dt) / (1 << 8);
95 t2 = (dt * dt) / (1 << 31);
96 off2 = 5 * ((
int64_t)(tempms - 2000) * (tempms - 2000)) / (1 << 1);
97 sens2 = 5 * ((
int64_t)(tempms - 2000) * (tempms - 2000)) / (1 << 2);
99 off2 = off2 + 7 * (
int64_t)(tempms + 1500) * (tempms + 1500);
100 sens2 = sens2 + 11 * ((
int64_t)(tempms + 1500) * (tempms + 1500)) / (1 << 1);
102 tempms = tempms - t2;
110 if ((tempms > -4000) && (tempms < 8500) && (p > 1000) && (p < 120000)) {
126 int64_t dt, tempms, off, sens, t2, off2, sens2;
131 tempms = 2000 + ((
int64_t)dt * ms->
c[6]) / (1 << 23);
133 off = ((
int64_t)ms->
c[2] * (1 << 17)) + ((
int64_t)ms->
c[4] * dt) / (1 << 6);
135 sens = ((
int64_t)ms->
c[1] * (1 << 16)) + ((
int64_t)ms->
c[3] * dt) / (1 << 7);
138 t2 = (dt * dt) / (1 << 31);
139 off2 = 61 * ((
int64_t)(tempms - 2000) * (tempms - 2000)) / (1 << 4);
140 sens2 = 2 * ((
int64_t)(tempms - 2000) * (tempms - 2000));
141 if (tempms < -1500) {
142 off2 = off2 + 15 * (
int64_t)(tempms + 1500) * (tempms + 1500);
143 sens2 = sens2 + 8 * ((
int64_t)(tempms + 1500) * (tempms + 1500));
145 tempms = tempms - t2;
153 if ((tempms > -4000) && (tempms < 8500) && (p > 1000) && (p < 120000)) {
bool ms5611_calc(struct Ms5611Data *ms)
Calculate temperature and compensated pressure for MS5611.
bool ms5607_calc(struct Ms5611Data *ms)
Calculate temperature and compensated pressure for MS5607.
uint32_t pressure
pressure in Pascal (0.01mbar)
bool ms5611_prom_crc_ok(uint16_t *prom)
Check if CRC of PROM data is OK.
MS5611 barometer driver common interface (I2C and SPI).
int32_t temperature
temperature with 0.01 degrees Celsius resolution