mirror of
https://github.com/esphome/esphome.git
synced 2024-12-01 13:13:54 +01:00
40 lines
1.4 KiB
C++
40 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/sensor/sensor.h"
|
|
#include "esphome/components/i2c/i2c.h"
|
|
|
|
namespace esphome {
|
|
namespace mpu6886 {
|
|
|
|
class MPU6886Component : public PollingComponent, public i2c::I2CDevice {
|
|
public:
|
|
void setup() override;
|
|
void dump_config() override;
|
|
|
|
void update() override;
|
|
|
|
float get_setup_priority() const override;
|
|
|
|
void set_accel_x_sensor(sensor::Sensor *accel_x_sensor) { accel_x_sensor_ = accel_x_sensor; }
|
|
void set_accel_y_sensor(sensor::Sensor *accel_y_sensor) { accel_y_sensor_ = accel_y_sensor; }
|
|
void set_accel_z_sensor(sensor::Sensor *accel_z_sensor) { accel_z_sensor_ = accel_z_sensor; }
|
|
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }
|
|
void set_gyro_x_sensor(sensor::Sensor *gyro_x_sensor) { gyro_x_sensor_ = gyro_x_sensor; }
|
|
void set_gyro_y_sensor(sensor::Sensor *gyro_y_sensor) { gyro_y_sensor_ = gyro_y_sensor; }
|
|
void set_gyro_z_sensor(sensor::Sensor *gyro_z_sensor) { gyro_z_sensor_ = gyro_z_sensor; }
|
|
|
|
protected:
|
|
sensor::Sensor *accel_x_sensor_{nullptr};
|
|
sensor::Sensor *accel_y_sensor_{nullptr};
|
|
sensor::Sensor *accel_z_sensor_{nullptr};
|
|
sensor::Sensor *temperature_sensor_{nullptr};
|
|
sensor::Sensor *gyro_x_sensor_{nullptr};
|
|
sensor::Sensor *gyro_y_sensor_{nullptr};
|
|
sensor::Sensor *gyro_z_sensor_{nullptr};
|
|
};
|
|
;
|
|
|
|
} // namespace mpu6886
|
|
} // namespace esphome
|