7 static const char *
const TAG =
"mlx90393";
14 e = this->
read(response, response_size);
31 ESP_LOGCONFIG(TAG,
"Setting up MLX90393...");
35 this->
mlx_.begin_with_hal(
this, 0, 0);
49 ESP_LOGCONFIG(TAG,
"MLX90393:");
53 ESP_LOGE(TAG,
"Communication with MLX90393 failed!");
56 LOG_UPDATE_INTERVAL(
this);
58 LOG_SENSOR(
" ",
"X Axis", this->
x_sensor_);
59 LOG_SENSOR(
" ",
"Y Axis", this->
y_sensor_);
60 LOG_SENSOR(
" ",
"Z Axis", this->
z_sensor_);
61 LOG_SENSOR(
" ",
"Temperature", this->
t_sensor_);
69 if (this->
mlx_.readData(data) == MLX90393::STATUS_OK) {
70 ESP_LOGD(TAG,
"received %f %f %f", data.x, data.y, data.z);
85 ESP_LOGE(TAG,
"failed to read data");
const float DATA
For components that import data from directly connected sensors like DHT.
sensor::Sensor * x_sensor_
void status_set_warning(const char *message="unspecified")
ErrorCode read(uint8_t *data, size_t len)
reads an array of bytes from the device using an I2CBus
uint32_t IRAM_ATTR HOT micros()
void sleep_millis(uint32_t millis) override
uint32_t IRAM_ATTR HOT millis()
ErrorCode write(const uint8_t *data, size_t len, bool stop=true)
writes an array of bytes to a device using an I2CBus
float get_setup_priority() const override
void sleep_micros(uint32_t micros) override
bool transceive(const uint8_t *request, size_t request_size, uint8_t *response, size_t response_size) override
bool has_drdy_pin() override
void status_clear_warning()
bool read_drdy_pin() override
void publish_state(float state)
Publish a new state to the front-end.
sensor::Sensor * y_sensor_
virtual bool digital_read()=0
sensor::Sensor * z_sensor_
Implementation of SPI Controller mode.
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)
ErrorCode
Error codes returned by I2CBus and I2CDevice methods.
void dump_config() override
sensor::Sensor * t_sensor_
uint8_t temperature_oversampling_
void IRAM_ATTR HOT delay(uint32_t ms)