ESPHome  2024.12.2
qmp6988.cpp
Go to the documentation of this file.
1 #include "qmp6988.h"
2 #include <cmath>
3 
4 namespace esphome {
5 namespace qmp6988 {
6 
7 static const uint8_t QMP6988_CHIP_ID = 0x5C;
8 
9 static const uint8_t QMP6988_CHIP_ID_REG = 0xD1; /* Chip ID confirmation Register */
10 static const uint8_t QMP6988_RESET_REG = 0xE0; /* Device reset register */
11 static const uint8_t QMP6988_DEVICE_STAT_REG = 0xF3; /* Device state register */
12 static const uint8_t QMP6988_CTRLMEAS_REG = 0xF4; /* Measurement Condition Control Register */
13 /* data */
14 static const uint8_t QMP6988_PRESSURE_MSB_REG = 0xF7; /* Pressure MSB Register */
15 static const uint8_t QMP6988_TEMPERATURE_MSB_REG = 0xFA; /* Temperature MSB Reg */
16 
17 /* compensation calculation */
18 static const uint8_t QMP6988_CALIBRATION_DATA_START = 0xA0; /* QMP6988 compensation coefficients */
19 static const uint8_t QMP6988_CALIBRATION_DATA_LENGTH = 25;
20 
21 static const uint8_t SHIFT_RIGHT_4_POSITION = 4;
22 static const uint8_t SHIFT_LEFT_2_POSITION = 2;
23 static const uint8_t SHIFT_LEFT_4_POSITION = 4;
24 static const uint8_t SHIFT_LEFT_5_POSITION = 5;
25 static const uint8_t SHIFT_LEFT_8_POSITION = 8;
26 static const uint8_t SHIFT_LEFT_12_POSITION = 12;
27 static const uint8_t SHIFT_LEFT_16_POSITION = 16;
28 
29 /* power mode */
30 static const uint8_t QMP6988_SLEEP_MODE = 0x00;
31 static const uint8_t QMP6988_FORCED_MODE = 0x01;
32 static const uint8_t QMP6988_NORMAL_MODE = 0x03;
33 
34 static const uint8_t QMP6988_CTRLMEAS_REG_MODE_POS = 0;
35 static const uint8_t QMP6988_CTRLMEAS_REG_MODE_MSK = 0x03;
36 static const uint8_t QMP6988_CTRLMEAS_REG_MODE_LEN = 2;
37 
38 static const uint8_t QMP6988_CTRLMEAS_REG_OSRST_POS = 5;
39 static const uint8_t QMP6988_CTRLMEAS_REG_OSRST_MSK = 0xE0;
40 static const uint8_t QMP6988_CTRLMEAS_REG_OSRST_LEN = 3;
41 
42 static const uint8_t QMP6988_CTRLMEAS_REG_OSRSP_POS = 2;
43 static const uint8_t QMP6988_CTRLMEAS_REG_OSRSP_MSK = 0x1C;
44 static const uint8_t QMP6988_CTRLMEAS_REG_OSRSP_LEN = 3;
45 
46 static const uint8_t QMP6988_CONFIG_REG = 0xF1; /*IIR filter co-efficient setting Register*/
47 static const uint8_t QMP6988_CONFIG_REG_FILTER_POS = 0;
48 static const uint8_t QMP6988_CONFIG_REG_FILTER_MSK = 0x07;
49 static const uint8_t QMP6988_CONFIG_REG_FILTER_LEN = 3;
50 
51 static const uint32_t SUBTRACTOR = 8388608;
52 
53 static const char *const TAG = "qmp6988";
54 
55 static const char *oversampling_to_str(QMP6988Oversampling oversampling) {
56  switch (oversampling) {
58  return "None";
60  return "1x";
62  return "2x";
64  return "4x";
66  return "8x";
68  return "16x";
70  return "32x";
72  return "64x";
73  default:
74  return "UNKNOWN";
75  }
76 }
77 
78 static const char *iir_filter_to_str(QMP6988IIRFilter filter) {
79  switch (filter) {
81  return "OFF";
83  return "2x";
85  return "4x";
87  return "8x";
89  return "16x";
91  return "32x";
92  default:
93  return "UNKNOWN";
94  }
95 }
96 
98  uint8_t ret = 0;
99 
100  ret = this->read_register(QMP6988_CHIP_ID_REG, &(qmp6988_data_.chip_id), 1);
101  if (ret != i2c::ERROR_OK) {
102  ESP_LOGE(TAG, "%s: read chip ID (0xD1) failed", __func__);
103  }
104  ESP_LOGD(TAG, "qmp6988 read chip id = 0x%x", qmp6988_data_.chip_id);
105 
106  return qmp6988_data_.chip_id == QMP6988_CHIP_ID;
107 }
108 
110  uint8_t status = 0;
111  // BITFIELDS temp_COE;
112  uint8_t a_data_uint8_tr[QMP6988_CALIBRATION_DATA_LENGTH] = {0};
113  int len;
114 
115  for (len = 0; len < QMP6988_CALIBRATION_DATA_LENGTH; len += 1) {
116  status = this->read_register(QMP6988_CALIBRATION_DATA_START + len, &a_data_uint8_tr[len], 1);
117  if (status != i2c::ERROR_OK) {
118  ESP_LOGE(TAG, "qmp6988 read calibration data (0xA0) error!");
119  return false;
120  }
121  }
122 
123  qmp6988_data_.qmp6988_cali.COE_a0 =
124  (QMP6988_S32_t) (((a_data_uint8_tr[18] << SHIFT_LEFT_12_POSITION) |
125  (a_data_uint8_tr[19] << SHIFT_LEFT_4_POSITION) | (a_data_uint8_tr[24] & 0x0f))
126  << 12);
127  qmp6988_data_.qmp6988_cali.COE_a0 = qmp6988_data_.qmp6988_cali.COE_a0 >> 12;
128 
129  qmp6988_data_.qmp6988_cali.COE_a1 =
130  (QMP6988_S16_t) (((a_data_uint8_tr[20]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[21]);
131  qmp6988_data_.qmp6988_cali.COE_a2 =
132  (QMP6988_S16_t) (((a_data_uint8_tr[22]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[23]);
133 
134  qmp6988_data_.qmp6988_cali.COE_b00 =
135  (QMP6988_S32_t) (((a_data_uint8_tr[0] << SHIFT_LEFT_12_POSITION) | (a_data_uint8_tr[1] << SHIFT_LEFT_4_POSITION) |
136  ((a_data_uint8_tr[24] & 0xf0) >> SHIFT_RIGHT_4_POSITION))
137  << 12);
138  qmp6988_data_.qmp6988_cali.COE_b00 = qmp6988_data_.qmp6988_cali.COE_b00 >> 12;
139 
140  qmp6988_data_.qmp6988_cali.COE_bt1 =
141  (QMP6988_S16_t) (((a_data_uint8_tr[2]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[3]);
142  qmp6988_data_.qmp6988_cali.COE_bt2 =
143  (QMP6988_S16_t) (((a_data_uint8_tr[4]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[5]);
144  qmp6988_data_.qmp6988_cali.COE_bp1 =
145  (QMP6988_S16_t) (((a_data_uint8_tr[6]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[7]);
146  qmp6988_data_.qmp6988_cali.COE_b11 =
147  (QMP6988_S16_t) (((a_data_uint8_tr[8]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[9]);
148  qmp6988_data_.qmp6988_cali.COE_bp2 =
149  (QMP6988_S16_t) (((a_data_uint8_tr[10]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[11]);
150  qmp6988_data_.qmp6988_cali.COE_b12 =
151  (QMP6988_S16_t) (((a_data_uint8_tr[12]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[13]);
152  qmp6988_data_.qmp6988_cali.COE_b21 =
153  (QMP6988_S16_t) (((a_data_uint8_tr[14]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[15]);
154  qmp6988_data_.qmp6988_cali.COE_bp3 =
155  (QMP6988_S16_t) (((a_data_uint8_tr[16]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[17]);
156 
157  ESP_LOGV(TAG, "<-----------calibration data-------------->\r\n");
158  ESP_LOGV(TAG, "COE_a0[%d] COE_a1[%d] COE_a2[%d] COE_b00[%d]\r\n", qmp6988_data_.qmp6988_cali.COE_a0,
159  qmp6988_data_.qmp6988_cali.COE_a1, qmp6988_data_.qmp6988_cali.COE_a2, qmp6988_data_.qmp6988_cali.COE_b00);
160  ESP_LOGV(TAG, "COE_bt1[%d] COE_bt2[%d] COE_bp1[%d] COE_b11[%d]\r\n", qmp6988_data_.qmp6988_cali.COE_bt1,
161  qmp6988_data_.qmp6988_cali.COE_bt2, qmp6988_data_.qmp6988_cali.COE_bp1, qmp6988_data_.qmp6988_cali.COE_b11);
162  ESP_LOGV(TAG, "COE_bp2[%d] COE_b12[%d] COE_b21[%d] COE_bp3[%d]\r\n", qmp6988_data_.qmp6988_cali.COE_bp2,
163  qmp6988_data_.qmp6988_cali.COE_b12, qmp6988_data_.qmp6988_cali.COE_b21, qmp6988_data_.qmp6988_cali.COE_bp3);
164  ESP_LOGV(TAG, "<-----------calibration data-------------->\r\n");
165 
166  qmp6988_data_.ik.a0 = qmp6988_data_.qmp6988_cali.COE_a0; // 20Q4
167  qmp6988_data_.ik.b00 = qmp6988_data_.qmp6988_cali.COE_b00; // 20Q4
168 
169  qmp6988_data_.ik.a1 = 3608L * (QMP6988_S32_t) qmp6988_data_.qmp6988_cali.COE_a1 - 1731677965L; // 31Q23
170  qmp6988_data_.ik.a2 = 16889L * (QMP6988_S32_t) qmp6988_data_.qmp6988_cali.COE_a2 - 87619360L; // 30Q47
171 
172  qmp6988_data_.ik.bt1 = 2982L * (QMP6988_S64_t) qmp6988_data_.qmp6988_cali.COE_bt1 + 107370906L; // 28Q15
173  qmp6988_data_.ik.bt2 = 329854L * (QMP6988_S64_t) qmp6988_data_.qmp6988_cali.COE_bt2 + 108083093L; // 34Q38
174  qmp6988_data_.ik.bp1 = 19923L * (QMP6988_S64_t) qmp6988_data_.qmp6988_cali.COE_bp1 + 1133836764L; // 31Q20
175  qmp6988_data_.ik.b11 = 2406L * (QMP6988_S64_t) qmp6988_data_.qmp6988_cali.COE_b11 + 118215883L; // 28Q34
176  qmp6988_data_.ik.bp2 = 3079L * (QMP6988_S64_t) qmp6988_data_.qmp6988_cali.COE_bp2 - 181579595L; // 29Q43
177  qmp6988_data_.ik.b12 = 6846L * (QMP6988_S64_t) qmp6988_data_.qmp6988_cali.COE_b12 + 85590281L; // 29Q53
178  qmp6988_data_.ik.b21 = 13836L * (QMP6988_S64_t) qmp6988_data_.qmp6988_cali.COE_b21 + 79333336L; // 29Q60
179  qmp6988_data_.ik.bp3 = 2915L * (QMP6988_S64_t) qmp6988_data_.qmp6988_cali.COE_bp3 + 157155561L; // 28Q65
180  ESP_LOGV(TAG, "<----------- int calibration data -------------->\r\n");
181  ESP_LOGV(TAG, "a0[%d] a1[%d] a2[%d] b00[%d]\r\n", qmp6988_data_.ik.a0, qmp6988_data_.ik.a1, qmp6988_data_.ik.a2,
182  qmp6988_data_.ik.b00);
183  ESP_LOGV(TAG, "bt1[%lld] bt2[%lld] bp1[%lld] b11[%lld]\r\n", qmp6988_data_.ik.bt1, qmp6988_data_.ik.bt2,
184  qmp6988_data_.ik.bp1, qmp6988_data_.ik.b11);
185  ESP_LOGV(TAG, "bp2[%lld] b12[%lld] b21[%lld] bp3[%lld]\r\n", qmp6988_data_.ik.bp2, qmp6988_data_.ik.b12,
186  qmp6988_data_.ik.b21, qmp6988_data_.ik.bp3);
187  ESP_LOGV(TAG, "<----------- int calibration data -------------->\r\n");
188  return true;
189 }
190 
192  QMP6988_S16_t ret;
193  QMP6988_S64_t wk1, wk2;
194 
195  // wk1: 60Q4 // bit size
196  wk1 = ((QMP6988_S64_t) ik->a1 * (QMP6988_S64_t) dt); // 31Q23+24-1=54 (54Q23)
197  wk2 = ((QMP6988_S64_t) ik->a2 * (QMP6988_S64_t) dt) >> 14; // 30Q47+24-1=53 (39Q33)
198  wk2 = (wk2 * (QMP6988_S64_t) dt) >> 10; // 39Q33+24-1=62 (52Q23)
199  wk2 = ((wk1 + wk2) / 32767) >> 19; // 54,52->55Q23 (20Q04)
200  ret = (QMP6988_S16_t) ((ik->a0 + wk2) >> 4); // 21Q4 -> 17Q0
201  return ret;
202 }
203 
204 QMP6988_S32_t QMP6988Component::get_compensated_pressure_(qmp6988_ik_data_t *ik, QMP6988_S32_t dp, QMP6988_S16_t tx) {
205  QMP6988_S32_t ret;
206  QMP6988_S64_t wk1, wk2, wk3;
207 
208  // wk1 = 48Q16 // bit size
209  wk1 = ((QMP6988_S64_t) ik->bt1 * (QMP6988_S64_t) tx); // 28Q15+16-1=43 (43Q15)
210  wk2 = ((QMP6988_S64_t) ik->bp1 * (QMP6988_S64_t) dp) >> 5; // 31Q20+24-1=54 (49Q15)
211  wk1 += wk2; // 43,49->50Q15
212  wk2 = ((QMP6988_S64_t) ik->bt2 * (QMP6988_S64_t) tx) >> 1; // 34Q38+16-1=49 (48Q37)
213  wk2 = (wk2 * (QMP6988_S64_t) tx) >> 8; // 48Q37+16-1=63 (55Q29)
214  wk3 = wk2; // 55Q29
215  wk2 = ((QMP6988_S64_t) ik->b11 * (QMP6988_S64_t) tx) >> 4; // 28Q34+16-1=43 (39Q30)
216  wk2 = (wk2 * (QMP6988_S64_t) dp) >> 1; // 39Q30+24-1=62 (61Q29)
217  wk3 += wk2; // 55,61->62Q29
218  wk2 = ((QMP6988_S64_t) ik->bp2 * (QMP6988_S64_t) dp) >> 13; // 29Q43+24-1=52 (39Q30)
219  wk2 = (wk2 * (QMP6988_S64_t) dp) >> 1; // 39Q30+24-1=62 (61Q29)
220  wk3 += wk2; // 62,61->63Q29
221  wk1 += wk3 >> 14; // Q29 >> 14 -> Q15
222  wk2 = ((QMP6988_S64_t) ik->b12 * (QMP6988_S64_t) tx); // 29Q53+16-1=45 (45Q53)
223  wk2 = (wk2 * (QMP6988_S64_t) tx) >> 22; // 45Q53+16-1=61 (39Q31)
224  wk2 = (wk2 * (QMP6988_S64_t) dp) >> 1; // 39Q31+24-1=62 (61Q30)
225  wk3 = wk2; // 61Q30
226  wk2 = ((QMP6988_S64_t) ik->b21 * (QMP6988_S64_t) tx) >> 6; // 29Q60+16-1=45 (39Q54)
227  wk2 = (wk2 * (QMP6988_S64_t) dp) >> 23; // 39Q54+24-1=62 (39Q31)
228  wk2 = (wk2 * (QMP6988_S64_t) dp) >> 1; // 39Q31+24-1=62 (61Q20)
229  wk3 += wk2; // 61,61->62Q30
230  wk2 = ((QMP6988_S64_t) ik->bp3 * (QMP6988_S64_t) dp) >> 12; // 28Q65+24-1=51 (39Q53)
231  wk2 = (wk2 * (QMP6988_S64_t) dp) >> 23; // 39Q53+24-1=62 (39Q30)
232  wk2 = (wk2 * (QMP6988_S64_t) dp); // 39Q30+24-1=62 (62Q30)
233  wk3 += wk2; // 62,62->63Q30
234  wk1 += wk3 >> 15; // Q30 >> 15 = Q15
235  wk1 /= 32767L;
236  wk1 >>= 11; // Q15 >> 7 = Q4
237  wk1 += ik->b00; // Q4 + 20Q4
238  // wk1 >>= 4; // 28Q4 -> 24Q0
239  ret = (QMP6988_S32_t) wk1;
240  return ret;
241 }
242 
244  uint8_t ret = 0;
245 
246  ret = this->write_byte(QMP6988_RESET_REG, 0xe6);
247  if (ret != i2c::ERROR_OK) {
248  ESP_LOGE(TAG, "Software Reset (0xe6) failed");
249  }
250  delay(10);
251 
252  this->write_byte(QMP6988_RESET_REG, 0x00);
253 }
254 
256  uint8_t data;
257 
258  ESP_LOGD(TAG, "Setting Power mode to: %d", power_mode);
259 
260  qmp6988_data_.power_mode = power_mode;
261  this->read_register(QMP6988_CTRLMEAS_REG, &data, 1);
262  data = data & 0xfc;
263  if (power_mode == QMP6988_SLEEP_MODE) {
264  data |= 0x00;
265  } else if (power_mode == QMP6988_FORCED_MODE) {
266  data |= 0x01;
267  } else if (power_mode == QMP6988_NORMAL_MODE) {
268  data |= 0x03;
269  }
270  this->write_byte(QMP6988_CTRLMEAS_REG, data);
271 
272  ESP_LOGD(TAG, "Set Power mode 0xf4=0x%x \r\n", data);
273 
274  delay(10);
275 }
276 
277 void QMP6988Component::write_filter_(unsigned char filter) {
278  uint8_t data;
279 
280  data = (filter & 0x03);
281  this->write_byte(QMP6988_CONFIG_REG, data);
282  delay(10);
283 }
284 
285 void QMP6988Component::write_oversampling_pressure_(unsigned char oversampling_p) {
286  uint8_t data;
287 
288  this->read_register(QMP6988_CTRLMEAS_REG, &data, 1);
289  data &= 0xe3;
290  data |= (oversampling_p << 2);
291  this->write_byte(QMP6988_CTRLMEAS_REG, data);
292  delay(10);
293 }
294 
295 void QMP6988Component::write_oversampling_temperature_(unsigned char oversampling_t) {
296  uint8_t data;
297 
298  this->read_register(QMP6988_CTRLMEAS_REG, &data, 1);
299  data &= 0x1f;
300  data |= (oversampling_t << 5);
301  this->write_byte(QMP6988_CTRLMEAS_REG, data);
302  delay(10);
303 }
304 
306  this->temperature_oversampling_ = oversampling_t;
307 }
308 
310  this->pressure_oversampling_ = oversampling_p;
311 }
312 
313 void QMP6988Component::set_iir_filter(QMP6988IIRFilter iirfilter) { this->iir_filter_ = iirfilter; }
314 
316  float altitude;
317  altitude = (pow((101325 / pressure), 1 / 5.257) - 1) * (temp + 273.15) / 0.0065;
318  this->qmp6988_data_.altitude = altitude;
319 }
320 
322  uint8_t err = 0;
323  QMP6988_U32_t p_read, t_read;
324  QMP6988_S32_t p_raw, t_raw;
325  uint8_t a_data_uint8_tr[6] = {0};
326  QMP6988_S32_t t_int, p_int;
327  this->qmp6988_data_.temperature = 0;
328  this->qmp6988_data_.pressure = 0;
329 
330  err = this->read_register(QMP6988_PRESSURE_MSB_REG, a_data_uint8_tr, 6);
331  if (err != i2c::ERROR_OK) {
332  ESP_LOGE(TAG, "Error reading raw pressure/temp values");
333  return;
334  }
335  p_read = (QMP6988_U32_t) ((((QMP6988_U32_t) (a_data_uint8_tr[0])) << SHIFT_LEFT_16_POSITION) |
336  (((QMP6988_U16_t) (a_data_uint8_tr[1])) << SHIFT_LEFT_8_POSITION) | (a_data_uint8_tr[2]));
337  p_raw = (QMP6988_S32_t) (p_read - SUBTRACTOR);
338 
339  t_read = (QMP6988_U32_t) ((((QMP6988_U32_t) (a_data_uint8_tr[3])) << SHIFT_LEFT_16_POSITION) |
340  (((QMP6988_U16_t) (a_data_uint8_tr[4])) << SHIFT_LEFT_8_POSITION) | (a_data_uint8_tr[5]));
341  t_raw = (QMP6988_S32_t) (t_read - SUBTRACTOR);
342 
343  t_int = this->get_compensated_temperature_(&(qmp6988_data_.ik), t_raw);
344  p_int = this->get_compensated_pressure_(&(qmp6988_data_.ik), p_raw, t_int);
345 
346  this->qmp6988_data_.temperature = (float) t_int / 256.0f;
347  this->qmp6988_data_.pressure = (float) p_int / 16.0f;
348 }
349 
351  ESP_LOGCONFIG(TAG, "Setting up QMP6988");
352 
353  bool ret;
354  ret = this->device_check_();
355  if (!ret) {
356  ESP_LOGCONFIG(TAG, "Setup failed - device not found");
357  }
358 
359  this->software_reset_();
360  this->get_calibration_data_();
361  this->set_power_mode_(QMP6988_NORMAL_MODE);
362  this->write_filter_(iir_filter_);
365 }
366 
368  ESP_LOGCONFIG(TAG, "QMP6988:");
369  LOG_I2C_DEVICE(this);
370  if (this->is_failed()) {
371  ESP_LOGE(TAG, "Communication with QMP6988 failed!");
372  }
373  LOG_UPDATE_INTERVAL(this);
374 
375  LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
376  ESP_LOGCONFIG(TAG, " Temperature Oversampling: %s", oversampling_to_str(this->temperature_oversampling_));
377  LOG_SENSOR(" ", "Pressure", this->pressure_sensor_);
378  ESP_LOGCONFIG(TAG, " Pressure Oversampling: %s", oversampling_to_str(this->pressure_oversampling_));
379  ESP_LOGCONFIG(TAG, " IIR Filter: %s", iir_filter_to_str(this->iir_filter_));
380 }
381 
383 
385  this->calculate_pressure_();
386  float pressurehectopascals = this->qmp6988_data_.pressure / 100;
387  float temperature = this->qmp6988_data_.temperature;
388 
389  ESP_LOGD(TAG, "Temperature=%.2f°C, Pressure=%.2fhPa", temperature, pressurehectopascals);
390  if (this->temperature_sensor_ != nullptr)
391  this->temperature_sensor_->publish_state(temperature);
392  if (this->pressure_sensor_ != nullptr)
393  this->pressure_sensor_->publish_state(pressurehectopascals);
394 }
395 
396 } // namespace qmp6988
397 } // namespace esphome
void calculate_altitude_(float pressure, float temp)
Definition: qmp6988.cpp:315
QMP6988_S16_t get_compensated_temperature_(qmp6988_ik_data_t *ik, QMP6988_S32_t dt)
Definition: qmp6988.cpp:191
float pressure
Definition: qmp6988.h:72
void set_temperature_oversampling(QMP6988Oversampling oversampling_t)
Definition: qmp6988.cpp:305
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
struct Qmp6988IkData { QMP6988_S32_t a0, b00 qmp6988_ik_data_t
Definition: qmp6988.h:63
ErrorCode read_register(uint8_t a_register, uint8_t *data, size_t len, bool stop=true)
reads an array of bytes from a specific register in the I²C device
Definition: i2c.cpp:10
float altitude
Definition: qmp6988.h:73
void set_iir_filter(QMP6988IIRFilter iirfilter)
Definition: qmp6988.cpp:313
sensor::Sensor * pressure_sensor_
Definition: qmp6988.h:95
uint8_t power_mode
Definition: qmp6988.h:70
bool is_failed() const
Definition: component.cpp:143
void write_oversampling_pressure_(unsigned char oversampling_p)
Definition: qmp6988.cpp:285
float temperature
Definition: qmp6988.h:71
void set_power_mode_(uint8_t power_mode)
Definition: qmp6988.cpp:255
void set_pressure_oversampling(QMP6988Oversampling oversampling_p)
Definition: qmp6988.cpp:309
QMP6988_S32_t get_compensated_pressure_(qmp6988_ik_data_t *ik, QMP6988_S32_t dp, QMP6988_S16_t tx)
Definition: qmp6988.cpp:204
No error found during execution of method.
Definition: i2c_bus.h:13
QMP6988Oversampling pressure_oversampling_
Definition: qmp6988.h:98
void publish_state(float state)
Publish a new state to the front-end.
Definition: sensor.cpp:39
QMP6988IIRFilter iir_filter_
Definition: qmp6988.h:99
void write_oversampling_temperature_(unsigned char oversampling_t)
Definition: qmp6988.cpp:295
void write_filter_(unsigned char filter)
Definition: qmp6988.cpp:277
float get_setup_priority() const override
Definition: qmp6988.cpp:382
uint8_t status
Definition: bl0942.h:74
QMP6988Oversampling temperature_oversampling_
Definition: qmp6988.h:97
qmp6988_ik_data_t ik
Definition: qmp6988.h:75
std::string size_t len
Definition: helpers.h:293
bool write_byte(uint8_t a_register, uint8_t data, bool stop=true)
Definition: i2c.h:262
sensor::Sensor * temperature_sensor_
Definition: qmp6988.h:94
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void IRAM_ATTR HOT delay(uint32_t ms)
Definition: core.cpp:26