ESPHome  2024.11.2
bmi160.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace bmi160 {
9 
11  public:
12  void setup() override;
13  void dump_config() override;
14 
15  void update() override;
16 
17  float get_setup_priority() const override;
18 
19  void set_accel_x_sensor(sensor::Sensor *accel_x_sensor) { accel_x_sensor_ = accel_x_sensor; }
20  void set_accel_y_sensor(sensor::Sensor *accel_y_sensor) { accel_y_sensor_ = accel_y_sensor; }
21  void set_accel_z_sensor(sensor::Sensor *accel_z_sensor) { accel_z_sensor_ = accel_z_sensor; }
22  void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }
23  void set_gyro_x_sensor(sensor::Sensor *gyro_x_sensor) { gyro_x_sensor_ = gyro_x_sensor; }
24  void set_gyro_y_sensor(sensor::Sensor *gyro_y_sensor) { gyro_y_sensor_ = gyro_y_sensor; }
25  void set_gyro_z_sensor(sensor::Sensor *gyro_z_sensor) { gyro_z_sensor_ = gyro_z_sensor; }
26 
27  protected:
35 
36  void internal_setup_(int stage);
37  bool setup_complete_{false};
38 
40  i2c::ErrorCode read_le_int16_(uint8_t reg, int16_t *value, uint8_t len);
41 };
42 
43 } // namespace bmi160
44 } // namespace esphome
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition: bmi160.h:22
float get_setup_priority() const override
Definition: bmi160.cpp:267
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
Definition: i2c.h:149
This class simplifies creating components that periodically check a state.
Definition: component.h:283
sensor::Sensor * gyro_z_sensor_
Definition: bmi160.h:34
void set_accel_x_sensor(sensor::Sensor *accel_x_sensor)
Definition: bmi160.h:19
i2c::ErrorCode read_le_int16_(uint8_t reg, int16_t *value, uint8_t len)
reads len 16-bit little-endian integers from the given i2c register
Definition: bmi160.cpp:204
sensor::Sensor * accel_x_sensor_
Definition: bmi160.h:28
sensor::Sensor * gyro_x_sensor_
Definition: bmi160.h:32
sensor::Sensor * accel_z_sensor_
Definition: bmi160.h:30
void set_accel_y_sensor(sensor::Sensor *accel_y_sensor)
Definition: bmi160.h:20
void set_accel_z_sensor(sensor::Sensor *accel_z_sensor)
Definition: bmi160.h:21
std::string size_t len
Definition: helpers.h:293
sensor::Sensor * temperature_sensor_
Definition: bmi160.h:31
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_gyro_y_sensor(sensor::Sensor *gyro_y_sensor)
Definition: bmi160.h:24
void internal_setup_(int stage)
Definition: bmi160.cpp:119
ErrorCode
Error codes returned by I2CBus and I2CDevice methods.
Definition: i2c_bus.h:11
sensor::Sensor * gyro_y_sensor_
Definition: bmi160.h:33
Base-class for all sensors.
Definition: sensor.h:57
void set_gyro_x_sensor(sensor::Sensor *gyro_x_sensor)
Definition: bmi160.h:23
void set_gyro_z_sensor(sensor::Sensor *gyro_z_sensor)
Definition: bmi160.h:25
sensor::Sensor * accel_y_sensor_
Definition: bmi160.h:29
This Class provides the methods to read/write bytes from/to an i2c device.
Definition: i2c.h:133