ESPHome  2024.12.2
honeywellabp.h
Go to the documentation of this file.
1 // for Honeywell ABP sensor
2 // adapting code from https://github.com/vwls/Honeywell_pressure_sensors
3 #pragma once
4 
8 
9 namespace esphome {
10 namespace honeywellabp {
11 
13  public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
14  spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_200KHZ> {
15  public:
16  void set_pressure_sensor(sensor::Sensor *pressure_sensor) { pressure_sensor_ = pressure_sensor; }
17  void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }
18  void setup() override;
19  void update() override;
20  float get_setup_priority() const override;
21  void dump_config() override;
22  void set_honeywellabp_min_pressure(float min_pressure);
23  void set_honeywellabp_max_pressure(float max_pressure);
24 
25  protected:
28  uint8_t buf_[4]; // buffer to hold sensor data
29  uint8_t status_ = 0; // byte to hold status information.
30  int pressure_count_ = 0; // hold raw pressure data (14 - bit, 0 - 16384)
31  int temperature_count_ = 0; // hold raw temperature data (11 - bit, 0 - 2048)
34  uint8_t readsensor_();
35  uint8_t readstatus_();
36  int rawpressure_();
37  int rawtemperature_();
38  float countstopressure_(int counts, float min_pressure, float max_pressure);
39  float countstotemperatures_(int counts);
40  float read_pressure_();
41  float read_temperature_();
42 };
43 
44 } // namespace honeywellabp
45 } // namespace esphome
void set_honeywellabp_min_pressure(float min_pressure)
void set_honeywellabp_max_pressure(float max_pressure)
This class simplifies creating components that periodically check a state.
Definition: component.h:283
void set_pressure_sensor(sensor::Sensor *pressure_sensor)
Definition: honeywellabp.h:16
float countstopressure_(int counts, float min_pressure, float max_pressure)
The SPIDevice is what components using the SPI will create.
Definition: spi.h:391
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition: honeywellabp.h:17