ESPHome  2024.12.2
hmc5883l.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace hmc5883l {
9 
15 };
16 
25 };
26 
36 };
37 
39  public:
40  void setup() override;
41  void dump_config() override;
42  float get_setup_priority() const override;
43  void update() override;
44 
45  void set_oversampling(HMC5883LOversampling oversampling) { oversampling_ = oversampling; }
46  void set_datarate(HMC5883LDatarate datarate) { datarate_ = datarate; }
47  void set_range(HMC5883LRange range) { range_ = range; }
48  void set_x_sensor(sensor::Sensor *x_sensor) { x_sensor_ = x_sensor; }
49  void set_y_sensor(sensor::Sensor *y_sensor) { y_sensor_ = y_sensor; }
50  void set_z_sensor(sensor::Sensor *z_sensor) { z_sensor_ = z_sensor; }
51  void set_heading_sensor(sensor::Sensor *heading_sensor) { heading_sensor_ = heading_sensor; }
52 
53  protected:
61  enum ErrorCode {
62  NONE = 0,
65  } error_code_;
67 };
68 
69 } // namespace hmc5883l
70 } // namespace esphome
void set_range(HMC5883LRange range)
Definition: hmc5883l.h:47
sensor::Sensor * heading_sensor_
Definition: hmc5883l.h:60
Helper class to request loop() to be called as fast as possible.
Definition: helpers.h:622
void set_datarate(HMC5883LDatarate datarate)
Definition: hmc5883l.h:46
This class simplifies creating components that periodically check a state.
Definition: component.h:283
HighFrequencyLoopRequester high_freq_
Definition: hmc5883l.h:66
void set_oversampling(HMC5883LOversampling oversampling)
Definition: hmc5883l.h:45
HMC5883LOversampling oversampling_
Definition: hmc5883l.h:54
enum esphome::hmc5883l::HMC5883LComponent::ErrorCode error_code_
void set_z_sensor(sensor::Sensor *z_sensor)
Definition: hmc5883l.h:50
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57
void set_y_sensor(sensor::Sensor *y_sensor)
Definition: hmc5883l.h:49
void set_x_sensor(sensor::Sensor *x_sensor)
Definition: hmc5883l.h:48
float get_setup_priority() const override
Definition: hmc5883l.cpp:87
This Class provides the methods to read/write bytes from/to an i2c device.
Definition: i2c.h:133
void set_heading_sensor(sensor::Sensor *heading_sensor)
Definition: hmc5883l.h:51