ESPHome  2022.8.0
bmp280.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace bmp280 {
9 
12  uint16_t t1; // 0x88 - 0x89
13  int16_t t2; // 0x8A - 0x8B
14  int16_t t3; // 0x8C - 0x8D
15 
16  uint16_t p1; // 0x8E - 0x8F
17  int16_t p2; // 0x90 - 0x91
18  int16_t p3; // 0x92 - 0x93
19  int16_t p4; // 0x94 - 0x95
20  int16_t p5; // 0x96 - 0x97
21  int16_t p6; // 0x98 - 0x99
22  int16_t p7; // 0x9A - 0x9B
23  int16_t p8; // 0x9C - 0x9D
24  int16_t p9; // 0x9E - 0x9F
25 };
26 
39 };
40 
51 };
52 
55  public:
56  void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }
57  void set_pressure_sensor(sensor::Sensor *pressure_sensor) { pressure_sensor_ = pressure_sensor; }
58 
60  void set_temperature_oversampling(BMP280Oversampling temperature_over_sampling);
62  void set_pressure_oversampling(BMP280Oversampling pressure_over_sampling);
64  void set_iir_filter(BMP280IIRFilter iir_filter);
65 
66  void setup() override;
67  void dump_config() override;
68  float get_setup_priority() const override;
69  void update() override;
70 
71  protected:
73  float read_temperature_(int32_t *t_fine);
75  float read_pressure_(int32_t t_fine);
76  uint8_t read_u8_(uint8_t a_register);
77  uint16_t read_u16_le_(uint8_t a_register);
78  int16_t read_s16_le_(uint8_t a_register);
79 
81  BMP280Oversampling temperature_oversampling_{BMP280_OVERSAMPLING_16X};
86  enum ErrorCode {
87  NONE = 0,
90  } error_code_{NONE};
91 };
92 
93 } // namespace bmp280
94 } // namespace esphome
void setup()
sensor::Sensor * pressure_sensor_
Definition: bmp280.h:85
void set_pressure_sensor(sensor::Sensor *pressure_sensor)
Definition: bmp280.h:57
Internal struct storing the calibration values of an BMP280.
Definition: bmp280.h:11
This class simplifies creating components that periodically check a state.
Definition: component.h:266
This class implements support for the BMP280 Temperature+Pressure i2c sensor.
Definition: bmp280.h:54
sensor::Sensor * temperature_sensor_
Definition: bmp280.h:84
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition: bmp280.h:56
BMP280CalibrationData calibration_
Definition: bmp280.h:80
BMP280IIRFilter
Enum listing all Infinite Impulse Filter values for the BMP280.
Definition: bmp280.h:45
BMP280Oversampling
Enum listing all Oversampling values for the BMP280.
Definition: bmp280.h:32
Definition: a4988.cpp:4
Base-class for all sensors.
Definition: sensor.h:48