ESPHome  2022.6.2
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 
44  protected:
52  enum ErrorCode {
53  NONE = 0,
55  } error_code_;
56  bool read_byte_16_(uint8_t a_register, uint16_t *data);
57 };
58 
59 } // namespace qmc5883l
60 } // 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:51
void set_oversampling(QMC5883LOversampling oversampling)
Definition: qmc5883l.h:38
This class simplifies creating components that periodically check a state.
Definition: component.h:266
enum esphome::qmc5883l::QMC5883LComponent::ErrorCode error_code_
float get_setup_priority() const override
Definition: qmc5883l.cpp:76
bool read_byte_16_(uint8_t a_register, uint16_t *data)
Definition: qmc5883l.cpp:119
void set_z_sensor(sensor::Sensor *z_sensor)
Definition: qmc5883l.h:41
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
Definition: a4988.cpp:4
Base-class for all sensors.
Definition: sensor.h:47
QMC5883LOversampling oversampling_
Definition: qmc5883l.h:47