6 namespace honeywellabp2_i2c {
8 static const uint8_t STATUS_BIT_POWER = 6;
9 static const uint8_t STATUS_BIT_BUSY = 5;
10 static const uint8_t STATUS_BIT_ERROR = 2;
11 static const uint8_t STATUS_MATH_SAT = 0;
13 static const char *
const TAG =
"honeywellabp2";
17 ESP_LOGE(TAG,
"Communication with ABP2 failed!");
32 ESP_LOGE(TAG,
"Communication with ABP2 failed!");
41 ESP_LOGE(TAG,
"Communication with ABP2 failed!");
45 if ((
raw_data_[0] & (0x1 << STATUS_BIT_BUSY)) > 0) {
53 ESP_LOGE(TAG,
"Timeout!");
79 ESP_LOGV(TAG,
"Update Honeywell ABP2 Sensor");
86 ESP_LOGCONFIG(TAG,
" Min Pressure Range: %0.1f", this->
min_pressure_);
87 ESP_LOGCONFIG(TAG,
" Max Pressure Range: %0.1f", this->
max_pressure_);
89 ESP_LOGCONFIG(TAG,
" Transfer function A");
91 ESP_LOGCONFIG(TAG,
" Transfer function B");
93 LOG_UPDATE_INTERVAL(
this);
sensor::Sensor * temperature_sensor_
void measurement_timeout()
bool cancel_timeout(const std::string &name)
Cancel a timeout function.
bool is_measurement_ready()
ErrorCode read(uint8_t *data, size_t len)
reads an array of bytes from the device using an I2CBus
ABP2TRANFERFUNCTION transfer_function_
void set_timeout(const std::string &name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
bool measurement_running_
ErrorCode write(const uint8_t *data, size_t len, bool stop=true)
writes an array of bytes to a device using an I2CBus
No error found during execution of method.
void publish_state(float state)
Publish a new state to the front-end.
constexpr uint32_t encode_uint24(uint8_t byte1, uint8_t byte2, uint8_t byte3)
Encode a 24-bit value given three bytes in most to least significant byte order.
void dump_config() override
virtual void mark_failed()
Mark this component as failed.
Implementation of SPI Controller mode.
sensor::Sensor * pressure_sensor_
void set_transfer_function(ABP2TRANFERFUNCTION transfer_function)