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!");
33 ESP_LOGE(TAG,
"Communication with ABP2 failed!");
42 ESP_LOGE(TAG,
"Communication with ABP2 failed!");
46 if ((
raw_data_[0] & (0x1 << STATUS_BIT_BUSY)) > 0) {
54 ESP_LOGE(TAG,
"Timeout!");
80 ESP_LOGV(TAG,
"Update Honeywell ABP2 Sensor");
87 ESP_LOGCONFIG(TAG,
" Min Pressure Range: %0.1f", this->
min_pressure_);
88 ESP_LOGCONFIG(TAG,
" Max Pressure Range: %0.1f", this->
max_pressure_);
90 ESP_LOGCONFIG(TAG,
" Transfer function A");
92 ESP_LOGCONFIG(TAG,
" Transfer function B");
94 LOG_UPDATE_INTERVAL(
this);
sensor::Sensor * temperature_sensor_
void measurement_timeout()
bool cancel_timeout(const std::string &name)
Cancel a timeout function.
void status_set_warning(const char *message="unspecified")
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 status_clear_warning()
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
Implementation of SPI Controller mode.
sensor::Sensor * pressure_sensor_
void set_transfer_function(ABP2TRANFERFUNCTION transfer_function)