mirror of
https://github.com/esphome/esphome.git
synced 2024-12-02 11:44:13 +01:00
8e75980ebd
* Cleanup dashboard JS * Add vscode * Save start_mark/end_mark * Updates * Updates * Remove need for cv.nameable It's a bit hacky but removes so much bloat from integrations * Add enum helper * Document APIs, and Improvements * Fixes * Fixes * Update PULL_REQUEST_TEMPLATE.md * Updates * Updates * Updates
39 lines
1.4 KiB
C++
39 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 mpu6050 {
|
|
|
|
class MPU6050Component : 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 mpu6050
|
|
} // namespace esphome
|