ESPHome  2024.5.4
qmc5883l.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace qmc5883l {
9 
15 };
16 
20 };
21 
27 };
28 
30  public:
31  void setup() override;
32  void dump_config() override;
33  float get_setup_priority() const override;
34  void update() override;
35 
36  void set_datarate(QMC5883LDatarate datarate) { datarate_ = datarate; }
37  void set_range(QMC5883LRange range) { range_ = range; }
38  void set_oversampling(QMC5883LOversampling oversampling) { oversampling_ = oversampling; }
39  void set_x_sensor(sensor::Sensor *x_sensor) { x_sensor_ = x_sensor; }
40  void set_y_sensor(sensor::Sensor *y_sensor) { y_sensor_ = y_sensor; }
41  void set_z_sensor(sensor::Sensor *z_sensor) { z_sensor_ = z_sensor; }
42  void set_heading_sensor(sensor::Sensor *heading_sensor) { heading_sensor_ = heading_sensor; }
43  void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }
44 
45  protected:
54  enum ErrorCode {
55  NONE = 0,
57  } error_code_;
58  bool read_byte_16_(uint8_t a_register, uint16_t *data);
60 };
61 
62 } // namespace qmc5883l
63 } // namespace esphome
void set_range(QMC5883LRange range)
Definition: qmc5883l.h:37
void set_datarate(QMC5883LDatarate datarate)
Definition: qmc5883l.h:36
sensor::Sensor * heading_sensor_
Definition: qmc5883l.h:52
Helper class to request loop() to be called as fast as possible.
Definition: helpers.h:609
void set_oversampling(QMC5883LOversampling oversampling)
Definition: qmc5883l.h:38
This class simplifies creating components that periodically check a state.
Definition: component.h:283
HighFrequencyLoopRequester high_freq_
Definition: qmc5883l.h:59
enum esphome::qmc5883l::QMC5883LComponent::ErrorCode error_code_
float get_setup_priority() const override
Definition: qmc5883l.cpp:82
bool read_byte_16_(uint8_t a_register, uint16_t *data)
Definition: qmc5883l.cpp:141
void set_z_sensor(sensor::Sensor *z_sensor)
Definition: qmc5883l.h:41
sensor::Sensor * temperature_sensor_
Definition: qmc5883l.h:53
void set_x_sensor(sensor::Sensor *x_sensor)
Definition: qmc5883l.h:39
void set_heading_sensor(sensor::Sensor *heading_sensor)
Definition: qmc5883l.h:42
void set_y_sensor(sensor::Sensor *y_sensor)
Definition: qmc5883l.h:40
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57
QMC5883LOversampling oversampling_
Definition: qmc5883l.h:48
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition: qmc5883l.h:43
This Class provides the methods to read/write bytes from/to an i2c device.
Definition: i2c.h:133